/* Header Component Styles — extracted from backend/includes/header.php */

.header-nav-layer { position: relative; z-index: 50000; }
.header-sidebar-slot { width: 256px; height: 56px; }
.header-sidebar-toggle { width: 32px; height: 32px; flex-shrink: 0; }
#toggleIcon { display: inline-flex; align-items: center; justify-content: center; }
.header-logo-image { background: transparent; mix-blend-mode: normal; min-width: 80px; max-width: 160px; }
.header-logo-tooltip { z-index: 9999; }
.header-search-container { width: 280px; min-width: 240px; }
.header-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 16px; pointer-events: none; }
.header-search-input { width: 100%; padding: 8px 36px; box-sizing: border-box; }
.header-search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%; background-color: #e2e8f0; align-items: center; justify-content: center; cursor: pointer; border: 0; padding: 0; }
.header-search-clear:hover { background-color: #cbd5e1; }
.header-search-clear-icon { font-size: 11px; line-height: 1; }
.notif-toggle-btn { background-color: transparent; }
.notif-toggle-btn:hover { background-color: #f3f4f6; }
.impersonate-dialog { height: 520px; max-height: 90vh; }

/* Keep the active support notice visible without covering a form's bottom actions. */
.impersonation-banner {
    position: fixed;
    top: 50%;
    right: 24px;
    z-index: 99999;
    transform: translateY(-50%);
}

.impersonation-banner__content {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: center;
    gap: 0;
    min-height: 46px;
    width: 46px;
    height: 46px;
    box-sizing: border-box;
    padding: 5px;
    color: #b91c1c;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    border-radius: 999px;
    box-shadow: 0 12px 28px rgb(220 38 38 / 36%), 0 0 0 7px rgb(251 113 133 / 18%), 0 24px 52px rgb(220 38 38 / 18%);
    transition: width 220ms ease;
    animation: impersonation-notice-pulse 2.4s ease-in-out infinite,
        impersonation-bubble-bounce 1.35s ease-in-out infinite;
}

.impersonation-banner__content::before {
    position: absolute;
    inset: -7px;
    z-index: -1;
    pointer-events: none;
    content: '';
    border: 2px solid rgb(251 113 133 / 48%);
    border-radius: inherit;
    box-shadow: 0 0 18px rgb(251 113 133 / 30%);
    animation: impersonation-notice-ripple 1.9s ease-out infinite;
}

.impersonation-banner__toggle {
    position: absolute;
    top: 50%;
    right: 50%;
    transform: translate(50%, -50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    color: #fff;
    background: #dc2626;
    border-radius: 999px;
}

@keyframes impersonation-bubble-bounce {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes impersonation-notice-ripple {
    0% {
        opacity: 0.72;
        transform: scale(0.96);
    }

    72%, 100% {
        opacity: 0;
        transform: scale(1.72);
    }
}

.impersonation-banner.is-expanded .impersonation-banner__content {
    width: auto;
    height: auto;
    padding: 5px 46px 5px 12px;
    animation: impersonation-notice-pulse 2.4s ease-in-out infinite;
}

.impersonation-banner.is-expanded .impersonation-banner__toggle {
    top: 5px;
    right: 5px;
    transform: none;
}

.impersonation-banner__toggle:hover,
.impersonation-banner__toggle:focus-visible {
    background: #b91c1c;
}

.impersonation-banner__details {
    max-width: 0;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: max-width 220ms ease, margin 220ms ease, opacity 160ms ease;
    white-space: nowrap;
}

.impersonation-banner.is-expanded .impersonation-banner__details {
    max-width: 260px;
    margin-left: 8px;
    opacity: 1;
    pointer-events: auto;
}

@keyframes impersonation-notice-pulse {
    0%, 100% {
        border-color: #fecdd3;
        box-shadow: 0 12px 28px rgb(220 38 38 / 36%), 0 0 0 7px rgb(251 113 133 / 18%), 0 24px 52px rgb(220 38 38 / 18%);
    }

    50% {
        border-color: #fb7185;
        box-shadow: 0 18px 38px rgb(220 38 38 / 52%), 0 0 0 11px rgb(251 113 133 / 27%), 0 32px 68px rgb(220 38 38 / 28%);
    }
}

.impersonation-banner__content > i {
    color: #dc2626;
}

.impersonation-banner__content > span {
    font-size: 12px;
    font-weight: 700;
}

.impersonation-banner__content form button {
    padding: 4px 8px;
    color: #fff;
    background: #dc2626;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
}

.impersonation-banner__toggle {
    padding: 0;
}

.impersonation-banner__content form button:hover {
    background: #b91c1c;
}

@media (prefers-reduced-motion: reduce) {
    .impersonation-banner__content,
    .impersonation-banner__content::before,
    .impersonation-banner__details,
    .impersonation-banner__toggle {
        animation: none;
        transition: none;
    }
}

@media (max-width: 639px) {
    .impersonation-banner {
        top: auto;
        bottom: 20px;
        right: 12px;
        left: auto;
        transform: none;
    }

    .impersonation-banner__content {
        justify-content: center;
    }

    .impersonation-banner.is-expanded .impersonation-banner__details {
        max-width: 190px;
    }
}
.toast-container-layer { z-index: 99999 !important; }

@media (max-width: 640px) {
    .header-sidebar-slot {
        width: auto;
        min-width: 0;
        flex: 1 1 auto;
        padding-left: 0.5rem;
        padding-right: 0.25rem;
    }

    #headerLogo {
        min-width: 0;
    }

    .header-logo-image {
        max-width: 7rem;
    }

    .header-logo-tooltip {
        display: none;
    }

    .header-actions {
        gap: 0.125rem !important;
        margin-left: auto;
    }

    .header-quick-actions {
        gap: 0.25rem !important;
    }
}

/* Global Page Navigation Loading Overlay - Covers only main content area */
.main-content-wrapper {
    position: relative;
}
#globalPageLoadingOverlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex; /* Show by default on page load */
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
@keyframes slideDown {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.animate-slide-down {
    animation: slideDown 0.2s ease-out forwards;
}
.nav-center-adaptive {
    display: flex;
}
@media (max-width: 1399px) {
    .nav-center-adaptive {
        display: none !important;
    }
}

/* Notification badge blink animation (only used when notification has unread items) */
@keyframes notificationBlink {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.15);
    }
}
.notification-badge {
    animation: notificationBlink 1.2s ease-in-out infinite !important;
    will-change: opacity, transform;
}

/* Impersonate user list (only renders for Super Admin) */
.impersonate-user-item {
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}
#impersonateUserList.loading-active {
    opacity: 0.6;
    pointer-events: none;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.animate-fadeIn {
    animation: fadeIn 0.3s ease-out forwards;
}
