/* ========================================
   TRANSCRIPTION STUDIO - DARK THEME
   ======================================== */

:root {
    /* Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: #16161f;
    --bg-hover: #1f1f2e;

    --accent-primary: #6366f1;
    --accent-primary-hover: #818cf8;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);

    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);

    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

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

/* ========================================
   BASE STYLES
   ======================================== */

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

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   LAYOUT
   ======================================== */

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

/* ========================================
   HEADER
   ======================================== */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--accent-primary);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 600;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.btn-settings {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.btn-settings.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

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

/* ========================================
   SETTINGS PANEL
   ======================================== */

.settings-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-normal);
}

.settings-panel.open {
    max-height: 400px;
}

.settings-content {
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin: 16px 0;
}

.settings-content h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.settings-group {
    margin-bottom: 20px;
}

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

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

.toggle-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.toggle-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

.toggle-btn.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-primary-hover);
}

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

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

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 12px;
}

.switch {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.switch.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.switch.active::after {
    left: 25px;
    background: white;
}

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

/* ========================================
   MAIN CONTENT
   ======================================== */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}

/* ========================================
   UPLOAD SECTION
   ======================================== */

.upload-section {
    width: 100%;
    max-width: 600px;
}

.upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    background: var(--bg-card);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
    box-shadow: var(--shadow-glow);
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: var(--accent-primary);
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

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

.upload-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

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

/* File Preview */
.file-preview {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.file-icon {
    width: 48px;
    height: 48px;
    padding: 12px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-md);
    color: var(--accent-primary);
}

.file-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-all;
}

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

.btn-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

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

/* Audio Player */
.audio-player {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.audio-player audio {
    flex: 1;
    height: 40px;
}

.audio-duration {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Timestamp Section */
.timestamp-section {
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.timestamp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

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

.timestamp-inputs {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.time-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.time-input-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.time-input {
    display: flex;
    align-items: center;
    gap: 4px;
}

.time-input input {
    width: 50px;
    padding: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: center;
}

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

.time-separator {
    font-size: 0.875rem;
    color: var(--text-muted);
    padding-top: 20px;
}

/* Chunking Info */
.chunking-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 12px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    color: var(--accent-primary-hover);
}

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

/* ========================================
   BUTTONS
   ======================================== */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 24px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.btn-primary:active {
    transform: translateY(0);
}

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

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

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

.btn-new {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    padding: 12px 20px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

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

/* ========================================
   PROGRESS SECTION
   ======================================== */

.progress-section {
    width: 100%;
    max-width: 600px;
}

.progress-card {
    padding: 32px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
}

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

.progress-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

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

.progress-percent {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent-primary);
}

.progress-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 24px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-gradient);
    border-radius: 3px;
    transition: width var(--transition-normal);
}

.progress-steps {
    display: flex;
    justify-content: space-between;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.4;
    transition: opacity var(--transition-fast);
}

.step.active {
    opacity: 1;
}

.step.completed .step-icon {
    background: var(--success);
    border-color: var(--success);
}

.step-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.step.active .step-icon {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

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

/* ========================================
   RAW TRANSCRIPT SECTION (Intermediate)
   ======================================== */

.raw-transcript-section {
    width: 100%;
    max-width: 800px;
}

.raw-transcript-card {
    padding: 32px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
}

.raw-header {
    text-align: center;
    margin-bottom: 24px;
}

.raw-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

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

.raw-preview {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 24px;
    max-height: 300px;
    overflow-y: auto;
}

.raw-text {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.raw-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.raw-actions .btn-secondary,
.raw-actions .btn-primary {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

/* ========================================
   RESULTS SECTION
   ======================================== */

.results-section {
    width: 100%;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.results-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.results-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.results-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tab-btn {
    padding: 10px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.tab-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.results-content {
    position: relative;
}

.transcript-panel {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-height: 500px;
    overflow-y: auto;
}

.transcript-panel.active {
    display: block;
}

.transcript-text {
    font-size: 0.9375rem;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-wrap;
}

/* ========================================
   FOOTER
   ======================================== */

.footer {
    padding: 20px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

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

/* ========================================
   UTILITIES
   ======================================== */

.hidden {
    display: none !important;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .app-container {
        padding: 0 16px;
    }

    .upload-zone {
        padding: 40px 24px;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .results-actions {
        width: 100%;
    }

    .results-actions .btn-primary {
        flex: 1;
    }
}

/* ========================================
   SCROLLBAR
   ======================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}