/* ============================================================================
   MOBILE OPTIMIZATIONS FOR COCUISINA
   Responsive design improvements for mobile devices
   ============================================================================ */

/* Mobile-First Base Styles */
@media (max-width: 768px) {
    
    /* Navigation Improvements */
    .navbar {
        padding: 0.5rem 1rem;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .cocuisina-nav-link {
        padding: 0.75rem 1rem;
        margin: 0.25rem 0;
    }
    
    /* Reduce gap in mobile nav */
    .navbar-nav .nav-item {
        margin: 0.25rem 0;
    }
    
    /* Navigation separator - horizontal on mobile */
    .nav-separator {
        width: 100%;
        height: 1px;
        margin: 0.75rem 0;
        background: linear-gradient(
            to right,
            transparent,
            var(--glass-primary-20) 20%,
            var(--glass-primary-20) 80%,
            transparent
        );
    }
    
    /* Touch-Friendly Buttons */
    .cocuisina-btn {
        min-height: 48px; /* iOS/Android recommended touch target */
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    /* Cards and Containers */
    .cocuisina-card {
        margin: 1rem 0;
        padding: 1.5rem 1rem;
    }
    
    .recipe-card {
        padding: 1rem;
    }
    
    /* Compact recipe listings */
    .recipe-card .row {
        flex-direction: column;
    }
    
    .recipe-card .col-md-8,
    .recipe-card .col-md-4 {
        width: 100%;
        max-width: 100%;
        margin-bottom: 1rem;
    }
    
    /* Form Inputs - Larger touch targets */
    .form-control,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    select,
    textarea {
        min-height: 48px;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }
    
    /* Modal Improvements */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 16px;
    }
    
    .modal-body {
        padding: 1.5rem 1rem;
    }
    
    /* Floating Elements */
    .floating-help-btn {
        bottom: 80px; /* Account for mobile browser bars */
        right: 16px;
        width: 56px;
        height: 56px;
    }
    
    /* Tables - Make scrollable */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Image Optimizations */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Spacing Adjustments */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    h1, .display-4 {
        font-size: 2rem !important;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    h3 {
        font-size: 1.5rem;
    }
    
    /* Flavor Tags - Wrap nicely */
    .flavor-tag {
        display: inline-block;
        margin: 0.25rem;
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    /* Error Pages */
    .error-page-container {
        padding: 2rem 1rem !important;
    }
    
    .error-icon {
        font-size: 4rem !important;
    }
    
    /* Loading States */
    .spinner-border {
        width: 2rem;
        height: 2rem;
    }
    
    /* Service Status Indicator */
    .service-status-indicator {
        bottom: 10px !important;
        right: 10px !important;
        font-size: 0.75rem !important;
        padding: 6px 12px !important;
    }
}

/* Extra Small Devices (phones in portrait, less than 576px) */
@media (max-width: 575.98px) {
    
    /* Even more compact on small phones */
    .cocuisina-card {
        padding: 1rem 0.75rem;
        margin: 0.75rem 0;
    }
    
    /* Stack buttons vertically */
    .d-flex.gap-2 {
        flex-direction: column;
        width: 100%;
    }
    
    .d-flex.gap-2 .cocuisina-btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* Compact navigation */
    .language-switcher {
        margin: 0.5rem 0;
    }
    
    .streak-widget {
        margin: 0.5rem 0;
    }
    
    /* Full-width modals */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100vh;
    }
    
    .modal-content {
        border-radius: 0;
        height: 100%;
    }
}

/* Large Phones and Small Tablets (576px to 768px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    
    /* Optimize for landscape mode */
    .recipe-card .row {
        flex-direction: row;
    }
    
    .cocuisina-card {
        padding: 1.5rem;
    }
}

/* Tablets (768px to 992px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    
    /* Tablet-optimized layouts */
    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .recipe-card .col-md-8 {
        flex: 0 0 66.666667%;
        max-width: 66.666667%;
    }
    
    .recipe-card .col-md-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
}

/* High DPI Displays (Retina) */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    
    /* Sharper text rendering */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    /* Adjust borders for crisp rendering */
    .cocuisina-card,
    .cocuisina-btn {
        border-width: 0.5px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    
    /* Remove hover effects on touch devices */
    .cocuisina-btn:hover {
        transform: none;
    }
    
    /* Add active state for touch feedback */
    .cocuisina-btn:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    /* Larger touch targets for links */
    a {
        padding: 0.25rem;
    }
    
    /* Prevent accidental zooms */
    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Landscape Orientation Specific */
@media (orientation: landscape) and (max-height: 500px) {
    
    /* Compact header in landscape */
    .navbar {
        padding: 0.25rem 1rem;
    }
    
    /* Reduce modal height */
    .modal-dialog {
        margin: 0.5rem auto;
    }
    
    /* Compact error pages */
    .error-page-container {
        padding: 1rem !important;
        min-height: auto !important;
    }
}

/* Dark Mode Support - DISABLED to preserve original colors */
/* Users can enable this if desired in the future */
/*
@media (prefers-color-scheme: dark) {
    .cocuisina-card {
        background: rgba(40, 40, 40, 0.7);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .cocuisina-btn {
        background: rgba(60, 60, 60, 0.7);
    }
    
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }
}
*/

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

/* Print Optimizations */
@media print {
    
    /* Hide navigation and interactive elements */
    .navbar,
    .floating-help-btn,
    .cocuisina-btn,
    .service-status-indicator {
        display: none !important;
    }
    
    /* Optimize for print */
    .cocuisina-card {
        border: 1px solid #000;
        background: white;
        page-break-inside: avoid;
    }
    
    /* Ensure text is readable */
    body {
        color: #000;
        background: white;
    }
}


