/*
====================================
MOBILE ENHANCEMENTS FOR GUARDIANS WATCH
Optimizes the experience for phones and tablets
====================================
*/

/* Better viewport handling */
@viewport {
    width: device-width;
    zoom: 1.0;
}

/* Enhanced Mobile Styles */
@media (max-width: 768px) {
    /* HEADER IMPROVEMENTS */
    .header {
        padding: 1rem;
        position: sticky;
        top: 0;
        z-index: 1000;
        background: rgba(255, 255, 255, 0.95);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
    }
    
    .header-content {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .logo {
        width: 60px !important;
        height: 60px !important;
    }
    
    .main-title {
        font-size: 1.8rem !important;
        line-height: 1.2;
        text-align: center;
    }
    
    .subtitle {
        font-size: 1rem !important;
        text-align: center;
        margin: 0;
    }
    
    /* MAP IMPROVEMENTS */
    #us-map {
        height: 60vh !important;
        min-height: 400px !important;
        width: 100% !important;
        touch-action: pan-x pan-y;
    }
    
    .map-container {
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden;
    }
    
    /* Make map elements more touch-friendly */
    .state {
        stroke-width: 2px !important;
    }
    
    .county {
        stroke-width: 1.5px !important;
    }
    
    /* NAVIGATION CARDS */
    .nav-cards-container {
        grid-template-columns: 1fr !important;
        gap: 1rem;
        padding: 1rem;
    }
    
    .feature-card {
        min-height: 100px !important;
        padding: 1.5rem !important;
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    }
    
    .card-title {
        font-size: 1.2rem !important;
        font-weight: bold;
    }
    
    .ready, .pending {
        font-size: 1rem !important;
        padding: 8px 16px;
        border-radius: 20px;
    }
    
    /* INTELLIGENCE PANEL MOBILE OPTIMIZATION */
    .intel-panel {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        max-width: none !important;
        max-height: none !important;
        z-index: 2000 !important;
        background: white !important;
        overflow-y: auto !important;
        border-radius: 0 !important;
        transform: translateX(100%) !important;
        transition: transform 0.3s ease-in-out !important;
    }
    
    .intel-panel.visible {
        transform: translateX(0) !important;
    }
    
    .intel-panel .close-btn {
        position: sticky !important;
        top: 1rem !important;
        right: 1rem !important;
        z-index: 2001 !important;
        background: #ff4444 !important;
        color: white !important;
        border: none !important;
        border-radius: 50% !important;
        width: 50px !important;
        height: 50px !important;
        font-size: 24px !important;
        cursor: pointer !important;
        box-shadow: 0 4px 20px rgba(255, 68, 68, 0.3) !important;
        margin-left: auto !important;
        display: block !important;
    }
    
    /* INTELLIGENCE PANEL CONTENT */
    .location-info {
        padding: 2rem 1rem !important;
        font-size: 1.1rem !important;
        line-height: 1.6 !important;
    }
    
    .location-stat {
        margin-bottom: 1.5rem !important;
        padding: 1rem !important;
        background: #f8f9fa !important;
        border-radius: 8px !important;
        border-left: 4px solid #007bff !important;
    }
    
    /* CHILD ITEMS IN MOBILE */
    .child-item {
        padding: 1.5rem !important;
        margin: 1rem 0 !important;
        border-radius: 12px !important;
        font-size: 1rem !important;
        line-height: 1.5 !important;
        cursor: pointer !important;
        background: white !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
        border: 2px solid #e0e0e0 !important;
    }
    
    .child-item:active {
        transform: scale(0.98) !important;
    }
    
    /* BUTTONS AND INTERACTIVE ELEMENTS */
    .back-button {
        font-size: 18px !important;
        padding: 12px 24px !important;
        background: #007bff !important;
        color: white !important;
        border-radius: 25px !important;
        border: none !important;
        cursor: pointer !important;
        margin: 1rem !important;
        box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3) !important;
    }
    
    /* TOOLTIPS AND POPUPS */
    .state-tooltip, .county-tooltip {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 80vw !important;
        max-width: 300px !important;
        padding: 1.5rem !important;
        font-size: 1.1rem !important;
        border-radius: 15px !important;
        box-shadow: 0 8px 30px rgba(0,0,0,0.3) !important;
        z-index: 3000 !important;
    }
    
    /* MILK CARTON GENERATION */
    .milk-carton-container {
        padding: 1rem !important;
        text-align: center !important;
    }
    
    .milk-carton-container img {
        max-width: 100% !important;
        height: auto !important;
        border-radius: 12px !important;
        box-shadow: 0 8px 25px rgba(0,0,0,0.15) !important;
    }
    
    /* BANNERS */
    .state-total-flag, .national-total-flag {
        position: fixed !important;
        top: 10px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 90vw !important;
        max-width: 350px !important;
        padding: 1rem !important;
        border-radius: 12px !important;
        z-index: 1500 !important;
        font-size: 1rem !important;
        box-shadow: 0 4px 20px rgba(0,0,0,0.2) !important;
    }
    
    /* INSTRUCTION TEXT */
    .map-instructions {
        padding: 1rem !important;
        font-size: 1.1rem !important;
        text-align: center !important;
        background: rgba(0, 123, 255, 0.1) !important;
        border-radius: 8px !important;
        margin: 1rem !important;
    }
}

/* ULTRA SMALL SCREENS */
@media (max-width: 480px) {
    .main-title {
        font-size: 1.5rem !important;
    }
    
    .subtitle {
        font-size: 0.9rem !important;
    }
    
    #us-map {
        height: 50vh !important;
        min-height: 300px !important;
    }
    
    .feature-card {
        padding: 1rem !important;
        min-height: 80px !important;
    }
    
    .location-info {
        padding: 1rem !important;
    }
    
    .child-item {
        padding: 1rem !important;
        font-size: 0.95rem !important;
    }
}

/* LANDSCAPE ORIENTATION ON PHONES */
@media (max-height: 500px) and (orientation: landscape) {
    #us-map {
        height: 80vh !important;
    }
    
    .header {
        padding: 0.5rem !important;
    }
    
    .main-title {
        font-size: 1.3rem !important;
    }
    
    .subtitle {
        display: none;
    }
}

/* TOUCH IMPROVEMENTS */
@media (pointer: coarse) {
    /* Larger touch targets */
    .state, .county {
        stroke-width: 3px !important;
    }
    
    button, .feature-card, .child-item {
        min-height: 44px !important;
        min-width: 44px !important;
    }
    
    /* Remove hover effects on touch devices */
    .feature-card:hover,
    .child-item:hover {
        transform: none !important;
    }
    
    /* Better active states for touch */
    .feature-card:active,
    .child-item:active {
        transform: scale(0.95) !important;
        transition: transform 0.1s ease !important;
    }
}

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

/* HIGH DPI SCREENS */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .state, .county {
        stroke-width: 0.5px !important;
    }
}
