/* ===== MOBILE HEADER FIX V2 - MATCHES YOUR HTML STRUCTURE ===== */

/* ===== BASE RESPONSIVE CONTACT ROW - APPLIES TO ALL SCREEN SIZES ===== */
.nav__contact-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: clamp(0.5rem, 2.5vw, 1.5rem) !important;
    padding: clamp(0.4rem, 2vw, 1rem) !important;
    margin: 0 auto !important;
    background: transparent !important;
    border: none !important;
    height: auto !important;
    width: fit-content !important;
    max-width: 95vw !important;
}

.nav__contact-row .emergency-btn {
    min-height: clamp(32px, 7vw, 56px) !important;
    min-width: clamp(50px, 12vw, 120px) !important;
    max-width: clamp(80px, 18vw, 160px) !important;
    width: auto !important;
    height: clamp(32px, 7vw, 56px) !important;
    padding: clamp(0.3rem, 1.2vw, 0.8rem) clamp(0.5rem, 2vw, 1.2rem) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: clamp(0.2rem, 1vw, 0.6rem) !important;
    border-radius: clamp(4px, 1.5vw, 12px) !important;
    font-size: clamp(0.6rem, 2.2vw, 1rem) !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    flex: 0 1 auto !important;
    border: none !important;
    cursor: pointer !important;
    text-decoration: none !important;
}

.nav__contact-row .emergency-btn i {
    font-size: clamp(0.7rem, 2.5vw, 1.2rem) !important;
    margin: 0 !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
}

.nav__contact-row .contact-text {
    display: inline !important;
    font-size: clamp(0.55rem, 1.8vw, 0.9rem) !important;
    font-weight: 600 !important;
    line-height: 1 !important;
}

/* IMMEDIATE MOBILE HERO FIX - MAXIMUM PRIORITY */
@media (max-width: 768px) {
    :root {
        /* Centralized mobile layout variables */
        --header-clearance: 70px; /* height space below fixed header */
        --contact-hero-gap: 0.5rem; /* visual breathing space between contact bar and hero */
        --contact-padding-top: 1.1rem; /* top padding inside contact section */
        --contact-padding-bottom: 0.4rem; /* bottom padding now tighter */
        --divider-color: rgba(255,255,255,0.12);
    }
    /* NUCLEAR OVERRIDE - Move hero right below header */
    html body section.hero,
    body section.hero,
    section.hero,
    .hero {
        padding-top: 0px !important;
        margin-top: 70px !important; /* Reduced from 120px - header is now much smaller */
        min-height: auto !important;
        height: auto !important;
        position: relative !important;
    }
}

