/* PREMIUM NOTIFICATION FLYOUT - THE LIVE FEED */
.notification-flyout {
    position: absolute;
    top: 60px;
    right: -10px;
    width: 440px;
    background: #ffffff;
    border-radius: 36px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 50px 120px -30px rgba(0, 0, 0, 0.25), 
                0 0 0 1px rgba(0, 0, 0, 0.02);
    display: none;
    flex-direction: column;
    z-index: 10000;
    transform-origin: top right;
    animation: flyout-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

@keyframes flyout-in {
    from { opacity: 0; transform: translateY(16px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Pointer Tail */
.notification-flyout::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 22px;
    width: 16px;
    height: 16px;
    background: rgba(255, 255, 255, 0.95);
    transform: rotate(45deg);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(20px);
}

/* Header */
.flyout-header {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.flyout-header h3 {
    font-size: 1.15rem;
    font-weight: 900;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.02em;
    font-family: 'Outfit', sans-serif;
}

.badge-count {
    background: #0f172a;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 900;
    padding: 4px 10px;
    border-radius: 100px;
}

.flyout-mark-all-btn {
    background: none;
    border: none;
    font-size: 0.68rem;
    font-weight: 800;
    color: #2563eb;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    opacity: 0.85;
    transition: 0.2s;
}

.flyout-mark-all-btn:hover {
    opacity: 1;
    background: #eff6ff;
}

/* Scrollable Body */
.flyout-body {
    max-height: 480px;
    overflow-y: auto;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.1) transparent;
}

.flyout-body::-webkit-scrollbar { width: 5px; }
.flyout-body::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); border-radius: 10px; }
.flyout-body:hover::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); }

/* Item Design */
.flyout-item {
    padding: 18px 24px;
    display: flex;
    gap: 16px;
    transition: all 0.25s ease;
    cursor: pointer;
    position: relative;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.flyout-item:hover {
    background: rgba(37, 99, 235, 0.03);
    padding-left: 30px;
}

.flyout-item.unread::after {
    content: '';
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: #2563eb;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.4);
}

.item-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
    background: #fff !important;
    border: 1px solid rgba(0,0,0,0.04);
}

.item-text { 
    flex: 1;
    min-width: 0;
}

.item-message {
    font-size: 0.88rem;
    font-weight: 700;
    color: #334155;
    line-height: 1.4;
    margin-bottom: 4px;
    word-break: break-word;
}

.item-message b { color: #0f172a; font-weight: 900; }

.item-time {
    font-size: 0.72rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Bell Wrapper Refinement */
.bell-wrapper {
    position: relative;
    z-index: 10001;
}

/* Premium Numeric Badge for the Bell */
.notification-badge-count {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border-radius: 10px;
    border: 2px solid #fff;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
    pointer-events: none;
    z-index: 2;
    font-family: 'Inter', sans-serif;
}

@keyframes pulse-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.pulse-pop {
    animation: pulse-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ==========================================================================
   Flyout Pagination Footer
   ========================================================================== */
.flyout-footer-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 22px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: #f8fafc;
}

.flyout-page-info {
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
}

.flyout-page-info strong {
    color: #0f172a;
}

.flyout-page-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.flyout-page-btn {
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #1e293b;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.flyout-page-btn:hover:not(:disabled):not(.active) {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

.flyout-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background: #f1f5f9;
}

.flyout-page-btn.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

/* ==========================================================================
   RTL Desktop Overrides
   ========================================================================== */
html[dir="rtl"] .notification-flyout {
    right: auto;
    left: -10px;
    transform-origin: top left;
}

html[dir="rtl"] .notification-flyout::before {
    right: auto;
    left: 22px;
}

html[dir="rtl"] .flyout-item {
    text-align: right;
}

html[dir="rtl"] .flyout-item:hover {
    padding-left: 24px;
    padding-right: 30px;
}

html[dir="rtl"] .flyout-item.unread::after {
    right: auto;
    left: 24px;
}

html[dir="rtl"] .bell-wrapper .notification-badge-count {
    right: auto !important;
    left: -2px !important;
}

html[dir="rtl"] .flyout-page-btn.prev i,
html[dir="rtl"] .flyout-page-btn.next i {
    transform: scaleX(-1);
}

/* ==========================================================================
   Mobile Responsiveness (Applies cleanly to BOTH LTR and RTL under 768px)
   ========================================================================== */
@media (max-width: 768px) {
    .notification-flyout,
    html[dir="rtl"] .notification-flyout {
        position: fixed !important;
        left: 14px !important;
        right: 14px !important;
        top: 74px !important;
        width: auto !important;
        max-width: none !important;
        border-radius: 24px !important;
        max-height: calc(85vh - 74px) !important;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25) !important;
        transform-origin: top center !important;
        z-index: 100050 !important;
    }

    .notification-flyout::before,
    html[dir="rtl"] .notification-flyout::before {
        display: none !important;
    }

    .flyout-header {
        padding: 16px 20px !important;
    }

    .flyout-header h3 {
        font-size: 1.05rem !important;
    }

    .flyout-body {
        max-height: calc(85vh - 165px) !important;
        padding: 6px 0 !important;
    }

    .flyout-item {
        padding: 14px 18px !important;
        gap: 12px !important;
    }

    .flyout-item:hover,
    html[dir="rtl"] .flyout-item:hover {
        padding-left: 18px !important;
        padding-right: 18px !important;
    }

    .item-icon {
        width: 44px !important;
        height: 44px !important;
        font-size: 1.25rem !important;
        border-radius: 14px !important;
    }

    .item-message {
        font-size: 0.84rem !important;
        line-height: 1.35 !important;
        margin-bottom: 4px !important;
    }

    .item-time {
        font-size: 0.7rem !important;
    }

    .flyout-item.unread::after {
        right: 16px !important;
        left: auto !important;
        width: 7px !important;
        height: 7px !important;
    }

    html[dir="rtl"] .flyout-item.unread::after {
        left: 16px !important;
        right: auto !important;
    }

    .flyout-footer-pagination {
        padding: 10px 16px !important;
    }
}

@media (max-width: 420px) {
    .notification-flyout,
    html[dir="rtl"] .notification-flyout {
        left: 8px !important;
        right: 8px !important;
        top: 68px !important;
        border-radius: 20px !important;
    }

    .flyout-header {
        padding: 14px 16px !important;
    }

    .flyout-item {
        padding: 12px 14px !important;
        gap: 10px !important;
    }

    .item-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.15rem !important;
        border-radius: 12px !important;
    }
}
