/**
 * ENNU Unified Header Styles
 * 
 * Consistent header component: Profile Badge (left), Logo (center), Support Badge (right)
 * Used across AI, Shop, Gift Cards, Service Credits, Membership pages
 * 
 * @package ENNU\Infrastructure
 * @since 2.0.0
 */

/* ===== CSS Variables ===== */
:root {
    --ennu-uh-cream: #FAF8F5;
    --ennu-uh-white: #ffffff;
    --ennu-uh-gold: #C9A962;
    --ennu-uh-gold-light: #E6D5A8;
    --ennu-uh-navy: #1A1F36;
    --ennu-uh-text: #2D3748;
    --ennu-uh-text-muted: #718096;
    --ennu-uh-border: rgba(201, 169, 98, 0.2);
    --ennu-uh-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --ennu-uh-shadow-elevated: 0 8px 32px rgba(0, 0, 0, 0.12);
    --ennu-uh-radius: 16px;
    --ennu-uh-radius-sm: 12px;
    --ennu-uh-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Header Container ===== */
.ennu-unified-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 32px;
    background: var(--ennu-uh-cream);
    border-bottom: 1px solid var(--ennu-uh-border);
    transition: padding 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Scrolled state - shrink header */
.ennu-unified-header.is-scrolled {
    padding: 12px 32px;
    background: var(--ennu-uh-white);
    box-shadow: var(--ennu-uh-shadow-elevated);
}

/* ===== Profile Badge (Left) ===== */
.ennu-unified-header__profile-badge {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 20px;
    z-index: 1001; /* Higher than sidebar to stay on top */
}

.ennu-unified-header__profile-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 2px solid var(--ennu-uh-border);
    border-radius: 50%;
    background: var(--ennu-uh-white);
    cursor: pointer;
    transition: var(--ennu-uh-transition);
    box-shadow: var(--ennu-uh-shadow);
}

.ennu-unified-header__profile-trigger:hover {
    border-color: var(--ennu-uh-gold);
    transform: scale(1.05);
}

.ennu-unified-header__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.ennu-unified-header__avatar--guest {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--ennu-uh-cream);
    border-radius: 50%;
    color: var(--ennu-uh-text-muted);
}

/* ===== Profile Dropdown ===== */
.ennu-unified-header__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 280px;
    background: var(--ennu-uh-white);
    border: 1px solid var(--ennu-uh-border);
    border-radius: var(--ennu-uh-radius);
    box-shadow: var(--ennu-uh-shadow-elevated);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--ennu-uh-transition);
    z-index: 10001; /* Must be above retail shop sidebar */
    max-height: 80vh;
    overflow-y: auto;
}

.ennu-unified-header__dropdown.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ennu-unified-header__dropdown-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--ennu-uh-border);
    background: linear-gradient(135deg, var(--ennu-uh-cream) 0%, var(--ennu-uh-white) 100%);
    border-radius: var(--ennu-uh-radius) var(--ennu-uh-radius) 0 0;
}

.ennu-unified-header__dropdown-header--guest {
    text-align: center;
}

.ennu-unified-header__dropdown-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--ennu-uh-navy);
    margin-bottom: 2px;
}

.ennu-unified-header__dropdown-email {
    font-size: 13px;
    color: var(--ennu-uh-text-muted);
}

.ennu-unified-header__dropdown-divider {
    height: 1px;
    background: var(--ennu-uh-border);
    margin: 8px 0;
}

.ennu-unified-header__dropdown-label {
    padding: 8px 20px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ennu-uh-accent);
    border-bottom: 1px solid var(--ennu-uh-border);
    margin-bottom: 4px;
}

.ennu-unified-header__dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--ennu-uh-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--ennu-uh-transition);
}

.ennu-unified-header__dropdown-item:hover {
    background: var(--ennu-uh-cream);
    color: var(--ennu-uh-gold);
}

.ennu-unified-header__dropdown-item svg {
    flex-shrink: 0;
    color: var(--ennu-uh-text-muted);
    transition: var(--ennu-uh-transition);
}

.ennu-unified-header__dropdown-item:hover svg {
    color: var(--ennu-uh-gold);
}

.ennu-unified-header__dropdown-item--logout {
    color: #E53E3E;
}

.ennu-unified-header__dropdown-item--logout:hover {
    background: #FFF5F5;
    color: #C53030;
}

.ennu-unified-header__dropdown-item--logout svg {
    color: #E53E3E;
}

/* Affiliate Stats Box */
.ennu-unified-header__affiliate-box {
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 8px;
    margin: 8px 12px;
}

