/**
 * Trev Platform - Unified Header Styles
 * Version: 3.0.0
 * Desktop-first with mobile support - straightforward approach
 */

/* ========================================
   Header Container
   ======================================== */

.tool-header {
    background: #FFFFFF;
    border-bottom: 1px solid #E2E8F0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* Public header - not sticky */
.tool-header.public-header {
    position: relative;
}

.tool-header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

/* ========================================
   Left Section - Logo & Usage Info
   ======================================== */

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

/* Logo */
.logo {
    text-decoration: none;
    color: #0F172A;
    transition: opacity 0.2s;
    display: inline-block;
}

.logo:hover {
    opacity: 0.9;
}

/* Logo wrapper */
.logo-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.logo-img {
    height: 40px;
    width: auto;
    display: block;
}

.logo-tagline {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 9px;
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

/* ========================================
   Usage Info Group
   ======================================== */

.usage-info-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Usage Display */
.usage-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.usage-label {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.usage-text {
    font-size: 14px;
    color: #1e293b;
    font-weight: 600;
    min-width: 80px;
}

/* Progress Bars */
.usage-bar {
    width: 120px;
    height: 6px;
    background: #E2E8F0;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.usage-bar.compact {
    width: 60px;
}

.usage-fill {
    height: 100%;
    background: #14B8A6;
    border-radius: 999px;
    transition: width 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
}

/* Warning states */
.credits-display .usage-fill[style*="width: 7"],
.credits-display .usage-fill[style*="width: 8"] {
    background: #F59E0B;
}

.credits-display .usage-fill[style*="width: 9"],
.credits-display .usage-fill[style*="width: 100"] {
    background: #EF4444;
}

/* Divider */
.divider {
    width: 1px;
    height: 24px;
    background: #E2E8F0;
}

/* Media Display */
.media-display.compact {
    gap: 6px;
}

.media-icon {
    width: 16px;
    height: 16px;
    color: #475569;
}

.usage-text.compact {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
    min-width: auto;
}

/* Bonus Display */
.bonus-display {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bonus-icon {
    width: 16px;
    height: 16px;
    color: #14B8A6;
}

.bonus-text {
    font-size: 0.875rem;
    color: #475569;
    font-weight: 500;
}

/* ========================================
   Navigation
   ======================================== */

.nav-minimal {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-btn {
    padding: 0.5rem 1rem;
    color: #475569;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    border-radius: 6px;
    position: relative;
}

.nav-btn:hover {
    color: #0F172A;
    background: #F8FAFC;
}

.nav-btn.active {
    color: #14B8A6;
    font-weight: 600;
}

.nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    background: #14B8A6;
}

/* ========================================
   Mobile Navigation Toggle (Hidden on Desktop)
   ======================================== */

.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: #0F172A;
    transition: all 0.2s ease;
    border-radius: 6px;
    margin-left: auto;
}

.mobile-nav-toggle:hover {
    background: #F8FAFC;
}

.mobile-nav-toggle svg {
    width: 24px;
    height: 24px;
}

/* Mobile dropdown menu (hidden on desktop) */
#navMenu {
    /* Will be styled in mobile section */
}

/* ========================================
   TABLET STYLES (1024px and below)
   ======================================== */

@media (max-width: 1024px) {
    .usage-bar {
        width: 100px;
    }
    
    .usage-bar.compact {
        width: 50px;
    }
}

/* ========================================
   MOBILE STYLES (768px and below)
   ======================================== */

@media (max-width: 768px) {
    /* Make header fixed on mobile and ensure full width */
    .tool-header {
        position: fixed;
        width: 100%;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
    }
    
    /* Adjust header container - ensure full width */
    .tool-header-content {
        padding: 0 1rem;
        height: 56px;
        max-width: none; /* Remove desktop max-width */
        width: 100%; /* Ensure full width */
    }
    
    /* Adjust left section */
    .header-left {
        gap: 0;
        flex: 1; /* Take available space to push hamburger right */
    }
    
    /* Adjust logo for mobile */
    .logo-wrapper {
        flex-direction: row; /* Horizontal on mobile */
        gap: 6px;
    }
    
    .logo-img {
        height: 30px;
    }
    
    /* Hide tagline on mobile */
    .logo-tagline {
        display: none;
    }
    
    /* Hide ALL usage info on mobile */
    .usage-info-group {
        display: none;
    }
    
    /* Hide desktop navigation */
    .nav-minimal {
        display: none;
    }
    
    /* Show mobile toggle button */
    .mobile-nav-toggle {
        display: block;
        flex-shrink: 0;
    }
    
    /* Mobile dropdown menu */
    #navMenu {
        display: none; /* Hidden by default */
        position: fixed;
        top: 56px; /* Match header height */
        right: 1rem;
        background: #FFFFFF;
        border: 1px solid #E2E8F0;
        border-radius: 12px;
        flex-direction: column;
        padding: 0.5rem;
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
        gap: 0.25rem;
        z-index: 999;
        width: 220px;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }
    
    /* Show menu when active */
    #navMenu.show {
        display: flex;
    }
    
    /* Mobile menu button styles */
    #navMenu .nav-btn {
        width: 100%;
        padding: 0.75rem 1rem;
        text-align: left;
        border-radius: 8px;
        display: block;
        font-size: 0.9375rem;
    }
    
    #navMenu .nav-btn:hover {
        background: #F8FAFC;
        color: #0F172A;
    }
    
    #navMenu .nav-btn.active {
        background: #F0FDFA;
        color: #14B8A6;
        font-weight: 600;
    }
    
    /* Remove bottom indicator on mobile */
    #navMenu .nav-btn.active::after {
        display: none;
    }
}

/* ========================================
   SMALL MOBILE (480px and below)
   ======================================== */

@media (max-width: 480px) {
    .tool-header-content {
        padding: 0 0.75rem;
        height: 52px;
    }
    
    .logo-img {
        height: 26px;
    }
    
    /* Adjust menu position */
    #navMenu {
        top: 52px;
        right: 0.75rem;
        width: 200px;
    }
    
    /* Smaller buttons */
    .mobile-nav-toggle {
        padding: 0.375rem;
    }
    
    .mobile-nav-toggle svg {
        width: 20px;
        height: 20px;
    }
    
    #navMenu .nav-btn {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
    }
}

/* ========================================
   LANDSCAPE MOBILE (short screens)
   ======================================== */

@media (orientation: landscape) and (max-height: 600px) {
    .tool-header-content {
        height: 48px;
    }
    
    .logo-img {
        height: 24px;
    }
    
    #navMenu {
        top: 48px;
        max-height: calc(100vh - 60px);
    }
}

/* ========================================
   WIDE SCREENS (1400px+)
   ======================================== */

@media (min-width: 1400px) {
    /* Wider progress bars on large screens */
    .usage-bar {
        width: 140px;
    }
    
    .usage-bar.compact {
        width: 80px;
    }
}

@media (max-width: 768px) {
    /* Fix the structure issue */
    .header-left {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    /* Keep logo on left */
    .logo {
        flex-shrink: 0;
    }
    
    /* Hide usage info */
    .usage-info-group {
        display: none !important;
    }
    
    /* Position hamburger on right */
    .mobile-nav-toggle {
        display: block;
        margin-left: auto;
        order: 999; /* Push to end */
    }
}