/* Responsive Design - Mobile First Approach */

/* Tablet and below (1024px) */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 300px;
    }
    
    .controls-panel {
        width: var(--sidebar-width);
    }
}

/* Mobile and below (768px) */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        padding: var(--space-md);
    }
    
    .controls-panel {
        width: 100%;
        max-height: none;
    }
    
    .filter-grid {
        max-height: none;
        grid-template-columns: 1fr;
    }
    
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }
    
    .toolbar {
        width: 100%;
        justify-content: space-between;
    }
    
    .logo {
        font-size: var(--text-xl);
    }
    
    .tagline {
        font-size: var(--text-xs);
    }
    
    .image-container {
        min-height: 300px;
    }
    
    .canvas-wrapper {
        min-height: 250px;
    }
}

/* Small mobile (480px) */
@media (max-width: 480px) {
    .main-content {
        padding: var(--space-sm);
    }
    
    .header {
        padding: var(--space-sm) var(--space-md);
    }
    
    .filter-grid {
        grid-template-columns: 1fr;
    }
    
    .preset-grid {
        grid-template-columns: 1fr;
    }
    
    .sample-images {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .toolbar {
        flex-wrap: wrap;
    }
    
    .btn {
        font-size: var(--text-xs);
        padding: var(--space-xs) var(--space-sm);
    }
    
    .btn-icon {
        width: 32px;
        height: 32px;
    }
    
    .control-section {
        padding: var(--space-md);
    }
    
    .image-container {
        padding: var(--space-md);
    }
    
    .drop-icon {
        font-size: 3rem;
    }
    
    .drop-text {
        font-size: var(--text-base);
    }
    
    .drop-hint {
        font-size: var(--text-xs);
    }
    
    .modal-content {
        padding: var(--space-lg);
    }
    
    .toast {
        bottom: var(--space-md);
        right: var(--space-md);
        left: var(--space-md);
        max-width: none;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Increase tap targets for touch devices */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .filter-button,
    .preset-button,
    .sample-image {
        min-height: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .btn:hover,
    .filter-button:hover,
    .preset-button:hover,
    .sample-image:hover {
        transform: none;
    }
    
    /* Active states for touch feedback */
    .btn:active {
        transform: scale(0.98);
    }
    
    .filter-button:active,
    .preset-button:active {
        transform: scale(0.98);
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Optimize for retina displays */
    .logo-icon {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .image-container {
        min-height: 200px;
    }
    
    .canvas-wrapper {
        min-height: 150px;
    }
    
    .controls-panel {
        max-height: calc(100vh - 100px);
    }
}

/* Print styles */
@media print {
    .header,
    .controls-panel,
    .toolbar,
    .loading,
    .toast,
    .modal {
        display: none !important;
    }
    
    .main-content {
        display: block;
    }
    
    .canvas-area {
        width: 100%;
    }
}

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

/* Dark mode support (already dark by default, but adding for completeness) */
@media (prefers-color-scheme: light) {
    /* Users can uncomment this section if they want a light mode option */
    /*
    :root {
        --background: #ffffff;
        --surface: #f8fafc;
        --surface-light: #e2e8f0;
        --text: #0f172a;
        --text-secondary: #475569;
        --border: #cbd5e1;
    }
    */
}
