/* Responsive Design Styles */

/* Mobile First Approach */

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
    .container {
        max-width: 540px;
    }
    
    .quick-actions {
        justify-content: center;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (max-width: 768px) {
    /* Header adjustments */
    .header-content {
        flex-wrap: wrap;
        gap: var(--spacing-md);
    }
    
    .logo h1 {
        font-size: var(--font-size-lg);
    }
    
    .container {
        padding: 0 var(--spacing-sm);
    }
    
    /* Quick start section */
    .quick-start-content h2 {
        font-size: var(--font-size-2xl);
    }
    
    .quick-start-content p {
        font-size: var(--font-size-base);
    }
    
    .quick-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .quick-actions .btn {
        width: 100%;
        max-width: 300px;
    }
    
    /* Workspace layout - stack vertically on mobile */
    .workspace-layout {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
    
    /* Control panel adjustments */
    .control-panel {
        position: static;
        order: 2;
    }
    
    .palette-workspace {
        order: 1;
    }
    
    /* Algorithm selector - horizontal scroll on mobile */
    .algorithm-selector {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        gap: var(--spacing-sm);
        padding-bottom: var(--spacing-sm);
    }
    
    .algorithm-selector label {
        min-width: 200px;
        flex-shrink: 0;
    }
    
    /* Sliders - vertical layout on mobile */
    .slider-group {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-sm);
    }
    
    .slider-group label {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    /* Palette display adjustments */
    .palette-display {
        flex-direction: column;
        min-height: 300px;
    }
    
    .color-swatch {
        min-height: 60px;
        flex: none;
    }
    
    .color-swatch:hover {
        transform: none;
    }
    
    .color-info {
        opacity: 1;
        position: static;
        background: rgba(0, 0, 0, 0.7);
        color: var(--white);
        border-radius: 0;
        margin-top: auto;
    }
    
    /* Palette header */
    .palette-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-md);
    }
    
    .palette-actions {
        justify-content: center;
    }
    
    /* Color codes */
    .color-list {
        justify-content: center;
    }
    
    .color-code {
        flex: 1;
        min-width: 0;
        justify-content: center;
    }
    
    /* Modal adjustments */
    .modal-overlay {
        padding: var(--spacing-md);
    }
    
    .modal {
        max-height: 95vh;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    /* Toast notifications */
    .toast-container {
        top: auto;
        bottom: var(--spacing-lg);
        left: var(--spacing-md);
        right: var(--spacing-md);
    }
    
    .toast {
        max-width: none;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
    
    /* Workspace can have wider control panel */
    .workspace-layout {
        grid-template-columns: 360px 1fr;
    }
    
    /* Larger palette display */
    .color-swatch {
        min-height: 240px;
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
    
    /* Even larger palette display */
    .color-swatch {
        min-height: 280px;
    }
    
    /* Side-by-side export options */
    .export-options {
        grid-template-columns: 1fr 1.5fr;
    }
}

/* Extra extra large devices (extra large desktops, 1400px and up) */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* Touch-specific adjustments */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn {
        min-height: 48px;
        padding: var(--spacing-md) var(--spacing-lg);
    }
    
    .btn-icon {
        min-width: 48px;
        min-height: 48px;
    }
    
    .color-picker {
        width: 80px;
        height: 48px;
    }
    
    .algorithm-selector label {
        padding: var(--spacing-lg);
    }
    
    .slider {
        height: 8px;
    }
    
    .slider::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
    
    .slider::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
    
    /* Remove hover effects on touch devices */
    .color-swatch:hover {
        transform: none;
    }
    
    .color-info {
        opacity: 1;
    }
    
    .saved-palette-card:hover {
        transform: none;
    }
    
    .nav-btn:hover {
        background-color: transparent;
    }
}

/* Print styles */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    .app-header,
    .control-panel,
    .palette-actions,
    .modal-overlay,
    .toast-container,
    .loading-overlay {
        display: none !important;
    }
    
    .workspace-layout {
        grid-template-columns: 1fr;
    }
    
    .palette-display {
        flex-direction: row;
        min-height: 100px;
        border: 1px solid #000;
    }
    
    .color-info {
        opacity: 1;
        background: rgba(255, 255, 255, 0.9);
        color: #000;
    }
    
    .color-list {
        flex-direction: column;
        gap: 4px;
    }
    
    .color-code {
        background: transparent;
        border: 1px solid #000;
        font-size: 12px;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --border-light: #000000;
        --border-medium: #000000;
        --border-dark: #000000;
        --shadow-sm: none;
        --shadow-md: none;
        --shadow-lg: none;
        --shadow-xl: none;
    }
    
    .btn {
        border-width: 2px;
    }
    
    .color-swatch {
        border: 2px solid #000;
    }
    
    .algorithm-selector label {
        border-width: 2px;
    }
    
    .modal {
        border: 2px solid #000;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .color-wheel {
        animation: none;
    }
    
    .loading-spinner {
        animation: none;
        border-left-color: var(--border-light);
    }
}

/* Dark mode adjustments for different screen sizes */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
    .color-info {
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(10px);
        color: var(--white);
    }
}

/* Landscape phone specific adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .app-main {
        padding: var(--spacing-lg) 0;
    }
    
    .quick-start-content h2 {
        font-size: var(--font-size-xl);
    }
    
    .palette-display {
        flex-direction: row;
        min-height: 150px;
    }
    
    .color-swatch {
        min-height: 150px;
    }
}

/* iPad specific adjustments */
@media (min-width: 768px) and (max-width: 1024px) {
    .workspace-layout {
        grid-template-columns: 280px 1fr;
    }
    
    .control-panel {
        font-size: var(--font-size-sm);
    }
    
    .algorithm-selector label {
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .algorithm-name {
        font-size: var(--font-size-sm);
    }
    
    .algorithm-desc {
        font-size: var(--font-size-xs);
    }
}

/* Ultra-wide screen adjustments */
@media (min-width: 1600px) {
    .workspace-layout {
        grid-template-columns: 400px 1fr 300px;
    }
    
    .saved-palettes {
        order: 3;
        margin-top: 0;
    }
    
    .palette-grid {
        grid-template-columns: 1fr;
    }
}

/* Accessibility improvements for different screen sizes */
@media (max-width: 768px) {
    /* Focus indicators */
    .btn:focus,
    .color-picker:focus,
    .hex-input:focus,
    .algorithm-selector input:focus + .algorithm-option {
        outline: 3px solid var(--primary-color);
        outline-offset: 2px;
    }
    
    /* Skip link for mobile */
    .skip-link {
        position: absolute;
        top: -40px;
        left: 6px;
        background: var(--primary-color);
        color: var(--white);
        padding: 8px;
        text-decoration: none;
        border-radius: 4px;
        z-index: 1000;
    }
    
    .skip-link:focus {
        top: 6px;
    }
}