/* Reset any problematic mobile styles */
@media (max-width: 768px) {
    /* Clean header foundation */
    .header {
        height: auto !important;
        min-height: auto !important; /* No fixed height needed - header contains only brand + hamburger now */
        padding: 0 !important;
        background: rgba(31, 41, 55, 0.95) !important;
        backdrop-filter: blur(10px) !important;
        border-bottom: 1px solid #4b5563 !important;
        position: fixed !important;
        top: 0 !important;
        width: 100% !important;
        z-index: 1000 !important;
    }
    
    /* Navigation container - vertical stack */
    .nav {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        height: auto !important;
        padding: 0 !important;
        gap: 0 !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    
    /* Main nav row - brand + hamburger */
    .nav__main {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        height: 60px !important;
        padding: 0 1rem !important;
        order: 1 !important;
        margin: 0 !important;
        background: transparent !important;
        border: none !important;
    }
    
    /* Brand - left side */
    .nav__brand {
        font-size: 1.1rem !important;
        flex: 1 !important;
        margin: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        color: var(--text-color) !important;
        text-decoration: none !important;
    }
    
    .nav__brand .nav__title {
        display: inline !important;
        font-weight: 600 !important;
    }
    
    /* Hide desktop navigation menu */
    .nav__menu {
        display: none !important;
    }
    
    /* Hamburger menu - right side of main row */
    .nav__toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 44px !important;
        height: 44px !important;
        margin: 0 !important;
        font-size: 1.2rem !important;
        border-radius: 8px !important;
        background: transparent !important;
        border: none !important;
        color: var(--text-color) !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        order: 2 !important;
        flex-shrink: 0 !important;
    }
    
    .nav__toggle:hover {
        background: rgba(156, 163, 175, 0.2) !important;
        transform: scale(1.05) !important;
    }
    
    /* Contact row mobile-specific positioning */
    .nav__contact-row {
        order: 2 !important;
        max-width: 90vw !important;
    }
    
    /* Button specific colors with gradients */
    .emergency-btn--phone {
        background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%) !important;
        color: white !important;
        box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3) !important;
    }
    
    .emergency-btn--email {
        background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%) !important;
        color: white !important;
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3) !important;
    }
    
    .emergency-btn--chat {
        background: linear-gradient(135deg, #047857 0%, #10b981 100%) !important;
        color: white !important;
        box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3) !important;
    }
    
    /* Generic emergency button styling for any other variations */
    .nav__contact-row .emergency-btn:not(.emergency-btn--phone):not(.emergency-btn--email):not(.emergency-btn--chat) {
        background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
        color: white !important;
        box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3) !important;
    }
    
    /* Hover effects */
    .nav__contact-row .emergency-btn:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    }
    
    /* Hero section adjustment - Unified card design with mobile-first approach */
    body .hero,
    html body .hero,
    section.hero {
        min-height: 100vh !important;
        height: auto !important;
        padding-top: 0 !important; /* Set to 0 to remove extra gap */
        margin-top: 0 !important; /* Ensure no top margin */
        display: flex !important;
        align-items: flex-start !important; /* Keep hero card near top */
        justify-content: center !important;
        padding-bottom: 2rem !important;
        background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 25%, #2563eb 50%, #3b82f6 75%, #1d4ed8 100%) !important;
        background-attachment: fixed !important;
    }

    /* Hero container - Mobile positioning */
    body .hero .hero__container,
    html body .hero .hero__container,
    section.hero .hero__container {
        margin-top: 0 !important; /* Remove container margin spacing */
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 1rem !important;
        position: relative !important;
        z-index: 5 !important;
    }

    /* Hero content card - Use the unified design */
    body .hero .hero__content,
    html body .hero .hero__content,
    section.hero .hero__content {
        background: rgba(31, 41, 55, 0.3) !important;
        backdrop-filter: blur(15px) !important;
        border: 1px solid rgba(75, 85, 99, 0.3) !important;
        border-radius: 16px !important;
        padding: 2rem 1.5rem !important;
        margin: 0 auto !important;
        max-width: 100% !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
        position: relative !important;
        z-index: 10 !important;
        text-align: center !important;
    }
    
    /* Mobile-specific adjustments for the unified fluid design - minimal overrides */
    .hero__content {
        /* Use the main CSS fluid scaling - no overrides needed */
        background: rgba(31, 41, 55, 0.3) !important;
        backdrop-filter: blur(15px) !important;
        text-align: center !important;
    }
    
    /* Hide background decorations on mobile for cleaner card focus */
    .hero__particles,
    .hero__floating-icons,
    .hero__background-orbs {
        display: none !important;
    }
    
    /* Main content adjustment */
    main {
        padding-top: 0px !important; /* Changed from 70px - remove gap above emergency contact */
        background: inherit !important; /* Inherit gradient from body */
    }
    
    /* Ensure all content after hero continues the gradient */
    main > * {
        background: transparent !important;
    }
    
    /* Body adjustment to prevent header overlap */
    body {
        padding-top: 0 !important;
        background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 25%, #2563eb 50%, #3b82f6 75%, #1d4ed8 100%) !important; /* Ensure body has gradient */
        background-attachment: fixed !important; /* Keep gradient stable during scroll */
        min-height: 100vh !important; /* Full height background */
    }
    
    /* Blended emergency contact section (Option B) */
    .emergency-contact-section {
        margin-top: var(--header-clearance) !important;
        padding: var(--contact-padding-top) 0 var(--contact-padding-bottom) !important;
        background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 25%, #2563eb 60%, #1d4ed8 100%) !important; /* match / extend hero gradient */
        background-attachment: fixed !important;
        border-bottom: 1px solid var(--divider-color) !important; /* subtle divider instead of large gap */
        box-shadow: 0 4px 12px rgba(0,0,0,0.25) inset !important;
    }
    .emergency-contact-section > *:last-child { margin-bottom: 0 !important; padding-bottom: 0 !important; }

    /* Unified hero spacing (remove residual paddings) */
    body .hero,
    html body .hero,
    section.hero {
        margin-top: 0 !important;
        padding-top: var(--contact-hero-gap) !important; /* slight breathing space */
    }
    .hero .hero__container, section.hero .hero__container { margin-top: 0 !important; }
}

