/* ===== COMPREHENSIVE MOBILE FIX FOR FASTRACK MEDICAL ===== */
/* This file fixes all mobile layout issues for iPhone and mobile devices */

/* ===== CSS RESET FOR MOBILE ===== */
@media (max-width: 768px) {
    /* Reset all previous mobile overrides */
    * {
        box-sizing: border-box !important;
    }

    /* Body and viewport setup */
    html {
        scroll-behavior: smooth !important;
        -webkit-text-size-adjust: 100% !important;
        -moz-text-size-adjust: 100% !important;
        text-size-adjust: 100% !important;
    }

    body {
        padding-top: 0 !important;
        margin: 0 !important;
        overflow-x: hidden !important;
        background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 25%, #2563eb 50%, #3b82f6 75%, #1d4ed8 100%) !important;
        background-attachment: fixed !important;
        min-height: 100vh !important;
    }
}

/* ===== MOBILE HEADER - CLEAN AND SIMPLE ===== */
@media (max-width: 768px) {
    .header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 60px !important;
        min-height: 60px !important;
        max-height: 60px !important;
        padding: 0 !important;
        margin: 0 !important;
        background: rgba(31, 41, 55, 0.95) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        backdrop-filter: blur(10px) !important;
        border-bottom: 1px solid rgba(75, 85, 99, 0.3) !important;
        z-index: 1000 !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
    }

    .nav {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        height: 60px !important;
        padding: 0 1rem !important;
        margin: 0 !important;
        max-width: 100% !important;
    }

    .nav__brand {
        font-size: 1.1rem !important;
        font-weight: 600 !important;
        color: white !important;
        text-decoration: none !important;
        margin: 0 !important;
        flex: 1 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .nav__menu {
        display: none !important;
    }

    .nav__toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 44px !important;
        height: 44px !important;
        background: transparent !important;
        border: none !important;
        border-radius: 8px !important;
        color: white !important;
        font-size: 1.2rem !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
    }

    .nav__toggle:hover {
        background: rgba(255, 255, 255, 0.1) !important;
    }
}

/* ===== EMERGENCY CONTACT SECTION - MOBILE OPTIMIZED ===== */
@media (max-width: 768px) {
    .emergency-contact-section {
        position: relative !important;
        margin-top: 60px !important; /* Header height clearance */
        padding: 1rem 0 0.5rem !important;
        background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 25%, #2563eb 60%, #1d4ed8 100%) !important;
        background-attachment: fixed !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        z-index: 900 !important;
    }

    .nav__contact-row {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.75rem !important;
        padding: 0 1rem !important;
        margin: 0 auto !important;
        max-width: 100% !important;
        height: auto !important;
        background: transparent !important;
        border: none !important;
    }

    .emergency-btn {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: 44px !important; /* iOS touch target minimum */
        min-width: 60px !important;
        max-width: 100px !important;
        height: 44px !important;
        padding: 0.5rem 0.75rem !important;
        border-radius: 8px !important;
        font-size: 0.8rem !important;
        font-weight: 600 !important;
        text-decoration: none !important;
        border: none !important;
        cursor: pointer !important;
        transition: all 0.3s ease !important;
        flex: 0 1 auto !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        gap: 0.3rem !important;
    }

    .emergency-btn i {
        font-size: 0.9rem !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
    }

    .contact-text {
        font-size: 0.7rem !important;
        font-weight: 600 !important;
        line-height: 1 !important;
        display: inline !important;
    }

    /* Button colors */
    .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;
    }

    .emergency-btn:hover,
    .emergency-btn:active {
        transform: translateY(-1px) !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    }
}

