/* ===== CSS Variables & Design Tokens ===== */
:root {
    /* Color Palette */
    --primary-hue: 250;
    --primary: hsl(var(--primary-hue), 100%, 65%);
    --primary-light: hsl(var(--primary-hue), 100%, 75%);
    --primary-dark: hsl(var(--primary-hue), 80%, 50%);

    --accent-hue: 340;
    --accent: hsl(var(--accent-hue), 100%, 65%);
    --accent-light: hsl(var(--accent-hue), 100%, 75%);

    --success: hsl(160, 84%, 45%);
    --success-light: hsl(160, 84%, 55%);
    --error: hsl(0, 84%, 60%);
    --error-light: hsl(0, 84%, 70%);

    /* Background Colors */
    --bg-primary: hsl(240, 20%, 8%);
    --bg-secondary: hsl(240, 18%, 12%);
    --bg-tertiary: hsl(240, 15%, 16%);
    --bg-card: hsla(240, 20%, 15%, 0.6);
    --bg-glass: hsla(240, 20%, 20%, 0.4);

    /* Text Colors */
    --text-primary: hsl(0, 0%, 98%);
    --text-secondary: hsl(240, 10%, 70%);
    --text-muted: hsl(240, 10%, 50%);

    /* Borders */
    --border-subtle: hsla(240, 20%, 50%, 0.15);
    --border-focus: hsla(var(--primary-hue), 100%, 65%, 0.5);

    /* Shadows */
    --shadow-sm: 0 2px 8px hsla(0, 0%, 0%, 0.2);
    --shadow-md: 0 8px 32px hsla(0, 0%, 0%, 0.3);
    --shadow-lg: 0 16px 64px hsla(0, 0%, 0%, 0.4);
    --shadow-glow: 0 0 40px hsla(var(--primary-hue), 100%, 65%, 0.3);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary), var(--accent));
    --gradient-card: linear-gradient(145deg, hsla(240, 20%, 18%, 0.8), hsla(240, 20%, 12%, 0.8));

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
}

/* ===== Reset & Base Styles ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ===== Background Effects ===== */
.background-effects {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: hsla(var(--primary-hue), 100%, 50%, 0.3);
    top: -200px;
    right: -200px;
    animation-delay: 0s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: hsla(var(--accent-hue), 100%, 50%, 0.25);
    bottom: -150px;
    left: -150px;
    animation-delay: -7s;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: hsla(180, 100%, 50%, 0.2);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(30px, -30px) scale(1.05);
    }

    50% {
        transform: translate(-20px, 20px) scale(0.95);
    }

    75% {
        transform: translate(-30px, -20px) scale(1.02);
    }
}

/* ===== Header ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg) var(--space-xl);
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-glow);
}

.logo-icon svg {
    width: 24px;
    height: 24px;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.privacy-badge {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    color: var(--success);
    font-size: 0.85rem;
    font-weight: 500;
}

.privacy-badge svg {
    width: 18px;
    height: 18px;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-xl);
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

/* ===== Hero Section ===== */
.hero {
    text-align: center;
    margin-bottom: var(--space-3xl);
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: var(--space-lg);
}

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.85em;
}

.hero-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto;
}

.hero-description strong {
    color: var(--success);
}

/* ===== Upload Section ===== */
.upload-section {
    width: 100%;
}

.dropzone {
    position: relative;
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-3xl);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--primary);
    background: hsla(var(--primary-hue), 100%, 65%, 0.05);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}

.dropzone-icon {
    width: 80px;
    height: 80px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    animation: pulse 2s ease-in-out infinite;
}

.dropzone-icon svg {
    width: 40px;
    height: 40px;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 hsla(var(--primary-hue), 100%, 65%, 0.4);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 20px hsla(var(--primary-hue), 100%, 65%, 0);
    }
}

.dropzone-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.dropzone-subtitle {
    color: var(--text-secondary);
}

.dropzone-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== Processing Section ===== */
.processing-section,
.result-section,
.error-section {
    width: 100%;
}

.file-card,
.result-card,
.error-card {
    background: var(--gradient-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow-lg);
}

.file-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: var(--space-lg);
}