/* ===== LANDSCAPE MODE - SINGLE ROW LAYOUT ===== */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        height: 60px !important;
        min-height: 60px !important;
    }
    
    .nav {
        flex-direction: row !important;
        height: 60px !important;
        padding: 0 1rem !important;
        align-items: center !important;
        justify-content: space-between !important;
    }
    
    .nav__main {
        height: 60px !important;
        padding: 0 !important;
        flex: 0 0 auto !important;
        order: 1 !important;
        background: transparent !important;
        border: none !important;
    }
    
    .nav__brand {
        font-size: 1rem !important;
        flex: 0 0 auto !important;
    }
    
    /* Show menu inline in landscape */
    .nav__menu {
        display: flex !important;
        order: 2 !important;
        flex: 1 !important;
        justify-content: center !important;
        margin: 0 1rem !important;
    }
    
    .nav__list {
        display: flex !important;
        gap: 1rem !important;
        list-style: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .nav__link {
        font-size: 0.85rem !important;
        padding: 0.5rem 0.75rem !important;
        border-radius: 6px !important;
        transition: all 0.2s ease !important;
        color: var(--text-color) !important;
        text-decoration: none !important;
    }
    
    .nav__link:hover {
        background: rgba(156, 163, 175, 0.2) !important;
    }
    
    /* Contact row in landscape - more compact */
    .nav__contact-row {
        flex-direction: row !important;
        padding: 0 !important;
        margin: 0 auto !important;
        background: transparent !important;
        border: none !important;
        gap: clamp(0.3rem, 1.5vw, 0.6rem) !important;
        order: 3 !important;
        flex: 0 0 auto !important;
        height: auto !important;
        width: fit-content !important;
    }
    
    /* Compact contact buttons in landscape */
    .nav__contact-row .emergency-btn {
        min-height: clamp(32px, 6vw, 40px) !important;
        min-width: clamp(40px, 10vw, 60px) !important;
        max-width: clamp(60px, 15vw, 80px) !important;
        width: auto !important;
        height: clamp(32px, 6vw, 40px) !important;
        padding: clamp(0.2rem, 0.8vw, 0.4rem) clamp(0.3rem, 1.2vw, 0.6rem) !important;
        flex: 0 1 auto !important;
        border-radius: clamp(4px, 1vw, 6px) !important;
    }
    
    /* Hide text in landscape - show only icons */
    .nav__contact-row .contact-text {
        display: none !important;
    }
    
    /* Hide hamburger in landscape since menu is visible */
    .nav__toggle {
        display: none !important;
    }
    
    /* Adjust hero for landscape - Keep unified design */
    .hero {
        padding-top: 0 !important; /* remove old 80px */
        margin-top: 60px !important; /* keep clearance for landscape header height */
        min-height: calc(100vh - 60px) !important;
        background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 25%, #2563eb 50%, #3b82f6 75%, #1d4ed8 100%) !important;
        background-attachment: fixed !important;
    }
    
    .hero__container {
        margin-top: 1rem !important;
    }
    
    .hero__content {
        background: rgba(31, 41, 55, 0.3) !important;
        backdrop-filter: blur(10px) !important;
        border-radius: 12px !important;
        padding: 1.5rem !important;
        max-width: 90% !important;
    }
    
    /* Landscape adjustments for small screens - minimal overrides */
    .hero__content {
        /* Use the main CSS fluid scaling - no specific overrides needed */
        background: rgba(31, 41, 55, 0.3) !important;
        backdrop-filter: blur(10px) !important;
    }
    
    main {
        padding-top: 60px !important;
        background: inherit !important; /* Inherit gradient from body */
    }
    
    /* Ensure all content continues the gradient in landscape */
    main > * {
        background: transparent !important;
    }
}

/* ===== SMALL MOBILE SCREENS ===== */
@media (max-width: 480px) {
    .nav__main {
        padding: 0 0.75rem !important;
    }
    
    .nav__brand {
        font-size: 1rem !important;
    }
    
    .nav__contact-row {
        gap: 0.4rem !important;
        padding: 0.4rem !important;
        max-width: 85vw !important;
    }
    
    .nav__contact-row .emergency-btn {
        min-height: 34px !important;
        min-width: 50px !important;
        max-width: 70px !important;
        padding: 0.3rem 0.5rem !important;
        font-size: 0.65rem !important;
    }
    
    .nav__contact-row .contact-text {
        font-size: 0.6rem !important;
    }
    
    .nav__toggle {
        width: 40px !important;
        height: 40px !important;
    }
    
    /* Small mobile screen adjustments - Use unified responsive scaling */
}

/* ===== ACCESSIBILITY & FOCUS STATES ===== */
.nav__contact-row .emergency-btn:focus,
.nav__toggle:focus,
.nav__link:focus {
    outline: 2px solid #3b82f6 !important;
    outline-offset: 2px !important;
}

/* ===== LOADING STATES ===== */
.nav__contact-row .emergency-btn:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* ===== ONLINE INDICATOR ===== */
.online-indicator {
    position: absolute !important;
    top: -3px !important;
    right: -3px !important;
    width: 12px !important;
    height: 12px !important;
    background: #22c55e !important;
    border: 2px solid rgba(31, 41, 55, 0.95) !important;
    border-radius: 50% !important;
    animation: pulse 2s infinite !important;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* ===== DARK MODE ADJUSTMENTS ===== */
@media (prefers-color-scheme: dark) {
    .header {
        background: rgba(17, 24, 39, 0.95) !important;
        border-bottom-color: #374151 !important;
    }
    
    .nav__contact-row {
        background: transparent !important;
        border-top-color: rgba(107, 114, 128, 0.3) !important;
    }
}