/* ===== HERO SECTION - MOBILE PERFECT ===== */
@media (max-width: 768px) {
    .hero {
        margin-top: 0 !important;
        padding-top: 0.5rem !important; /* Small gap after emergency buttons */
        padding-bottom: 2rem !important;
        min-height: calc(100vh - 120px) !important; /* Account for header + emergency section */
        height: auto !important;
        display: flex !important;
        align-items: flex-start !important;
        justify-content: center !important;
        background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 25%, #2563eb 50%, #3b82f6 75%, #1d4ed8 100%) !important;
        background-attachment: fixed !important;
        position: relative !important;
        z-index: 1 !important;
    }

    .hero__container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 1rem !important;
        margin: 0 auto !important;
        position: relative !important;
        z-index: 10 !important;
    }

    .hero__content {
        background: rgba(31, 41, 55, 0.85) !important;
        -webkit-backdrop-filter: blur(15px) !important;
        backdrop-filter: blur(15px) !important;
        border: 1px solid rgba(75, 85, 99, 0.4) !important;
        border-radius: 16px !important;
        padding: 2rem 1.5rem !important;
        margin: 0 auto !important;
        max-width: 100% !important;
        text-align: center !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
        position: relative !important;
        z-index: 15 !important;
    }

    .hero__title {
        font-size: 2.5rem !important;
        font-weight: 700 !important;
        line-height: 1.1 !important;
        margin-bottom: 1rem !important;
        color: white !important;
        text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5) !important;
    }

    .hero__subtitle {
        font-size: 1.1rem !important;
        line-height: 1.4 !important;
        margin-bottom: 1.5rem !important;
        color: rgba(255, 255, 255, 0.9) !important;
        opacity: 0.95 !important;
    }

    .hero__cta {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 1rem !important;
        margin-top: 1.5rem !important;
    }

    .hero__cta .btn {
        width: 100% !important;
        max-width: 280px !important;
        height: 50px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
        border-radius: 12px !important;
        text-decoration: none !important;
        transition: all 0.3s ease !important;
        border: none !important;
        cursor: pointer !important;
    }

    .btn--primary {
        background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
        color: white !important;
        box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4) !important;
    }

    .btn--secondary {
        background: rgba(255, 255, 255, 0.15) !important;
        color: white !important;
        border: 2px solid rgba(255, 255, 255, 0.3) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        backdrop-filter: blur(10px) !important;
    }

    .hero__cta .btn:hover,
    .hero__cta .btn:active {
        transform: translateY(-2px) !important;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3) !important;
    }
}

/* ===== MAIN CONTENT SPACING ===== */
@media (max-width: 768px) {
    main {
        padding-top: 0 !important;
        background: transparent !important;
        position: relative !important;
        z-index: 1 !important;
    }

    /* Hide background decorations on mobile */
    .hero__particles,
    .hero__floating-icons,
    .hero__background-orbs {
        display: none !important;
    }
}

/* ===== EXTRA SMALL SCREENS (iPhone SE, etc.) ===== */
@media (max-width: 390px) {
    .hero__title {
        font-size: 2.2rem !important;
    }

    .hero__subtitle {
        font-size: 1rem !important;
    }

    .hero__content {
        padding: 1.5rem 1rem !important;
    }

    .emergency-btn {
        min-width: 55px !important;
        max-width: 85px !important;
        padding: 0.4rem 0.6rem !important;
        font-size: 0.75rem !important;
    }

    .contact-text {
        font-size: 0.65rem !important;
    }

    .nav__contact-row {
        gap: 0.5rem !important;
    }
}

/* ===== LANDSCAPE MODE ADJUSTMENTS ===== */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        min-height: calc(100vh - 100px) !important;
        padding-top: 0.25rem !important;
    }

    .hero__content {
        padding: 1.5rem !important;
    }

    .hero__title {
        font-size: 2rem !important;
        margin-bottom: 0.75rem !important;
    }

    .hero__subtitle {
        font-size: 1rem !important;
        margin-bottom: 1rem !important;
    }

    .hero__cta {
        flex-direction: row !important;
        justify-content: center !important;
        gap: 1rem !important;
    }

    .hero__cta .btn {
        width: auto !important;
        min-width: 140px !important;
        max-width: 200px !important;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (max-width: 768px) {
    .emergency-btn:focus,
    .nav__toggle:focus,
    .hero__cta .btn:focus {
        outline: 2px solid #3b82f6 !important;
        outline-offset: 2px !important;
    }

    /* Improve touch targets */
    .emergency-btn,
    .nav__toggle,
    .hero__cta .btn {
        -webkit-tap-highlight-color: transparent !important;
        touch-action: manipulation !important;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
@media (max-width: 768px) {
    /* Reduce animations on mobile for better performance */
    * {
        -webkit-transform: translateZ(0) !important;
        transform: translateZ(0) !important;
        backface-visibility: hidden !important;
        perspective: 1000px !important;
    }

    /* Optimize backdrop filters */
    .hero__content,
    .header {
        -webkit-backdrop-filter: blur(15px) !important;
        backdrop-filter: blur(15px) !important;
        will-change: backdrop-filter !important;
    }
}
