/* ========================================
   Compresseur d'Image HD - Styles
   Design moderne et professionnel
   ======================================== */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #10b981;
    --secondary-dark: #059669;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #475569;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --gradient-1: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-2: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* ========================================
   Layout
   ======================================== */

.app-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   Header
   ======================================== */

.header {
    text-align: center;
    margin-bottom: 3rem;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* ========================================
   Main Content
   ======================================== */

.main-content {
    flex: 1;
}

/* ========================================
   Upload Section
   ======================================== */

.upload-section {
    margin-bottom: 2rem;
}

.drop-zone {
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: var(--radius-xl);
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.drop-zone-content {
    pointer-events: none;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.drop-zone h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.drop-zone p {
    color: var(--text-muted);
}

.supported-formats {
    font-size: 0.875rem;
    margin-top: 1rem;
    color: var(--text-muted);
}

/* ========================================
   Settings Section
   ======================================== */

.settings-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.settings-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

/* Feature Toggle Cards */
.feature-toggle {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.toggle-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--surface-light);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    opacity: 0.6;
}

.toggle-card.active {
    opacity: 1;
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.toggle-icon {
    font-size: 2rem;
}

.toggle-info {
    flex: 1;
}

.toggle-info h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.toggle-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-toggle {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: 0.3s;
    border-radius: 28px;
}

.slider-toggle:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

input:checked + .slider-toggle {
    background: var(--gradient-1);
}

input:checked + .slider-toggle:before {
    transform: translateX(24px);
}

/* Settings Group */
.settings-group {
    background: var(--surface-light);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.settings-group h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

/* Range Slider */
.setting-item input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    outline: none;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.range-value {
    font-size: 0.875rem;
    color: var(--primary-light);
    font-weight: 600;
}

/* Color Picker */
.setting-item input[type="color"] {
    width: 100%;
    height: 40px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: transparent;
}

.setting-item input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.setting-item input[type="color"]::-webkit-color-swatch {
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
}

/* Start Processing Button */
.start-processing {
    margin-top: 1.5rem;
    text-align: center;
}

.btn-large {
    padding: 1.25rem 3rem;
    font-size: 1.1rem;
}

.btn-gradient {
    background: var(--gradient-1);
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
}

.btn-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.4);
}

.btn-gradient:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-item label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.setting-item input[type="number"],
.setting-item select {
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    color: var(--text);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.setting-item input[type="number"]:focus,
.setting-item select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.setting-item input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.5rem;
    accent-color: var(--primary);
}

.setting-item label:has(input[type="checkbox"]) {
    flex-direction: row;
    align-items: center;
    cursor: pointer;
}

/* ========================================
   Progress Section
   ======================================== */

.progress-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.progress-bar {
    height: 12px;
    background: var(--surface-light);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-1);
    border-radius: 6px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-detail {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
}

/* ========================================
   Comparison Section
   ======================================== */

.comparison-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.comparison-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
    text-align: center;
}

/* Operations Badges */
.operations-badges {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-primary {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* Stats Container */
.stats-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.stat-card {
    background: var(--surface-light);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    min-width: 180px;
}

.stat-card h4 {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-card.original .stat-value {
    color: var(--warning);
}

.stat-card.compressed .stat-value {
    color: var(--success);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-extra {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.stat-card.arrow {
    background: transparent;
    min-width: auto;
    padding: 1rem;
}

.arrow-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.compression-ratio {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--success);
}

/* Quality Indicator */
.quality-indicator {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--surface-light);
    border-radius: var(--radius-md);
}

.quality-indicator span {
    font-weight: 500;
    white-space: nowrap;
}

.quality-bar {
    flex: 1;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.quality-fill {
    height: 100%;
    background: var(--gradient-2);
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}

#qualityPercent {
    font-weight: 700;
    color: var(--success);
}

/* Image Comparison Slider */
.image-comparison {
    margin-bottom: 2rem;
}

.comparison-slider {
    position: relative;
    width: 100%;
    max-height: 500px;
    overflow: hidden;
    border-radius: var(--radius-lg);
    cursor: ew-resize;
    background: var(--surface-light);
}

.image-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.original-container {
    z-index: 1;
}

.compressed-container {
    z-index: 2;
    clip-path: inset(0 0 0 50%);
}

.image-label {
    position: absolute;
    bottom: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.original-container .image-label {
    left: 1rem;
}

.compressed-container .image-label {
    right: 1rem;
}

.slider-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    background: white;
    z-index: 3;
    cursor: ew-resize;
    transform: translateX(-50%);
}

.handle-line {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.handle-line::before,
.handle-line::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

.handle-line::before {
    left: 8px;
    border-width: 6px 8px 6px 0;
    border-color: transparent var(--primary) transparent transparent;
}

.handle-line::after {
    right: 8px;
    border-width: 6px 0 6px 8px;
    border-color: transparent transparent transparent var(--primary);
}

/* ========================================
   Actions
   ======================================== */

.actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--surface-light);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

/* ========================================
   Footer
   ======================================== */

.footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--border);
}

.footer p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.tech-info {
    margin-top: 0.5rem;
    font-size: 0.75rem !important;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 1.75rem;
    }
    
    .drop-zone {
        padding: 2rem 1rem;
    }
    
    .upload-icon {
        font-size: 3rem;
    }
    
    .stats-container {
        flex-direction: column;
    }
    
    .stat-card {
        width: 100%;
    }
    
    .stat-card.arrow {
        transform: rotate(90deg);
    }
    
    .quality-indicator {
        flex-direction: column;
        text-align: center;
    }
    
    .quality-bar {
        width: 100%;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ========================================
   Animations
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.comparison-section {
    animation: fadeIn 0.5s ease;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.progress-fill {
    animation: pulse 2s ease-in-out infinite;
}

/* ========================================
   Scrollbar
   ======================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
