/* ===== MOBILE RESPONSIVE FIXES ===== */

/* General Mobile Fixes */
@media (max-width: 768px) {
    /* Header fixes */
    #header {
        padding: 0.5rem 0;
        position: relative;
        z-index: 1000;
    }
    
    #logo img {
        max-height: 80px;
        width: auto;
    }
    
    /* Hide social media on mobile */
    .header-social-media {
        display: none;
    }
    
    /* Mobile menu button */
    .cnvs-hamburger {
        display: block !important;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0.5rem;
        z-index: 1001;
    }
    
    /* Primary menu mobile */
    .primary-menu {
        position: fixed;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100vh;
        background: linear-gradient(135deg, #163b4a 0%, #275c75 50%, #4e92b7 100%);
        z-index: 999;
        transition: left 0.3s ease;
        overflow-y: auto;
        padding: 5rem 2rem 2rem;
    }
    
    .primary-menu.active {
        left: 0;
    }
    
    .primary-menu .menu-container {
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 0;
        margin: 0;
    }
    
    .primary-menu .menu-item {
        width: 100%;
        margin: 0;
        padding: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .primary-menu .menu-item:last-child {
        border-bottom: none;
    }
    
    .primary-menu .menu-link {
        display: block;
        padding: 1.5rem 0;
        color: white !important;
        font-size: 1.2rem !important;
        font-weight: 600 !important;
        text-decoration: none;
        border: none;
        background: none;
        width: 100%;
        text-align: left;
        position: relative;
        transition: all 0.3s ease;
    }
    
    .primary-menu .menu-link:hover {
        color: #fbb040 !important;
        background: rgba(255, 255, 255, 0.1);
        padding-left: 1rem;
    }
    
    /* Sub menu mobile */
    .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: rgba(0, 0, 0, 0.2);
        border-radius: 0;
        margin: 0;
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        border: none;
    }
    
    .sub-menu.active {
        max-height: 300px;
    }
    
    .sub-menu .menu-item {
        margin: 0;
        padding: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .sub-menu .menu-item:last-child {
        border-bottom: none;
    }
    
    .sub-menu .menu-link {
        padding: 1rem 0 1rem 2rem;
        font-size: 1rem !important;
        color: rgba(255, 255, 255, 0.8) !important;
        border: none;
        background: none;
        position: relative;
    }
    
    .sub-menu .menu-link::before {
        content: '•';
        position: absolute;
        left: 1rem;
        color: #fbb040;
        font-weight: bold;
    }
    
    .sub-menu .menu-link:hover {
        color: #fbb040 !important;
        background: rgba(255, 255, 255, 0.1);
        padding-left: 2.5rem;
    }
    
    /* Disabled menu links */
    .menu-link-disabled {
        cursor: pointer;
        pointer-events: auto;
        position: relative;
    }
    
    .menu-link-disabled::after {
        content: '▼';
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        font-size: 1rem;
        transition: transform 0.3s ease;
        color: #fbb040;
    }
    
    .menu-link-disabled.active::after {
        transform: translateY(-50%) rotate(180deg);
    }
    
    /* Hide search form on mobile */
    .top-search-form {
        display: none;
    }
    
    /* Body scroll lock */
    body.menu-open {
        overflow: hidden;
    }
    
    /* Card responsive fixes */
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Button fixes */
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* Form fixes */
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Text fixes - Updated for 40+ age group */
    h1 {
        font-size: 2.8rem; /* Increased for better readability */
    }
    
    h2 {
        font-size: 2.2rem; /* Increased for better readability */
    }
    
    h3 {
        font-size: 1.8rem; /* Increased for better readability */
    }
    
    /* Spacing fixes */
    .container {
        padding: 0 1rem;
    }
    
    /* Footer fixes */
    .footer {
        text-align: center;
    }
    
    .footer .row > div {
        margin-bottom: 2rem;
    }
}

/* Tablet fixes */
@media (max-width: 992px) and (min-width: 769px) {
    .container {
        max-width: 100%;
        padding: 0 2rem;
    }
    
    .card {
        margin-bottom: 1.5rem;
    }
}

/* Small mobile fixes */
@media (max-width: 576px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .btn {
        font-size: 1rem;
        padding: 0.5rem 1rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    h1 {
        font-size: 2.4rem; /* Increased for better readability */
    }
    
    h2 {
        font-size: 1.9rem; /* Increased for better readability */
    }
    
    h3 {
        font-size: 1.5rem; /* Increased for better readability */
    }
}

/* Landscape mobile fixes */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        padding: 0.25rem 0;
    }
    
    .logo img {
        max-height: 35px;
    }
}

/* Enhanced Small Mobile */
@media (max-width: 576px) {
    /* Improved touch targets */
    .btn {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
        border-radius: 8px;
    }
    
    /* Better text scaling - Updated for 40+ age group */
    body {
        font-size: 18px; /* Increased from 16px */
        line-height: 1.7; /* Increased for better readability */
    }
    
    h1 {
        font-size: 2.4rem; /* Increased for better readability */
        line-height: 1.2;
    }
    
    h2 {
        font-size: 2rem; /* Increased for better readability */
        line-height: 1.3;
    }
    
    h3 {
        font-size: 1.7rem; /* Increased for better readability */
        line-height: 1.4;
    }
    
    /* Card improvements */
    .card {
        margin-bottom: 1.5rem;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    /* Form improvements */
    .form-control {
        min-height: 44px;
        font-size: 16px;
        padding: 0.75rem 1rem;
        border-radius: 8px;
    }
    
    /* Menu improvements */
    .primary-menu .menu-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .sub-menu .menu-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* Extra Small Mobile */
@media (max-width: 375px) {
    .container {
        padding: 0 0.75rem;
    }
    
    .primary-menu {
        padding: 3.5rem 1rem 2rem;
    }
    
    .primary-menu .menu-link {
        font-size: 1rem !important;
        padding: 1rem 0;
    }
    
    .sub-menu .menu-link {
        font-size: 1rem !important;
        padding: 0.75rem 0 0.75rem 1.25rem;
    }
    
    h1 {
        font-size: 2.2rem; /* Increased for better readability */
    }
    
    h2 {
        font-size: 1.8rem; /* Increased for better readability */
    }
    
    h3 {
        font-size: 1.4rem; /* Increased for better readability */
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .primary-menu {
        padding: 3rem 2rem 1rem;
    }
    
    .primary-menu .menu-link {
        padding: 1rem 0;
        font-size: 1.1rem !important;
    }
    
    .sub-menu .menu-link {
        padding: 0.75rem 0 0.75rem 2rem;
        font-size: 1rem !important;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    #logo img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --color-primary: #4e92b7;
        --color-secondary: #68b6e3;
    }
}

/* Print fixes */
@media print {
    .no-print {
        display: none !important;
    }
    
    .card {
        break-inside: avoid;
        margin-bottom: 1rem;
    }
}
