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

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --error-color: #ef4444;
    --background: #f9fafb;
    --card-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --border-radius: 12px;
}

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

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

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

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Drop Zone */
.drop-zone {
    background: var(--card-bg);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: var(--secondary-color);
}

.drop-zone p {
    font-size: 1.25rem;
    color: var(--text-primary);
}

.drop-zone span {
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

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

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #5b6570;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    width: 100%;
}

/* Preview Section */
.preview-section {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.preview-header h3 {
    font-size: 1.1rem;
}

.preview-content {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

#previewImage {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    object-fit: contain;
    background: #f3f4f6;
}

.file-info {
    flex: 1;
}

.file-info p {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.file-info strong {
    color: var(--text-primary);
}

/* Options Section */
.options-section {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.options-section h3 {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.options-grid {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

.checkbox-group {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--border-color);
    appearance: none;
}

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

.dimension-inputs {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dimension-inputs input {
    width: 120px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
}

.dimension-inputs input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.option-group small {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Loading Section */
.loading-section {
    text-align: center;
    padding: 3rem;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    margin-top: 1.5rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Results Section */
.results-section {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.results-section h3 {
    margin-bottom: 1rem;
}

.original-info {
    background: #f3f4f6;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.results-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.result-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.result-info {
    flex: 1;
}

.result-format {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

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

.result-savings {
    color: var(--success-color);
    font-weight: 500;
}

.result-savings.negative {
    color: var(--error-color);
}

.result-card .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.download-all {
    text-align: center;
    margin-bottom: 1rem;
}

#compressAnotherBtn {
    width: 100%;
}

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

/* Footer */
footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .preview-content {
        flex-direction: column;
    }

    #previewImage {
        max-width: 100%;
    }

    .dimension-inputs {
        flex-direction: column;
        align-items: stretch;
    }

    .dimension-inputs input {
        width: 100%;
    }

    .dimension-inputs span {
        text-align: center;
    }

    .result-card {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .result-card .btn {
        width: 100%;
    }
}
