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

:root {
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --surface2: #242424;
    --border: #333;
    --text: #e5e5e5;
    --text-dim: #888;
    --accent: #6c63ff;
    --accent-hover: #5a52e0;
    --success: #4caf50;
    --error: #ef5350;
    --warning: #ffa726;
    --radius: 8px;
}

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

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

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--text-dim);
    font-size: 1rem;
}

.formats {
    color: var(--text-dim);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* Server status */
.server-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    background: var(--surface);
    border: 1px solid var(--border);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--error);
    flex-shrink: 0;
}

.server-status.online .status-dot {
    background: var(--success);
}

/* Drop zone */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--accent);
    background: rgba(108, 99, 255, 0.05);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-dim);
}

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

/* File list */
.file-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.file-item .file-name {
    flex: 1;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item .file-size {
    color: var(--text-dim);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.file-item .file-progress {
    width: 80px;
    flex-shrink: 0;
}

.file-item .file-progress-bar {
    height: 4px;
    background: var(--surface2);
    border-radius: 2px;
    overflow: hidden;
}

.file-item .file-progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s;
    width: 0%;
}

.file-item .file-progress-text {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-align: right;
    margin-top: 2px;
}

.file-item .file-status {
    font-size: 0.8rem;
    flex-shrink: 0;
}

.file-item .file-status.done {
    color: var(--success);
}

.file-item .file-status.error {
    color: var(--error);
}

.file-item .file-remove {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1.1rem;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.file-item .file-remove:hover {
    color: var(--error);
    background: rgba(239, 83, 80, 0.1);
}

/* Settings */
.settings-section {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.settings-section h2 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.setting-group {
    margin-bottom: 1rem;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-hint {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 0.25rem;
}

/* Toggle switch */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    width: 40px;
    height: 22px;
    background: var(--surface2);
    border-radius: 11px;
    position: relative;
    transition: background 0.2s;
    border: 1px solid var(--border);
}

.toggle-slider::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: var(--text-dim);
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
    border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(18px);
    background: white;
}

.toggle-text-on,
.toggle-text-off {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.toggle-switch input:checked ~ .toggle-text-off {
    display: none;
}

.toggle-switch input:not(:checked) ~ .toggle-text-on {
    display: none;
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

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

/* Speakers range */
.speakers-range {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
}

.range-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.range-input label {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.range-input input[type="number"] {
    width: 60px;
    padding: 0.3rem 0.5rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.9rem;
    text-align: center;
}

/* Action button */
.action-section {
    margin-top: 1.5rem;
    text-align: center;
}

.start-btn {
    padding: 0.75rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

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

.start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.start-btn.processing {
    background: var(--warning);
}

/* Queue */
.queue-section {
    margin-top: 1.5rem;
}

.queue-section h2 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.queue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-size: 0.9rem;
}

.queue-item.active {
    border-color: var(--accent);
    background: rgba(108, 99, 255, 0.08);
}

.queue-item .queue-pos {
    color: var(--text-dim);
    font-size: 0.8rem;
}

/* Job status */
.job-section {
    margin-top: 1.5rem;
}

.job-section h2 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.job-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--accent);
    flex-wrap: wrap;
}

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

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

.job-file {
    width: 100%;
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* Results */
.results-section {
    margin-top: 1.5rem;
}

.results-section h2 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.result-item a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
}

.result-item a:hover {
    text-decoration: underline;
}

.download-all-btn {
    margin-top: 0.75rem;
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
}

.download-all-btn:hover {
    background: var(--border);
}

/* Hints */
.hints-section {
    margin-top: 2rem;
    padding: 1.25rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.hints-section h3 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.hints-section ul {
    padding-left: 1.25rem;
}

.hints-section li {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 0.35rem;
}

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

    .header h1 {
        font-size: 1.5rem;
    }

    .drop-zone {
        padding: 1.5rem;
    }

    .speakers-range {
        flex-direction: column;
        gap: 0.5rem;
    }

    .start-btn {
        width: 100%;
    }
}
