/* ================================ */
/* IMAGE OPTIMIZER - MODERN DESIGN  */
/* ================================ */

:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1f2937;
    --light: #f9fafb;
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f4f6f9; 
    color: var(--dark);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* === Hero Section === */
.hero-section {
    background: var(--gradient);
    color: white;
    padding: 60px 0 80px;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -5%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.btn-back {
    color: white !important;
    border-color: rgba(255,255,255,0.3) !important;
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,0.1);
    transition: all 0.3s;
}

.btn-back:hover {
    background: rgba(255,255,255,0.2);
    transform: translateX(-3px);
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 15px;
    text-shadow: 0 2px 20px rgba(0,0,0,0.2);
}

.hero-subtitle {
    font-size: 1.3rem;
    opacity: 0.95;
    margin-bottom: 30px;
}

.hero-badges {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.badge-feature {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 500;
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.3s;
}

.badge-feature:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-3px);
}

/* === Instructions === */
.instructions-card {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.instructions-toggle {
    padding: 20px 30px;
    cursor: pointer;
    background: white;
    transition: background 0.3s;
}

.instructions-toggle:hover {
    background: #f9fafb;
}

.instructions-toggle h4 {
    margin: 0;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.instructions-toggle .bi-chevron-down {
    transition: transform 0.3s;
    margin-left: auto;
}

.instructions-toggle .bi-chevron-down.rotated {
    transform: rotate(180deg);
}

.instructions-content {
    padding: 0 30px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s ease;
}

.instructions-content.show {
    max-height: 2000px;
    padding: 20px 30px 30px;
}

.instruction-step {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 15px;
    margin-bottom: 15px;
    transition: all 0.3s;
}

.instruction-step:hover {
    background: #f3f4f6;
    transform: translateX(5px);
}

.step-number {
    width: 45px;
    height: 45px;
    background: var(--gradient);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: bold;
    flex-shrink: 0;
}

.step-content h5 {
    margin: 0 0 8px;
    color: var(--dark);
}

.step-content p {
    margin: 0;
    color: #6b7280;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 15px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}

.feature-item i {
    font-size: 1.5rem;
    color: var(--primary);
}

/* === Upload Zone === */
.upload-zone-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

.upload-zone {
    border: 3px dashed #cbd5e1;
    border-radius: 25px;
    padding: 60px 40px;
    text-align: center;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(102,126,234,0.05) 0%, rgba(118,75,162,0.05) 100%);
    transform: scale(1.01);
}

.upload-zone.dragover {
    border-style: solid;
    box-shadow: var(--shadow-lg);
}

.upload-icon {
    font-size: 5rem;
    color: var(--primary);
    margin-bottom: 20px;
    transition: transform 0.3s;
}

.upload-zone:hover .upload-icon,
.upload-zone.dragover .upload-icon {
    transform: translateY(-10px) scale(1.1);
}

.upload-zone h3 {
    color: var(--dark);
    margin-bottom: 10px;
}

.upload-limits {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.limit-badge {
    background: #f3f4f6;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #6b7280;
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* === Settings Panel === */
.settings-panel {
    background: white;
    border-radius: 25px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.settings-header {
    padding: 25px 30px;
    background: var(--gradient);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-header .btn-link {
    color: white !important;
    text-decoration: none;
}

.settings-body {
    padding: 35px;
}

.setting-card {
    background: #f9fafb;
    padding: 25px;
    border-radius: 15px;
    height: 100%;
    transition: all 0.3s;
}

.setting-card:hover {
    background: #f3f4f6;
    transform: translateY(-3px);
    box-shadow: var(--shadow-sm);
}

.setting-label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--dark);
    font-size: 1.05rem;
}

.setting-label i {
    color: var(--primary);
    margin-right: 8px;
}

.form-select-lg, .form-control-lg {
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    padding: 12px 16px;
}

.form-select-lg:focus, .form-control-lg:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}

.form-range {
    height: 8px;
}

.form-range::-webkit-slider-thumb {
    background: var(--primary);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
}

.form-range::-webkit-slider-runnable-track {
    background: #e5e7eb;
    border-radius: 4px;
}

.quality-presets {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.quality-presets .btn {
    flex: 1;
    min-width: 80px;
}

/* === Optimize Button === */
.btn-optimize {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(102,126,234,0.4);
    transition: all 0.3s;
}

.btn-optimize:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(102,126,234,0.5);
    color: white;
}

.btn-optimize:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* === Progress Section === */
.progress-section {
    max-width: 700px;
    margin: 0 auto;
}

.progress-card {
    background: white;
    border-radius: 25px;
    padding: 40px;
    box-shadow: var(--shadow-md);
}

.animate-spin {
    animation: spin 2s linear infinite;
    color: var(--primary);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.progress {
    background: #e5e7eb;
    border-radius: 15px;
    overflow: hidden;
}

.progress-bar {
    background: var(--gradient);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === Stats Card === */
.stats-card {
    background: white;
    border-radius: 25px;
    padding: 35px;
    box-shadow: var(--shadow-md);
}

.stat-item {
    padding: 20px;
    transition: all 0.3s;
}

.stat-item:hover {
    transform: translateY(-5px);
}

.stat-item.highlight {
    background: linear-gradient(135deg, rgba(16,185,129,0.1) 0%, rgba(5,150,105,0.1) 100%);
    border-radius: 15px;
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 5px;
}

.stat-label {
    color: #6b7280;
    font-size: 0.95rem;
}

/* === Files List === */
.files-list {
    display: grid;
    gap: 20px;
}

.file-card {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: var(--shadow-sm);
    display: grid;
    grid-template-columns: 120px 1fr auto;
    gap: 25px;
    align-items: center;
    transition: all 0.3s;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.file-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.file-preview {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    background: #f3f4f6;
}

.file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.file-preview:hover img {
    transform: scale(1.1);
}

.file-preview-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
}

.file-preview:hover .file-preview-overlay {
    opacity: 1;
}

.file-info {
    min-width: 0;
}

.file-name {
    font-weight: 600;
    margin-bottom: 8px;
    word-break: break-word;
    color: var(--dark);
}

.file-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: #6b7280;
}

.file-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.savings-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(16,185,129,0.15) 0%, rgba(5,150,105,0.15) 100%);
    color: var(--success);
}

.file-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-download {
    background: var(--gradient-success);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16,185,129,0.4);
    color: white;
}

.btn-compare {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 8px 20px;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-compare:hover {
    background: var(--primary);
    color: white;
}

/* === Action Buttons === */
.action-buttons {
    padding: 30px;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
}

.action-buttons .btn {
    border-radius: 50px;
    padding: 14px 30px;
    font-weight: 600;
}

.action-buttons .btn-success {
    background: var(--gradient-success);
    border: none;
    box-shadow: 0 10px 30px rgba(16,185,129,0.3);
}

/* === Compare Modal === */
.compare-container {
    position: relative;
    max-width: 100%;
    overflow: hidden;
    border-radius: 15px;
    background: #000;
}

.compare-slider {
    position: relative;
    width: 100%;
    user-select: none;
}

.compare-image {
    display: block;
    width: 100%;
    height: auto;
}

.compare-after-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    overflow: hidden;
}

.compare-after-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.compare-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: ew-resize;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    z-index: 10;
    color: var(--primary);
    font-size: 1.5rem;
}

.compare-handle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 100vh;
    background: white;
    z-index: -1;
}

/* === Footer === */
.site-footer {
    background: var(--dark);
    color: white;
    padding: 30px 0;
    margin-top: 60px;
}

.site-footer a {
    color: #60a5fa;
}

/* === Cookie Banner === */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 600px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    display: none;
}

.cookie-content {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.cookie-icon {
    font-size: 2rem;
}

.cookie-text {
    flex: 1;
    min-width: 200px;
}

.cookie-btn {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
}

/* === Responsive === */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    .hero-subtitle {
        font-size: 1rem;
    }
    .hero-icon {
        font-size: 3.5rem;
    }
    .file-card {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .file-preview {
        margin: 0 auto;
    }
    .file-actions {
        flex-direction: row;
        justify-content: center;
    }
    .settings-body {
        padding: 20px;
    }
    .stat-value {
        font-size: 1.5rem;
    }
}

/* === Animations === */
.fade-in {
    animation: fadeIn 0.5s ease;
}

.scale-in {
    animation: scaleIn 0.4s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* === Form Switch === */
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-label {
    font-weight: 500;
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}