/* Mobile Responsive Fixes for Small Screens (iPhone 12/13/14 ~6.1 inch) */

@media screen and (max-width: 390px) {
    /* General Layout Fixes */
    .container {
        padding: 0 12px;
    }

    /* Header and Navigation */
    header {
        padding: 10px 0;
    }
    
    .logo {
        font-size: 22px;
    }
    
    .logo img {
        width: 34px;
        height: 34px;
    }
    
    .nav-links {
        display: none; /* Hide standard nav on mobile */
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .auth-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .auth-buttons .btn {
        padding: 8px 12px;
        font-size: 14px;
        width: auto;
    }
    
    /* Hero Section */
    .hero {
        padding: 40px 0;
        text-align: center;
    }
    
    .hero h1 {
        font-size: 24px;
        line-height: 1.3;
    }
    
    .hero p {
        font-size: 14px;
        margin-top: 10px;
    }
    
    /* Analysis Forms */
    .analysis-tabs {
        flex-direction: column;
        gap: 10px;
    }
    
    .analysis-tabs .tab {
        width: 100%;
        border-radius: 6px;
        margin-right: 0;
    }
    
    .analysis-content {
        padding: 15px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-control, 
    input[type="file"],
    .select2-container {
        width: 100% !important;
    }
    
    /* Results & Charts Section */
    .chart-container {
        overflow-x: auto;
        margin-bottom: 20px;
    }
    
    canvas {
        min-width: 300px;
    }
    
    .result-card {
        padding: 12px;
    }
    
    .result-card h3 {
        font-size: 16px;
    }
    
    /* Pattern Detection Results */
    .pattern-image {
        max-width: 100%;
        height: auto;
    }
    
    .patterns-grid {
        grid-template-columns: 1fr; /* Single column on mobile */
        gap: 10px;
    }
    
    /* Features Section */
    .features-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .feature-card {
        padding: 15px;
    }
    
    /* Login & Register Forms */
    .auth-container {
        padding: 20px 15px;
        width: 95%;
    }
    
    /* Footer */
    footer {
        padding: 20px 0;
        text-align: center;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 15px;
    }
}

/* Fix for notch/dynamic island on newer iPhones */
@supports (padding-top: env(safe-area-inset-top)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}