.ennu-unified-header__affiliate-box-title {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #374151;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.ennu-unified-header__affiliate-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
}

.ennu-unified-header__affiliate-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.ennu-unified-header__affiliate-stat-value {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.2;
}

.ennu-unified-header__affiliate-stat-label {
    font-size: 10px;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ennu-unified-header__affiliate-url-wrapper {
    display: flex;
    gap: 6px;
    align-items: stretch;
}

.ennu-unified-header__affiliate-url {
    flex: 1;
    padding: 6px 10px;
    font-size: 11px;
    color: #374151;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    cursor: text;
    min-width: 0;
    text-overflow: ellipsis;
}

.ennu-unified-header__affiliate-url:focus {
    outline: none;
    border-color: var(--ennu-uh-gold, #d4af37);
}

.ennu-unified-header__affiliate-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    padding: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
}

.ennu-unified-header__affiliate-copy:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #374151;
}

.ennu-unified-header__affiliate-copy.copied {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}

.ennu-unified-header__affiliate-copy.copied svg {
    stroke: #fff;
}

/* Primary dropdown item (Schedule Appointment) */
.ennu-unified-header__dropdown-item--primary {
    background: linear-gradient(135deg, #1a1a1a 0%, #333333 100%);
    color: #ffffff !important;
    border-radius: 8px;
    margin: 4px 8px;
    padding: 12px 16px !important;
}

.ennu-unified-header__dropdown-item--primary:hover {
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
    color: #ffffff !important;
}

.ennu-unified-header__dropdown-item--primary svg {
    color: #ffffff;
}

/* ===== Logo (Center) ===== */
.ennu-unified-header__logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    transition: margin 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.ennu-unified-header.is-scrolled .ennu-unified-header__logo {
    margin-bottom: 0;
}

.ennu-unified-header__logo-img {
    max-height: 72px;
    width: auto;
    object-fit: contain; /* Prevent squishing */
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Logo shrink animation on scroll */
.ennu-unified-header.is-scrolled .ennu-unified-header__logo-img {
    max-height: 40px;
    transform: scale(0.95);
}

.ennu-unified-header__title {
    display: none; /* Hidden on all devices */
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-size: 28px;
    font-weight: 600;
    color: var(--ennu-uh-navy);
    margin: 0 0 4px 0;
    text-align: center;
    opacity: 1;
    max-height: 40px;
    overflow: hidden;
    transition: opacity 0.25s ease, max-height 0.35s ease, margin 0.35s ease;
}

.ennu-unified-header.is-scrolled .ennu-unified-header__title {
    opacity: 0;
    max-height: 0;
    margin: 0;
}

.ennu-unified-header__subtitle {
    display: none; /* Hidden on all devices */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: var(--ennu-uh-text-muted);
    margin: 0;
    text-align: center;
    opacity: 1;
    max-height: 24px;
    overflow: hidden;
    transition: opacity 0.25s ease, max-height 0.35s ease;
}

.ennu-unified-header.is-scrolled .ennu-unified-header__subtitle {
    opacity: 0;
    max-height: 0;
}

/* ===== Support Badge (Right) ===== */
.ennu-unified-header__support-badge {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 20px;
    z-index: 1001; /* Higher than sidebar to stay on top */
}

/* Rotating hint text */
.ennu-unified-header__support-hint {
    display: none;
    position: absolute;
    right: 52px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 300;
    color: var(--ennu-uh-text-muted, #6b7280);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    letter-spacing: 0.3px;
}

@media (max-width: 768px) {
    .ennu-unified-header__support-hint {
        display: none !important; /* Hide on mobile */
    }
}

.ennu-unified-header__support-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 2px solid var(--ennu-uh-border);
    border-radius: 50%;
    background: var(--ennu-uh-white);
    cursor: pointer;
    transition: var(--ennu-uh-transition);
    box-shadow: var(--ennu-uh-shadow);
}

.ennu-unified-header__support-trigger:hover {
    border-color: var(--ennu-uh-gold);
    transform: scale(1.05);
}

.ennu-unified-header__support-photo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.ennu-unified-header__support-photo--default {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--ennu-uh-cream);
    border-radius: 50%;
    color: var(--ennu-uh-gold);
}

.ennu-unified-header__support-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--ennu-uh-white);
    background: #A0AEC0;
}

.ennu-unified-header__support-status[data-status="online"] {
    background: #48BB78;
}

.ennu-unified-header__support-status[data-status="away"] {
    background: #ECC94B;
}

