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

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #edf5ff;
    --bg-hover: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #6e6e6e;
    --accent-primary: #0f4ba5;
    --accent-hover: #0098ff;
    --accent-success: #4ec9b0;
    --border-color: #e2e8f0;
    --shadow-color: rgba(0, 0, 0, 0.4);
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    padding: 40px 0;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* Upload Section */
.upload-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area {
    width: 100%;
    max-width: 600px;
    padding: 60px 40px;
    background-color: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--accent-primary);
    background-color: var(--bg-tertiary);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px var(--shadow-color);
}

.upload-icon {
    color: var(--accent-primary);
    margin-bottom: 20px;
}

.upload-text {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.upload-subtext {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.upload-link {
    color: var(--accent-primary);
    text-decoration: underline;
    cursor: pointer;
}

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

/* Compression Section */
.compression-section {
    flex: 1;
}

.compression-header {
    margin-bottom: 24px;
}

.compression-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
}

@media (max-width: 900px) {
    .compression-layout {
        grid-template-columns: 1fr;
    }
}

/* Preview Container */
.preview-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 600px) {
    .preview-container {
        grid-template-columns: 1fr;
    }
}

.preview-box {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
}

.preview-box h3 {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.image-wrapper {
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

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

.file-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-name,
.file-format {
    font-size: 0.875rem;
    color: var(--text-secondary);
    word-break: break-all;
}

.file-size {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Controls Panel */
.controls-panel {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    height: fit-content;
}

.control-group {
    margin-bottom: 24px;
}

.control-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background-color: var(--bg-tertiary);
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background-color: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
}

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

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

.quality-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent-primary);
    min-width: 45px;
    text-align: right;
}

select {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
}

select:focus {
    border-color: var(--accent-primary);
}

/* Savings Card */
.savings-card {
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}

.savings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.savings-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.savings-percentage {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent-success);
}

.savings-bar {
    height: 6px;
    background-color: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.savings-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-success));
    border-radius: 3px;
    transition: width 0.3s ease;
}

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

/* Buttons */
.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 204, 0.3);
}

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

.btn-secondary:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.btn-download {
    padding: 16px 24px;
    font-size: 1rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(30, 30, 30, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 1000;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay p {
    color: var(--text-secondary);
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 0 20px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

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