.file-icon {
    width: 56px;
    height: 56px;
    background: hsla(var(--primary-hue), 100%, 65%, 0.15);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.file-icon svg {
    width: 28px;
    height: 28px;
}

.file-details {
    flex: 1;
}

.file-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

.file-size {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ===== Compression Options ===== */
.compression-options {
    margin-bottom: var(--space-xl);
}

.options-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

.option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.option-btn:hover {
    border-color: var(--primary-light);
    background: hsla(var(--primary-hue), 100%, 65%, 0.1);
}

.option-btn.active {
    border-color: var(--primary);
    background: hsla(var(--primary-hue), 100%, 65%, 0.15);
    box-shadow: 0 0 20px hsla(var(--primary-hue), 100%, 65%, 0.2);
}

.option-icon {
    font-size: 1.5rem;
}

.option-label {
    font-weight: 600;
    color: var(--text-primary);
}

.option-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Five column grid for presets */
.options-grid.five-cols {
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-sm);
}

.options-grid.five-cols .option-btn {
    padding: var(--space-sm);
}

.options-grid.five-cols .option-icon {
    font-size: 1.25rem;
}

.options-grid.five-cols .option-label {
    font-size: 0.85rem;
}

.options-grid.five-cols .option-desc {
    font-size: 0.65rem;
}

/* Custom Controls */
.custom-controls {
    margin-top: var(--space-lg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.custom-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.custom-header:hover {
    background: hsla(var(--primary-hue), 100%, 65%, 0.1);
}

.custom-header.open {
    border-bottom: 1px solid var(--border-subtle);
}

.custom-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.custom-title svg {
    width: 18px;
    height: 18px;
}

.custom-header .chevron {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.custom-header.open .chevron {
    transform: rotate(180deg);
}

/* Custom Sliders */
.custom-sliders {
    padding: var(--space-lg);
    background: var(--bg-secondary);
}

.slider-group {
    margin-bottom: var(--space-lg);
}

.slider-group:last-of-type {
    margin-bottom: var(--space-md);
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.slider-header label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.slider-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-light);
    background: hsla(var(--primary-hue), 100%, 65%, 0.15);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
}

/* Range Slider Styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--gradient-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--gradient-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.slider-hints {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-xs);
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Estimated Result Info */
.estimated-result {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: hsla(var(--primary-hue), 100%, 65%, 0.1);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.estimated-result svg {
    width: 18px;
    height: 18px;
    color: var(--primary-light);
    flex-shrink: 0;
}

/* Responsive for 5 columns */
@media (max-width: 768px) {
    .options-grid.five-cols {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .options-grid.five-cols {
        grid-template-columns: repeat(2, 1fr);
    }

    .options-grid.five-cols .option-btn:last-child {
        grid-column: span 2;
    }
}

/* ===== Warning Box ===== */
.warning-box {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: hsla(45, 100%, 50%, 0.1);
    border: 1px solid hsla(45, 100%, 50%, 0.3);
    border-radius: var(--radius-md);
    margin-top: var(--space-md);
    color: hsl(45, 100%, 70%);
    font-size: 0.85rem;
    line-height: 1.5;
}

.warning-box svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* ===== Progress Bar ===== */
.progress-container {
    margin-top: var(--space-md);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

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

.progress-text {
    display: inline;
}

/* ===== Buttons ===== */
.compress-btn,
.download-btn {
    width: 100%;
    padding: var(--space-md) var(--space-xl);
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.compress-btn:hover,
.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.compress-btn:active,
.download-btn:active {
    transform: translateY(0);
}

.compress-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-text,
.btn-loader {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ===== Result Section ===== */
.result-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.success-icon {
    width: 80px;
    height: 80px;
    background: hsla(160, 84%, 45%, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success);
    margin: 0 auto var(--space-md);
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.success-icon svg {
    width: 40px;
    height: 40px;
}

.result-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.stat-card.full-width {
    grid-column: span 2;
}

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

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-value.highlight {
    color: var(--primary-light);
}

.stat-value.savings {
    font-size: 2rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.download-btn svg {
    width: 20px;
    height: 20px;
}

.reset-btn {
    width: 100%;
    padding: var(--space-md);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    transition: all var(--transition-fast);
}

.reset-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.reset-btn svg {
    width: 18px;
    height: 18px;
}

/* ===== Error Section ===== */
.error-card {
    text-align: center;
}

.error-icon {
    width: 80px;
    height: 80px;
    background: hsla(0, 84%, 60%, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--error);
    margin: 0 auto var(--space-md);
}

.error-icon svg {
    width: 40px;
    height: 40px;
}

.error-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.error-message {
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
}

.error-reset {
    max-width: 300px;
    margin: 0 auto;
}

/* ===== Footer ===== */
.footer {
    padding: var(--space-xl);
    border-top: 1px solid var(--border-subtle);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.security-info {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-lg);
    margin-bottom: var(--space-md);
}

.security-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.security-item svg {
    width: 18px;
    height: 18px;
    color: var(--success);
}

.copyright {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== Utility Classes ===== */
.hidden {
    display: none !important;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }

    .privacy-badge {
        font-size: 0.75rem;
    }

    .main-content {
        padding: var(--space-md);
    }

    .hero {
        margin-bottom: var(--space-xl);
    }

    .dropzone {
        padding: var(--space-xl);
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card.full-width {
        grid-column: span 1;
    }

    .security-info {
        flex-direction: column;
        gap: var(--space-sm);
    }
}

/* ===== Animations ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}