/* ===== Support Tooltip ===== */
.ennu-unified-header__support-tooltip {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 260px;
    background: var(--ennu-uh-white);
    border: 1px solid var(--ennu-uh-border);
    border-radius: var(--ennu-uh-radius);
    box-shadow: var(--ennu-uh-shadow-elevated);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--ennu-uh-transition);
    z-index: 10001; /* Must be above retail shop sidebar */
}

.ennu-unified-header__support-tooltip.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ennu-unified-header__support-tooltip-arrow {
    position: absolute;
    top: -6px;
    right: 16px;
    width: 12px;
    height: 12px;
    background: var(--ennu-uh-white);
    border-top: 1px solid var(--ennu-uh-border);
    border-left: 1px solid var(--ennu-uh-border);
    transform: rotate(45deg);
}

.ennu-unified-header__support-tooltip-content {
    padding: 16px 18px 18px;
}

.ennu-unified-header__support-tooltip-header {
    margin-bottom: 6px;
    text-align: center;
}

.ennu-unified-header__support-tooltip-name {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--ennu-uh-navy);
    letter-spacing: -0.01em;
}

.ennu-unified-header__support-tooltip-title {
    display: block;
    font-size: 13px;
    color: var(--ennu-uh-text-muted);
    margin-top: 2px;
}

.ennu-unified-header__support-tooltip-meta {
    margin-bottom: 14px;
    text-align: center;
}

.ennu-unified-header__support-tooltip-response {
    font-size: 12px;
    color: var(--ennu-uh-gold);
    font-weight: 500;
}

.ennu-unified-header__support-tooltip-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: var(--ennu-uh-gold);
    color: var(--ennu-uh-white);
    border: none;
    border-radius: var(--ennu-uh-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--ennu-uh-transition);
}

.ennu-unified-header__support-tooltip-btn:hover {
    background: var(--ennu-uh-navy);
}

.ennu-unified-header__support-tooltip-btn svg {
    flex-shrink: 0;
}

