/* Rabta — header notification dropdown (fixed portal, anchored to bell) */

@keyframes rabta-notify-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes rabta-notify-dropdown-in {
    0% {
        opacity: 0;
        transform: translateY(-6px) scale(0.97);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes rabta-notify-item-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rabta-notify-header-glow {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.85; }
}

.tw-notifications-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1090;
    background: rgba(3, 7, 18, 0.38);
    animation: rabta-notify-backdrop-in 0.2s ease-out;
    cursor: default;
}

.tw-topbar.tw-topbar--notify-open {
    z-index: 1100 !important;
}

.tw-notifications-wrap {
    position: relative;
    display: inline-block;
}

/* Portal panel — positioned by RabtaNotifications.js under bell button */
.tw-notifications-dropdown--portal {
    position: fixed;
    z-index: 1110;
    display: flex;
    flex-direction: column;
    width: 360px;
    max-width: calc(100vw - 24px);
    max-height: min(460px, calc(100vh - 24px));
    margin: 0;
    top: 0;
    left: 0;
    background: #ffffff !important;
    border-radius: 16px !important;
    border: 1px solid rgba(10, 117, 173, 0.16) !important;
    box-shadow:
        0 24px 56px rgba(15, 23, 42, 0.22),
        0 8px 20px rgba(15, 23, 42, 0.1) !important;
    overflow: hidden;
    animation: rabta-notify-dropdown-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) !important;
    transform-origin: top center;
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.tw-notifications-dropdown--portal::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline: 0;
    height: 3px;
    background: linear-gradient(90deg, #0a75ad, #00e5d4, #6366f1);
    z-index: 1;
}

.tw-notifications-header {
    position: relative;
    flex-shrink: 0;
    padding: 0.95rem 1.1rem 0.8rem !important;
    background: linear-gradient(135deg, #0a1628 0%, #0d2137 55%, #0f2847 100%) !important;
    color: #f8fafc !important;
    font-weight: 700 !important;
    font-size: 0.9rem !important;
    display: flex;
    align-items: center;
    gap: 0.65rem !important;
    overflow: hidden;
}

.tw-notifications-header::after {
    content: '';
    position: absolute;
    top: -40%;
    inset-inline-end: -15%;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 229, 212, 0.25), transparent 70%);
    animation: rabta-notify-header-glow 3s ease-in-out infinite;
    pointer-events: none;
}

.tw-notifications-header-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 229, 212, 0.15);
    color: #00e5d4;
    flex-shrink: 0;
}

.tw-notifications-header-text {
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}

.tw-notifications-header-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.65rem;
    height: 1.65rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.tw-notifications-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0.25rem 0;
    overflow-y: auto;
    overflow-x: hidden;
    background: #f8fafc;
}

.tw-notification-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem !important;
    padding: 0.85rem 1.05rem !important;
    cursor: pointer;
    border-bottom: 1px solid rgba(15, 23, 42, 0.07) !important;
    transition: background 0.18s ease;
    text-decoration: none !important;
    animation: rabta-notify-item-in 0.35s ease-out backwards;
    background: transparent;
}

.tw-notification-item:nth-child(1) { animation-delay: 0.04s; }
.tw-notification-item:nth-child(2) { animation-delay: 0.09s; }
.tw-notification-item:nth-child(3) { animation-delay: 0.14s; }

.tw-notification-item:last-child {
    border-bottom: none !important;
}

.tw-notification-item:hover {
    background: rgba(10, 117, 173, 0.07) !important;
    transform: none !important;
}

.tw-notification-icon {
    width: 2.35rem !important;
    height: 2.35rem !important;
    border-radius: 12px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem !important;
}

.tw-notification-icon.danger {
    background: rgba(239, 68, 68, 0.14);
    color: #ef4444;
}

.tw-notification-icon.warning {
    background: rgba(245, 158, 11, 0.14);
    color: #d97706;
}

.tw-notification-icon.info {
    background: rgba(59, 130, 246, 0.14);
    color: #3b82f6;
}

.tw-notification-content {
    flex: 1;
    min-width: 0;
}

.tw-notification-label {
    display: block;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #64748b;
    margin-bottom: 0.12rem;
}

.tw-notification-text {
    font-size: 0.84rem !important;
    color: #334155 !important;
    line-height: 1.5 !important;
    font-weight: 500 !important;
}

.tw-notification-text strong {
    font-weight: 800;
}

.tw-notifications-footer {
    flex-shrink: 0;
    padding: 0.7rem 1rem;
    background: #f1f5f9;
    border-top: 1px solid rgba(10, 117, 173, 0.1);
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    line-height: 1.4;
}

/* Dark theme */
html[data-app-theme="dark"] .tw-notifications-dropdown--portal {
    background: #0f172a !important;
    border-color: rgba(0, 229, 212, 0.2) !important;
    box-shadow:
        0 28px 64px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(0, 229, 212, 0.08) inset !important;
}

html[data-app-theme="dark"] .tw-notifications-body {
    background: #111827;
}

html[data-app-theme="dark"] .tw-notification-item {
    border-bottom-color: rgba(0, 229, 212, 0.08) !important;
}

html[data-app-theme="dark"] .tw-notification-item:hover {
    background: rgba(0, 229, 212, 0.08) !important;
}

html[data-app-theme="dark"] .tw-notification-label {
    color: #94a3b8;
}

html[data-app-theme="dark"] .tw-notification-text {
    color: #e2e8f0 !important;
}

html[data-app-theme="dark"] .tw-notifications-footer {
    background: #0b1220;
    border-top-color: rgba(0, 229, 212, 0.12);
    color: #94a3b8;
}

/* Legacy absolute dropdown inside wrap — hide if theme-ui still references it */
.tw-notifications-wrap > .tw-notifications-dropdown:not(.tw-notifications-dropdown--portal) {
    display: none !important;
}
