/**
 * Responsive Design - Mobile First Approach
 */

/* Mobile Devices (Default styles are for mobile) */
@media (max-width: 640px) {
    :root {
        --space-lg: 1rem;
        --space-xl: 1.5rem;
    }
    
    .container {
        padding: 0 var(--space-md);
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .glass-card,
    .glass-container {
        padding: var(--space-lg);
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .navbar-menu {
        display: none;
    }
    
    .navbar-toggle {
        display: block;
    }
    
    .sidebar {
        position: fixed;
        left: -100%;
        top: 60px;
        width: 100%;
        max-width: 300px;
        height: calc(100vh - 60px);
        background: white;
        transition: left 0.3s ease;
        z-index: 999;
    }
    
    .sidebar.active {
        left: 0;
    }
}

/* Tablet Devices */
@media (min-width: 641px) and (max-width: 1024px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
}

/* Large Screens */
@media (min-width: 1025px) {
    .navbar-toggle {
        display: none;
    }
    
    .sidebar {
        position: relative;
        left: 0;
        top: 0;
        height: auto;
        width: 250px;
    }
}

/* Landscape Orientation */
@media (orientation: landscape) and (max-height: 500px) {
    header,
    .footer {
        padding: var(--space-sm);
    }
}

/* High DPI/Retina Display */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .border {
        border-width: 0.5px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .no-print,
    header,
    footer,
    .navbar,
    .sidebar,
    .btn,
    .form-input,
    .form-select {
        display: none !important;
    }
    
    .glass-card,
    .glass-container {
        border: 1px solid #ccc;
        box-shadow: none;
        page-break-inside: avoid;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn {
        padding: var(--space-lg) var(--space-xl);
        min-height: 48px;
    }
    
    .form-input,
    .form-select {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    a, button {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Dark Mode (Optional) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0F172A;
        --bg-secondary: #1A202C;
        --bg-card: rgba(30, 41, 59, 0.7);
        --text-primary: #E2E8F0;
        --text-secondary: #CBD5E1;
        --text-light: #94A3B8;
        --border-color: rgba(255, 255, 255, 0.1);
    }
    
    body {
        background: var(--bg-primary);
        color: var(--text-primary);
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        background: rgba(30, 41, 59, 0.6);
        color: var(--text-primary);
    }
    
    .form-input::placeholder,
    .form-select::placeholder {
        color: var(--text-light);
    }
}

/* Very Small Screens */
@media (max-width: 360px) {
    h1 {
        font-size: 1.5rem;
    }
    
    .glass-card,
    .glass-container {
        padding: var(--space-md);
    }
    
    .btn {
        padding: var(--space-md) var(--space-md);
        font-size: 0.875rem;
    }
}

/* Accessibility Focus */
@media (prefers-color-scheme: dark) {
    body {
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    }
}
