/* Large desktop devices */
@media (min-width: 1440px) {
    .container {
        max-width: 1000px;
    }
    
    .preview-container {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* Standard desktop devices */
@media (max-width: 1200px) {
    h1 {
        font-size: 2.6rem;
    }
}

/* Tablet devices */
@media (max-width: 900px) {
    .container {
        padding: 2rem;
    }
    
    h1 {
        font-size: 2.4rem;
    }
    
    .subtitle {
        font-size: 1.1rem;
    }
    
    .preview-container {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .controls {
        flex-direction: column;
    }
    
    .download-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .download-btn {
        align-self: stretch;
        text-align: center;
    }
}

/* Large mobile devices */
@media (max-width: 768px) {
    body {
        padding: 1.5rem 1rem;
    }
    
    .container {
        padding: 1.75rem;
        border-radius: 10px;
    }
    
    h1 {
        font-size: 2.2rem;
    }
    
    .upload-area {
        padding: 2.5rem 1.5rem;
    }
    
    .upload-icon {
        font-size: 3rem;
    }
    
    .btn {
        padding: 0.9rem 1.75rem;
        font-size: 1rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .preview-container {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }
    
    .preview-img {
        height: 150px;
    }
    
    .download-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .download-btn {
        align-self: stretch;
        text-align: center;
    }
    
    .quality-control {
        margin-top: 1rem;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    body {
        padding: 1.25rem 0.75rem;
    }
    
    header {
        margin-bottom: 1.5rem;
    }
    
    h1 {
        font-size: 2rem;
        text-align: center;
    }
    
    .subtitle {
        font-size: 1rem;
        text-align: center;
    }
    
    .container {
        padding: 1.5rem;
        border-radius: 10px;
    }
    
    .upload-area {
        padding: 2rem 1rem;
        margin-bottom: 2rem;
    }
    
    .upload-icon {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }
    
    .upload-text {
        font-size: 1rem;
        margin-bottom: 1.25rem;
    }
    
    .upload-text small {
        font-size: 0.8rem;
    }
    
    .controls {
        margin-bottom: 2rem;
        gap: 1.25rem;
    }
    
    .format-label {
        font-size: 1rem;
    }
    
    select {
        padding: 0.9rem;
        font-size: 0.95rem;
    }
    
    .section-title {
        font-size: 1.2rem;
    }
    
    .preview-container {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.9rem;
    }
    
    .preview-img {
        height: 130px;
    }
    
    .preview-name {
        padding: 0.6rem;
        font-size: 0.8rem;
    }
    
    .remove-btn {
        width: 25px;
        height: 25px;
        font-size: 0.9rem;
    }
    
    .download-item {
        padding: 1rem;
    }
    
    .download-name {
        font-size: 1rem;
    }
    
    .download-btn {
        padding: 0.6rem 1.25rem;
        font-size: 0.95rem;
    }
    
    .notification {
        top: 15px;
        right: 15px;
        left: 15px;
        max-width: none;
        text-align: center;
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }
    
    .notification::before {
        width: 18px;
        height: 18px;
    }
    
    footer {
        font-size: 0.8rem;
        padding: 0 1rem;
    }
}

/* Very small devices */
@media (max-width: 360px) {
    h1 {
        font-size: 1.8rem;
    }
    
    .preview-container {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
    
    .preview-img {
        height: 110px;
    }
    
    .btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.95rem;
    }
    
    .section-title {
        font-size: 1.1rem;
    }
    
    .count-badge {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
    }
}

/* High-resolution displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .upload-icon {
        filter: drop-shadow(0 2px 4px rgba(99, 102, 241, 0.3));
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .spinner {
        animation: none;
        border-top-color: transparent;
        position: relative;
    }
    
    .spinner::after {
        content: "⏳";
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 1.5rem;
    }
}

/* Dark mode support (for systems that might override) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #121212;
        --bg-secondary: #1e1e1e;
        --text-primary: #ffffff;
    }
}

/* Light mode support */
@media (prefers-color-scheme: light) {
    :root {
        --bg-primary: #f5f5f5;
        --bg-secondary: #ffffff;
        --bg-tertiary: #f0f0f0;
        --text-primary: #333333;
        --text-secondary: #666666;
        --text-tertiary: #888888;
    }
    
    .upload-area {
        border-color: #d1d5db;
    }
    
    select {
        border-color: #d1d5db;
    }
    
    .preview-name {
        background: rgba(255, 255, 255, 0.9);
        color: #333;
    }
}

/* Orientation-specific styles */
@media (max-width: 768px) and (orientation: landscape) {
    .container {
        max-width: 700px;
    }
    
    .preview-container {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

/* Print styles */
@media print {
    .upload-area,
    .controls,
    .preview-section,
    .loading,
    .download-all-container,
    .btn {
        display: none !important;
    }
    
    .container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .download-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}