/**
 * Notification Bell + Panel styles
 *
 * @package SD_Profile
 * @since 1.3.0
 */

/* ═══════════════════════════════════════════════════════
   BADGE (shared across mobile + desktop)
   ═══════════════════════════════════════════════════════ */
.sd-notif-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #f44336;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    border-radius: 10px;
    pointer-events: none;
    box-shadow: 0 1px 4px rgba(244, 67, 54, 0.4);
    animation: sd-notif-badge-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sd-notif-badge:empty {
    min-width: 10px;
    height: 10px;
    padding: 0;
    top: 3px;
    right: 3px;
    box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(244, 67, 54, 0.4);
}

@keyframes sd-notif-badge-pop {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

/* Mobile header bell — needs relative for badge positioning */
.sd-mobile-header__menu-btn.sd-notifications-trigger {
    position: relative;
}

/* Mobile header actions wrapper */
.sd-mobile-header__actions {
    display: flex;
    align-items: center;
    gap: var(--sd-spacing-sm, 8px);
}

/* Desktop sidebar notification section */
.sd-sidebar-notifications {
    border-top: 1px solid var(--sd-gray-200, #eee);
    padding: var(--sd-spacing-sm, 8px) 0;
}

.sd-sidebar-notifications .sd-notifications-trigger {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    font-size: 15px;
    position: relative;
    transition: background 0.15s, color 0.15s;
}

.sd-sidebar-notifications .sd-notifications-trigger:hover {
    background: var(--sd-gray-50, #fafafa);
    color: var(--sd-primary, #ff4081);
}

/* Badge inside sidebar nav link */
.sd-sidebar-nav__badge.sd-notif-badge {
    position: static;
    margin-left: auto;
    animation: none;
    box-shadow: none;
}

/* ═══════════════════════════════════════════════════════
   PANEL BACKDROP
   ═══════════════════════════════════════════════════════ */
.sd-notif-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 10099;
    opacity: 0;
    transition: opacity 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}

.sd-notif-backdrop--visible {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════
   PANEL (Desktop — slides from sidebar)
   ═══════════════════════════════════════════════════════ */
.sd-notif-panel {
    position: fixed;
    top: 0;
    left: var(--sd-sidebar-width, 260px);
    width: 380px;
    height: 100vh;
    background: #fff;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08);
    z-index: 10100;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0s linear 0.3s;
    border-right: 1px solid var(--sd-gray-200, #eee);
    visibility: hidden;
}

.sd-notif-panel--open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0s linear 0s;
}

/* ═══════════════════════════════════════════════════════
   PANEL HEADER
   ═══════════════════════════════════════════════════════ */
.sd-notif-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--sd-gray-200, #eee);
    flex-shrink: 0;
    background: var(--sd-gray-50, #fafafa);
}

.sd-notif-panel__title {
    font-size: 17px;
    font-weight: 700;
    color: var(--sd-gray-800, #424242);
    margin: 0;
    letter-spacing: -0.2px;
}

.sd-notif-panel__mark-all {
    background: none;
    border: none;
    color: var(--sd-primary, #ff4081);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 20px;
    transition: background 0.15s, opacity 0.15s;
}

.sd-notif-panel__mark-all:hover {
    background: rgba(255, 64, 129, 0.08);
}

.sd-notif-panel__mark-all:disabled {
    opacity: 0;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════
   PANEL BODY (scrollable list)
   ═══════════════════════════════════════════════════════ */
.sd-notif-panel__body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* ═══════════════════════════════════════════════════════
   NOTIFICATION ITEM
   ═══════════════════════════════════════════════════════ */
.sd-notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 20px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--sd-gray-100, #f5f5f5);
    position: relative;
}

.sd-notif-item:last-child {
    border-bottom: none;
}

.sd-notif-item:hover {
    background: var(--sd-gray-50, #fafafa);
}

.sd-notif-item:active {
    background: var(--sd-gray-100, #f5f5f5);
}

.sd-notif-item--unread {
    background: linear-gradient(135deg, rgba(255, 64, 129, 0.03) 0%, rgba(255, 128, 171, 0.05) 100%);
}

.sd-notif-item--unread:hover {
    background: linear-gradient(135deg, rgba(255, 64, 129, 0.06) 0%, rgba(255, 128, 171, 0.08) 100%);
}

.sd-notif-item__avatar-wrap {
    position: relative;
    flex-shrink: 0;
    width: 46px;
    height: 46px;
}

.sd-notif-item__avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--sd-gray-100, #f5f5f5);
    border: 2px solid transparent;
}

.sd-notif-item--unread .sd-notif-item__avatar {
    border-color: var(--sd-primary-light, #ff80ab);
}

/* Locked (paywalled) notification — blurred avatar + lock icon */
.sd-notif-item--locked .sd-notif-item__avatar {
    filter: blur(6px);
    transform: scale(1.1);
    border-color: var(--sd-gray-300, #e0e0e0);
}

.sd-notif-item__lock-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.sd-notif-item__lock-icon svg {
    width: 16px;
    height: 16px;
}

.sd-notif-item--locked .sd-notif-item__message {
    color: var(--sd-gray-500, #9e9e9e);
    font-style: italic;
}

.sd-notif-item__content {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.sd-notif-item__message {
    font-size: 13.5px;
    color: var(--sd-gray-600, #757575);
    line-height: 1.45;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sd-notif-item--unread .sd-notif-item__message {
    color: var(--sd-gray-800, #424242);
    font-weight: 600;
}

.sd-notif-item__time {
    font-size: 11.5px;
    color: var(--sd-gray-400, #bdbdbd);
    margin-top: 3px;
    display: block;
}

.sd-notif-item--unread .sd-notif-item__time {
    color: var(--sd-primary, #ff4081);
    font-weight: 500;
}

.sd-notif-item__dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--sd-primary, #ff4081);
    flex-shrink: 0;
    margin-top: 6px;
    box-shadow: 0 0 0 3px rgba(255, 64, 129, 0.15);
}

/* ═══════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════ */
.sd-notif-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
}

.sd-notif-empty svg {
    margin-bottom: 16px;
    opacity: 0.3;
    color: var(--sd-gray-400, #bdbdbd);
}

.sd-notif-empty__text {
    font-size: 14px;
    color: var(--sd-gray-400, #bdbdbd);
    font-weight: 500;
}

/* ═══════════════════════════════════════════════════════
   LOADING STATE
   ═══════════════════════════════════════════════════════ */
.sd-notif-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}

.sd-notif-loading__spinner {
    width: 28px;
    height: 28px;
    border: 2.5px solid var(--sd-gray-200, #eee);
    border-top-color: var(--sd-primary, #ff4081);
    border-radius: 50%;
    animation: sd-notif-spin 0.7s linear infinite;
}

@keyframes sd-notif-spin {
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════
   MOBILE PANEL (< 769px) — slides down from header
   ═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .sd-notif-panel {
        left: 0;
        width: 100%;
        top: var(--sd-header-height, 60px);
        height: auto;
        max-height: calc(100vh - var(--sd-header-height, 60px) - var(--sd-mobile-nav-height, 56px));
        border-right: none;
        border-radius: 0 0 var(--sd-radius-lg, 16px) var(--sd-radius-lg, 16px);
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
        transform: translateY(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                    visibility 0s linear 0.3s;
    }

    .sd-notif-panel--open {
        transform: translateY(0);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                    visibility 0s linear 0s;
    }

    .sd-notif-panel__header {
        padding: 14px 16px;
        background: #fff;
    }

    .sd-notif-panel__title {
        font-size: 16px;
    }

    .sd-notif-item {
        padding: 12px 16px;
        gap: 10px;
    }

    .sd-notif-item__avatar {
        width: 42px;
        height: 42px;
    }

    .sd-notif-item__message {
        font-size: 13px;
    }

    .sd-notif-backdrop {
        top: var(--sd-header-height, 60px);
        bottom: var(--sd-mobile-nav-height, 56px);
    }
}

/* WP Admin bar offset */
body.admin-bar .sd-notif-panel {
    top: 32px;
}

@media (max-width: 768px) {
    body.admin-bar .sd-notif-panel {
        top: calc(var(--sd-header-height, 60px) + 46px);
    }
}