/* Support Tooltip Buttons Container */
.ennu-unified-header__support-tooltip-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.ennu-unified-header__support-tooltip-buttons .ennu-unified-header__support-tooltip-btn {
    flex: 1;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ennu-unified-header__support-tooltip-btn--sms {
    background: linear-gradient(135deg, #2C3E50 0%, #1a252f 100%);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ennu-unified-header__support-tooltip-btn--sms:hover {
    background: linear-gradient(135deg, #34495E 0%, #2C3E50 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.ennu-unified-header__support-tooltip-btn--chat {
    background: linear-gradient(135deg, #C9A962 0%, #B8943D 100%);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.ennu-unified-header__support-tooltip-btn--chat:hover {
    background: linear-gradient(135deg, #D4B56D 0%, #C9A962 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(201, 169, 98, 0.3);
}

.ennu-unified-header__support-tooltip-btn svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    .ennu-unified-header {
        padding: 12px 16px;
        min-height: 56px;
    }

    .ennu-unified-header.is-scrolled {
        padding: 8px 16px;
        min-height: 48px;
    }

    .ennu-unified-header__profile-badge,
    .ennu-unified-header__support-badge {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
    }

    .ennu-unified-header__profile-badge {
        left: 12px;
    }

    .ennu-unified-header__support-badge {
        right: 12px;
    }

    .ennu-unified-header__profile-trigger,
    .ennu-unified-header__support-trigger {
        width: 36px;
        height: 36px;
    }

    .ennu-unified-header__avatar,
    .ennu-unified-header__avatar--guest,
    .ennu-unified-header__support-photo,
    .ennu-unified-header__support-photo--default {
        width: 28px;
        height: 28px;
    }

    .ennu-unified-header__logo-img {
        max-height: 48px;
        object-fit: contain;
    }

    .ennu-unified-header.is-scrolled .ennu-unified-header__logo-img {
        max-height: 32px;
    }

    .ennu-unified-header__title,
    .ennu-unified-header__subtitle {
        display: none;
    }

    .ennu-unified-header__logo {
        margin-bottom: 0;
    }

    /* Dropdowns on mobile - full width drawer style */
    .ennu-unified-header__dropdown {
        position: fixed !important;
        top: 70px !important;
        left: 12px !important;
        right: 12px !important;
        bottom: auto !important;
        max-width: calc(100vw - 24px) !important;
        width: auto !important;
        min-width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        max-height: calc(100vh - 90px) !important;
        overflow-y: auto !important;
        border-radius: var(--ennu-uh-radius) !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2) !important;
        z-index: 10000 !important;
    }

    /* Adjust dropdown position when header is scrolled/shrunk */
    .is-scrolled .ennu-unified-header__dropdown {
        top: 56px !important;
    }

    .ennu-unified-header__support-tooltip,
    .ennu-unified-header .ennu-unified-header__support-tooltip,
    .ennu-unified-header__support-badge .ennu-unified-header__support-tooltip {
        position: fixed !important;
        top: 70px !important;
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
        min-width: unset !important;
        max-width: unset !important;
        z-index: 10000 !important;
        transform: none !important;
    }

    .is-scrolled .ennu-unified-header__support-tooltip,
    .is-scrolled .ennu-unified-header .ennu-unified-header__support-tooltip {
        top: 56px !important;
    }
    
    /* Center the arrow on mobile */
    .ennu-unified-header__support-tooltip-arrow {
        right: auto !important;
        left: calc(100% - 40px) !important;
    }

    /* Mobile dropdown items - larger touch targets */
    .ennu-unified-header__dropdown-item {
        padding: 14px 20px !important;
        font-size: 15px !important;
    }

    .ennu-unified-header__dropdown-header {
        padding: 18px 20px !important;
    }
}

/* ===== Utility Classes for Pages Using Unified Header ===== */

/* 
 * Container class for content that follows unified header
 * Required because header is always fixed
 * 
 * Desktop header height breakdown:
 * - padding: 24px top + 24px bottom = 48px
 * - logo: 48px
 * - title: ~36px (optional)
 * - subtitle: ~20px (optional)
 * - Total with title: ~150px, without: ~100px
 */
.ennu-unified-header-content {
    padding-top: 160px; /* Space for fixed header with title/subtitle */
    transition: padding-top 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.ennu-unified-header-content.is-scrolled-offset {
    padding-top: 80px; /* Space when header is shrunk (logo only) */
}

/* For pages without title/subtitle (logo only) */
.ennu-unified-header-content--compact {
    padding-top: 100px;
}

.ennu-unified-header-content--compact.is-scrolled-offset {
    padding-top: 70px;
}

/* Mobile: Header is always compact (no title/subtitle shown) */
@media (max-width: 768px) {
    .ennu-unified-header-content,
    .ennu-unified-header-content--compact {
        padding-top: 80px !important; /* Shorter mobile header */
    }
    
    .ennu-unified-header-content.is-scrolled-offset,
    .ennu-unified-header-content--compact.is-scrolled-offset {
        padding-top: 60px !important;
    }
}

/* ===== Keyframe Animations ===== */
@keyframes ennu-uh-slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ennu-unified-header__dropdown.is-open,
.ennu-unified-header__support-tooltip.is-open {
    animation: ennu-uh-slideDown 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   AESTHETIC DIVISION COLOR SCHEME
   Charcoal Grey/Black palette (replaces Gold/Navy for ENNU Aesthetics)
   ========================================================================== */
[data-division="aesthetic"] .ennu-unified-header,
.ennu-unified-header[data-division="aesthetic"],
[data-division="aesthetic"].ennu-unified-header-content .ennu-unified-header {
    /* Primary Accent - Charcoal Grey (replaces gold) */
    --ennu-uh-gold: #374151;
    --ennu-uh-gold-light: #4B5563;
    --ennu-uh-gold-dark: #1F2937;
    
    /* Secondary - Black (replaces navy) */
    --ennu-uh-navy: #111111;
    --ennu-uh-navy-light: #2D2D2D;
    --ennu-uh-navy-dark: #000000;
    
    /* Borders (charcoal-based) */
    --ennu-uh-border: rgba(55, 65, 81, 0.25);
    
    /* Text */
    --ennu-uh-text: #1F2937;
    --ennu-uh-text-muted: #4B5563;
}

/* Aesthetic: Chat button should have white text on charcoal */
[data-division="aesthetic"] .ennu-unified-header__support-tooltip-btn {
    background: #374151;
    color: #FFFFFF;
}

[data-division="aesthetic"] .ennu-unified-header__support-tooltip-btn:hover {
    background: #1F2937;
}

/* Aesthetic: Support icon default color */
[data-division="aesthetic"] .ennu-unified-header__support-photo--default {
    color: #374151;
}

/* Aesthetic: Dropdown hover states */
[data-division="aesthetic"] .ennu-unified-header__dropdown-item:hover {
    color: #374151;
}

[data-division="aesthetic"] .ennu-unified-header__dropdown-item:hover svg {
    color: #374151;
}

/* Aesthetic: Profile trigger hover */
[data-division="aesthetic"] .ennu-unified-header__profile-trigger:hover,
[data-division="aesthetic"] .ennu-unified-header__support-trigger:hover {
    border-color: #374151;
}
