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

:root {
    /* Light Mode (Default) */
    --bg-primary: #f3f4f6;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --accent: #2563eb;
    /* Blue 600 */
    --accent-hover: #1d4ed8;
    /* Blue 700 */
    --success: #16a34a;
    --error: #dc2626;
    --border: #e5e7eb;
}

[data-theme="dark"] {
    /* Dark Mode */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    /* Blue 500 */
    --accent-hover: #60a5fa;
    /* Blue 400 */
    --success: #22c55e;
    --error: #ef4444;
    --border: #334155;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 480px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}

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

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

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

/* Upload Zone */
.upload-zone {
    background: var(--bg-card);
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent);
}

.upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    color: var(--text-secondary);
}

.upload-icon svg {
    width: 100%;
    height: 100%;
}

.upload-zone h2 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.upload-zone p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 12px;
}

.supported-formats {
    display: inline-block;
    background: var(--bg-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* File Info */
.file-info {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

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

.file-meta {
    flex: 1;
    min-width: 0;
}

.file-meta h3 {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.btn-remove {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

/* Bitrate Selection */
.bitrate-section h4 {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bitrate-options {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.bitrate-option {
    cursor: pointer;
    flex: 1;
    min-width: 70px;
}

.bitrate-option input {
    display: none;
}

.bitrate-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s;
    position: relative;
}

.bitrate-option input:checked+.bitrate-card {
    border-color: var(--accent);
    background: rgba(139, 92, 246, 0.1);
}

.bitrate-card:hover {
    border-color: var(--accent);
}

.bitrate-value {
    font-size: 1rem;
    font-weight: 600;
}

.bitrate-unit {
    font-size: 0.625rem;
    color: var(--text-secondary);
}

.bitrate-label {
    font-size: 0.625rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.recommended-badge {
    position: absolute;
    top: -8px;
    background: var(--accent);
    color: white;
    font-size: 0.5rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* Buttons */
.btn-convert {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

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

.btn-icon {
    font-size: 1rem;
}

/* Progress Section */
.progress-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.progress-header h3 {
    font-size: 1rem;
    font-weight: 500;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s;
}

.progress-text {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Result Section */
.result-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
}

.result-icon {
    width: 48px;
    height: 48px;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    margin: 0 auto 16px;
}

.result-section h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.result-details {
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.result-details p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 4px;
}

.result-details p:last-child {
    margin-bottom: 0;
}

.result-details strong {
    color: var(--text-primary);
}

/* Audio Player */
audio {
    height: 40px;
    border-radius: 8px;
    outline: none;
}

audio::-webkit-media-controls-panel {
    background: var(--bg-secondary);
}

audio::-webkit-media-controls-current-time-display,
audio::-webkit-media-controls-time-remaining-display {
    color: var(--text-primary);
}

/* Invert icons only in dark mode */
[data-theme="dark"] audio::-webkit-media-controls-play-button,
[data-theme="dark"] audio::-webkit-media-controls-mute-button {
    filter: invert(1);
}

.btn-download {
    width: 100%;
    padding: 14px;
    background: var(--success);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
    transition: opacity 0.2s;
}

.btn-download:hover {
    opacity: 0.9;
}

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

.btn-new {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Error Section */
.error-section {
    background: var(--bg-card);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
}

.error-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.error-section h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--error);
}

.error-section p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 16px;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 24px;
}

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

.footer .copyright {
    margin-top: 4px;
    opacity: 0.6;
}

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

/* Responsive */
@media (max-width: 400px) {
    .bitrate-options {
        flex-wrap: wrap;
    }

    .bitrate-option {
        min-width: calc(50% - 4px);
        flex: none;
    }
}

/* Theme Toggle */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
    z-index: 100;
}

.theme-toggle:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
}