/* Mobile-Specific Styles */

/* Touch-friendly sizing */
@media (max-width: 768px) {
    .header {
        padding: 0.75rem 1rem;
    }
    
    .logo {
        font-size: 1.3rem;
    }
    
    .status {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .main {
        padding: 0.75rem;
    }
    
    .camera-section {
        padding: 1rem;
    }
    
    .results-section {
        padding: 1rem;
    }
    
    /* Larger touch targets */
    .btn {
        padding: 1.2rem 1rem;
        font-size: 1.1rem;
        min-width: 160px;
        min-height: 54px;
    }
    
    /* Stack buttons vertically on small screens */
    .camera-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .camera-controls .btn {
        width: 100%;
        max-width: 280px;
    }
    
    /* Optimize results for mobile */
    .results-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .results-header h2 {
        text-align: center;
        font-size: 1.2rem;
    }
    
    .count-number {
        font-size: 2.5rem;
    }
    
    /* Loading adjustments */
    .loading-section p {
        font-size: 1.1rem;
    }
    
    .error-section {
        margin: 0 0.5rem;
        padding: 1.5rem;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .header {
        padding: 0.5rem;
    }
    
    .logo {
        font-size: 1.2rem;
    }
    
    .main {
        padding: 0.5rem;
    }
    
    .camera-section,
    .results-section {
        padding: 0.75rem;
    }
    
    .btn {
        padding: 1rem 0.75rem;
        font-size: 1rem;
        min-height: 50px;
    }
    
    .count-number {
        font-size: 2rem;
    }
    
    .count-display {
        padding: 1rem;
    }
}

/* Landscape orientation optimizations */
@media (orientation: landscape) and (max-height: 600px) {
    .header {
        padding: 0.5rem 1rem;
    }
    
    .main {
        padding: 0.5rem;
    }
    
    .camera-section {
        max-width: 400px;
    }
    
    .camera-container {
        aspect-ratio: 4/3; /* Better for landscape */
    }
    
    .btn {
        padding: 0.8rem 1rem;
        min-height: 44px;
    }
    
    /* Horizontal button layout in landscape */
    .camera-controls {
        flex-direction: row;
        justify-content: center;
    }
    
    .camera-controls .btn {
        width: auto;
        flex: 1;
        max-width: 140px;
    }
}

/* iOS specific tweaks */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari */
    body {
        -webkit-overflow-scrolling: touch;
    }
    
    .btn {
        -webkit-appearance: none;
        -webkit-user-select: none;
    }
    
    #cameraFeed {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Android specific tweaks */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .btn:focus {
        outline: 2px solid #2196F3;
        outline-offset: 2px;
    }
}

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

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .camera-section,
    .results-section {
        background: rgba(255, 255, 255, 0.95);
    }
    
    .header {
        background: rgba(255, 255, 255, 0.9);
    }
}