/* CSS for Fake Voice Portal - Professional Audio Studio Vibe */
:root {
    --bg-dark: #0f172a;
    --panel-dark: #1e293b;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
}

.light-mode {
    --bg-dark: #f8fafc;
    --panel-dark: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --border-color: rgba(15, 23, 42, 0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Glassmorphism Classes */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
}

/* Layout */
header {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

body.light-mode header {
    background: rgba(255, 255, 255, 0.9);
}

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

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.gap-3 {
    gap: 12px;
}

main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Sidebar */
aside {
    width: 320px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    transition: width 0.3s ease;
}

.search-box {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.search-box input {
    width: 100%;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: white;
    outline: none;
}

.voice-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.voice-card {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.voice-card:hover {
    background: rgba(255, 255, 255, 0.05);
}

.voice-card.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-blue);
}

.voice-img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
    border: 2px solid var(--border-color);
}

.voice-info h4 {
    font-size: 14px;
    font-weight: 600;
}

.voice-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

.section-header {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 16px 4px 8px;
}

/* Editor Area */
.editor-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 24px;
    overflow-y: auto;
}

.editor-container {
    flex: 1;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Normalize + char count strip inside editor */
.editor-subtoolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0,0,0,0.12);
    flex-shrink: 0;
}

.char-counter {
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    transition: color 0.2s;
}

.char-counter.warn  { color: #f59e0b; }
.char-counter.over  { color: #ef4444; }

/* Selected voice chip in controls bar */
.selected-voice-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 6px;
    border-radius: 40px;
    background: rgba(59,130,246,0.1);
    border: 1px solid rgba(59,130,246,0.3);
    flex-shrink: 0;
}

.chip-voice-img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-blue);
}

.chip-voice-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.chip-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chip-lang {
    font-size: 11px;
    color: var(--accent-blue);
    font-weight: 600;
}

#quill-editor {
    flex: 1;
    background: rgba(255, 255, 255, 0.02);
    font-size: 18px;
    line-height: 1.6;
    color: var(--text-primary);
}

body.light-mode #quill-editor {
    background: #ffffff;
}

.ql-toolbar.ql-snow {
    border: none !important;
    background: rgba(0, 0, 0, 0.05) !important;
}

.ql-container.ql-snow {
    border: none !important;
}

/* Custom Pause Button in Quill Toolbar */
.ql-pause::before {
    content: '\f04c' !important;
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
    font-size: 14px !important;
    color: var(--text-secondary);
}

.ql-pause:hover::before {
    color: white;
}

/* Controls */
.controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--panel-dark);
    border-radius: 12px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: transform 0.2s ease;
}

.btn-primary:active {
    transform: scale(0.98);
}

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Waveform Placeholder */
.waveform-container {
    height: 100px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.wave-bar {
    width: 3px;
    height: 20px;
    background: var(--accent-blue);
    margin: 0 2px;
    border-radius: 2px;
    /* In actual implementation, we animate these based on audio frequency data */
}

/* Filter Chips */
.filter-chip {
    padding: 6px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.filter-chip.active {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

/* Horizontal Emotion List */
.emotion-scroller {
    overflow-x: auto;
    flex: 1;
    max-width: 400px; /* Adjust based on layout */
    padding-bottom: 4px;
}

.emotion-list-horizontal {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
}

.emotion-chip {
    padding: 8px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.emotion-chip:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.emotion-chip.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--accent-blue);
    color: white;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

.emotion-scroller::-webkit-scrollbar {
    height: 4px;
}

.emotion-scroller::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* Feature Tabs (on top) */
.feature-tabs {
    display: flex;
    gap: 8px;
    padding: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 14px;
    margin-bottom: 0px;
    /* Aligned closer to the editor */
    width: fit-content;
    border: 1px solid var(--border-color);
}

.tab {
    padding: 10px 24px;
    border-radius: 10px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.tab i {
    font-size: 16px;
    opacity: 0.7;
}

.tab:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.tab.active {
    background: var(--accent-blue);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.tab.active i {
    opacity: 1;
}

/* Buttons */
.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-ghost:hover {
    color: white;
}

.user-chip {
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 14px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    border: 1px solid var(--border-color);
}

.btn-secondary.btn-sm {
    padding: 4px 8px;
    font-size: 11px;
}

.tab-pane {
    animation: fadeIn 0.3s ease-out;
}

/* Ensure tab panes with glass class layout correctly when visible */
.tab-pane.glass {
    padding: 24px;
    border-radius: 16px;
    margin-top: 24px;
}

/* Dialogue and History use block display so their internal grids work */
#dialogue-content,
#history-content {
    margin-top: 24px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#drop-zone.dragover {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
}

input[type="range"] {
    accent-color: var(--accent-blue);
}

/* Balance Remaining Section - Premium Studio Design */
.balance-container {
    padding: 24px 16px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

.balance-card {
    padding: 24px;
    border-radius: 20px;
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

.balance-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.balance-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    text-align: center;
}

.balance-info i {
    font-size: 32px;
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.15);
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.balance-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.balance-text .label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.balance-text .value {
    font-size: 24px;
    font-weight: 800;
    color: white;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.light-mode .balance-text .value {
    color: var(--text-primary);
    background: none;
    -webkit-text-fill-color: var(--text-primary);
}

.balance-progress {
    height: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-buy {
    width: 100%;
    margin-top: 20px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #451a03;
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2);
}

.btn-buy:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
    filter: brightness(1.1);
}

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

.btn-buy i {
    font-size: 16px;
}
/* Modal System */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    width: 90%;
    max-width: 450px;
    padding: 32px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-content h3 {
    margin-bottom: 8px;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-content h3 i {
    color: var(--accent-blue);
}

.modal-content .form-group {
    margin-bottom: 16px;
    text-align: left;
}

.modal-content label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.modal-content input, .modal-content select {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: white;
    outline: none;
}

/* ============================================================
   DIALOGUE TAB STYLES
   ============================================================ */

.dialogue-header {
    margin-bottom: 16px;
}

.dialogue-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

/* 2×2 Grid */
.dialogue-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

/* Speaker Panel Card */
.speaker-panel {
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: opacity 0.3s ease, border-color 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Left accent border per speaker */
.speaker-panel::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    border-radius: 16px 0 0 16px;
}
.speaker-panel.speaker-1::before { background: #3b82f6; }
.speaker-panel.speaker-2::before { background: #8b5cf6; }
.speaker-panel.speaker-3::before { background: #10b981; }
.speaker-panel.speaker-4::before { background: #f59e0b; }

/* Disabled state */
.speaker-panel.disabled {
    opacity: 0.45;
}
.speaker-panel.disabled .speaker-textarea,
.speaker-panel.disabled .speaker-voice-select,
.speaker-panel.disabled .speaker-emotion-select {
    pointer-events: none;
    cursor: not-allowed;
}

/* Speaker Header */
.speaker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Speaker Badge */
.speaker-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}
.speaker-badge.s1 { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.speaker-badge.s2 { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.speaker-badge.s3 { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.speaker-badge.s4 { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

/* Speaker Textarea */
.speaker-textarea {
    width: 100%;
    min-height: 110px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    line-height: 1.5;
}
.speaker-textarea:focus {
    border-color: var(--accent-blue);
}
body.light-mode .speaker-textarea {
    background: rgba(0,0,0,0.03);
    color: var(--text-primary);
}

/* Speaker Controls row */
.speaker-controls {
    display: flex;
    gap: 8px;
}

.speaker-voice-select,
.speaker-emotion-select {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}
.speaker-voice-select:focus,
.speaker-emotion-select:focus {
    border-color: var(--accent-blue);
}
body.light-mode .speaker-voice-select,
body.light-mode .speaker-emotion-select {
    background: rgba(0,0,0,0.04);
    color: var(--text-primary);
}

/* Individual speaker audio */
.speaker-audio-wrap {
    margin-top: 4px;
}
.speaker-audio-player {
    width: 100%;
    height: 36px;
}

/* Toggle Switch (CSS-only) */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 34px;
    transition: background 0.3s;
    border: 1px solid var(--border-color);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    left: 2px; top: 2px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.stream-control {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
}

.stream-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Generate Bar */
.dialogue-generate-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-radius: 12px;
    margin-bottom: 16px;
    background: var(--panel-dark);
}

.diag-char-info {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Combined Output Panel */
.dialogue-output {
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 16px;
    animation: fadeIn 0.4s ease-out;
}

.dialogue-output-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.dialogue-output-label i {
    color: var(--accent-blue);
}

/* Speaker generating state */
.speaker-panel.generating {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59,130,246,0.3);
}

/* Progress indicator inside panel */
.speaker-progress {
    font-size: 12px;
    color: var(--accent-blue);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: fadeIn 0.2s;
}

/* Responsive: stack to 1 column on narrow */
@media (max-width: 720px) {
    .dialogue-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   VOICE HISTORY TAB STYLES
   ============================================================ */

/* Toolbar */
.history-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.history-search-wrap {
    position: relative;
    flex: 1;
    min-width: 160px;
}
.history-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 13px;
    pointer-events: none;
}
.history-search-input {
    width: 100%;
    padding: 9px 12px 9px 34px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
.history-search-input:focus { border-color: var(--accent-blue); }
body.light-mode .history-search-input { background: rgba(0,0,0,0.04); color: var(--text-primary); }

/* Filter chips */
.history-filter-chips {
    display: flex;
    gap: 6px;
}
.hist-chip {
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.hist-chip.active {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

/* Actions bar */
.history-actions-bar {
    display: flex;
    gap: 8px;
    align-items: center;
}
.history-clear {
    color: #ef4444 !important;
}
.history-clear:hover { background: rgba(239,68,68,0.08); }

/* History list */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* History card */
.history-card {
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    animation: fadeIn 0.25s ease-out;
}
.history-card.playing {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}

/* Type icon */
.history-type-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.history-type-icon.tts   { background: rgba(59,130,246,0.15); color: #60a5fa; }
.history-type-icon.dialogue { background: rgba(139,92,246,0.15); color: #a78bfa; }

/* Card body */
.history-card-body {
    flex: 1;
    min-width: 0;
}
.history-card-title {
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}
.history-type-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.history-type-badge.tts      { background: rgba(59,130,246,0.15); color: #60a5fa; }
.history-type-badge.dialogue { background: rgba(139,92,246,0.15); color: #a78bfa; }

.history-card-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.history-card-meta i { font-size: 11px; }

.history-card-text {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

/* Playing equalizer animation */
.history-wave {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 16px;
}
.history-wave span {
    display: block;
    width: 3px;
    background: var(--accent-blue);
    border-radius: 2px;
    animation: histBar 0.6s ease-in-out infinite alternate;
}
.history-wave span:nth-child(1) { animation-delay: 0s;    height: 6px; }
.history-wave span:nth-child(2) { animation-delay: 0.1s;  height: 12px; }
.history-wave span:nth-child(3) { animation-delay: 0.2s;  height: 8px; }
.history-wave span:nth-child(4) { animation-delay: 0.15s; height: 14px; }
.history-wave span:nth-child(5) { animation-delay: 0.05s; height: 6px; }

@keyframes histBar {
    from { transform: scaleY(0.5); }
    to   { transform: scaleY(1.5); }
}

/* Card actions */
.history-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.hist-action-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: rgba(255,255,255,0.04);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.hist-action-btn:hover { background: rgba(255,255,255,0.1); color: white; }
.hist-action-btn.play  { color: #60a5fa; border-color: rgba(59,130,246,0.3); }
.hist-action-btn.play:hover { background: rgba(59,130,246,0.15); }
.hist-action-btn.delete:hover { background: rgba(239,68,68,0.1); color: #ef4444; border-color: rgba(239,68,68,0.3); }

/* Empty state */
.history-empty {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-secondary);
}
.history-empty i {
    font-size: 48px;
    opacity: 0.25;
    margin-bottom: 16px;
    display: block;
}
.history-empty p {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
    opacity: 0.4;
}
.history-empty span {
    font-size: 13px;
    opacity: 0.5;
}

/* refined tab components */
.cloning-header { margin-bottom: 24px; }
.tab-subtitle { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }

.cloning-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.recording-card, .cloning-details, .upload-zone-card, .transcribe-details {
    padding: 24px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--glass-bg);
}

.recording-indicator {
    color: #ef4444;
    font-weight: 700;
    font-size: 14px;
    text-align: center;
}

.recording-visual {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-blue);
    opacity: 0.3;
}

.btn-large { height: 54px; font-size: 16px; border-radius: 12px; width: 100%; }
.btn-full { width: 100%; height: 48px; }

.premium-input, .premium-select {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: white;
    padding: 12px;
    border-radius: 10px;
    outline: none;
    transition: all 0.2s;
}
.premium-input:focus, .premium-select:focus { border-color: var(--accent-blue); background: rgba(255,255,255,0.08); }

.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.upload-zone-card {
    border: 2px dashed var(--border-color);
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    justify-content: center;
    padding: 60px 24px;
}
.upload-zone-card:hover { border-color: var(--accent-blue); background: rgba(59,130,246,0.05); }
.upload-icon { font-size: 48px; color: var(--accent-blue); margin-bottom: 12px; }
.upload-text { font-size: 14px; color: var(--text-secondary); }

.file-info-badge {
    margin-top: 16px;
    padding: 8px 12px;
    background: rgba(59,130,246,0.15);
    color: #60a5fa;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

.mini-player { width: 100%; height: 36px; border-radius: 8px; }

/* Responsive adjustments */
@media (max-width: 850px) {
    .cloning-container { grid-template-columns: 1fr; }
}

/* ============================================================
   PROFESSIONAL MIXER STYLES
   ============================================================ */

.mixer-panel {
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    border: 1px solid var(--border-color);
}

.mixer-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.mixer-title span { flex: 1; }

.mixer-collapse-btn {
    padding: 4px 8px !important;
    color: var(--text-secondary) !important;
}

/* L/R Meters */
.mixer-meters {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    background: rgba(0,0,0,0.25);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.06);
}

.meter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.meter-label {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-secondary);
    width: 12px;
    text-align: center;
    letter-spacing: 1px;
}

.meter-bar-wrap {
    flex: 1;
    height: 14px;
    background: rgba(255,255,255,0.04);
    border-radius: 4px;
    overflow: visible;
    position: relative;
    border: 1px solid rgba(255,255,255,0.06);
}

.meter-bar {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    background: linear-gradient(to right, #22c55e, #eab308 70%, #ef4444 90%);
    transition: width 0.05s linear;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.meter-peak {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ef4444;
    border-radius: 2px;
    left: 0%;
    transition: left 0.1s ease;
    box-shadow: 0 0 6px #ef4444;
}

.meter-db-scale {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-secondary);
    padding: 0 2px;
    margin-top: 2px;
    padding-left: 22px;
}

/* Mixer Controls grid */
.mixer-controls {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 16px;
    align-items: start;
}

@media (max-width: 900px) {
    .mixer-controls { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
    .mixer-controls { grid-template-columns: 1fr; }
}

/* Toggle group */
.mixer-toggle-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mixer-toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 0;
}

.mixer-toggle-label span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mixer-toggle-label:hover { color: var(--text-primary); }

/* Fader group */
.mixer-fader-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 110px;
}

.fader-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.fader-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fader-slider {
    flex: 1;
    accent-color: var(--accent-blue);
    cursor: pointer;
}

.fader-val {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-blue);
    min-width: 36px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Status bar */
.mixer-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    gap: 10px;
    flex-wrap: wrap;
}

.mixer-peak-badges {
    display: flex;
    gap: 8px;
}

.peak-badge {
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    padding: 3px 10px;
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    color: var(--text-secondary);
    border: 1px solid rgba(255,255,255,0.06);
    letter-spacing: 0.5px;
}

/* Active mic state */
.mixer-panel.recording .mixer-title { color: #ef4444; }
.mixer-panel.recording .meter-bar { box-shadow: 0 0 10px rgba(34,197,94,0.6); }

/* ============================================================
   APM: AUDIO PLAYER MIXER (Professional Studio Output)
   ============================================================ */

.output-panel.glass {
    padding: 24px;
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Collapsed State */
.output-panel.collapsed {
    padding-bottom: 12px;
    gap: 0;
}

.output-panel.collapsed > *:not(.apm-titlebar) {
    display: none !important;
}

#apm-chevron {
    transition: transform 0.3s ease;
}

.output-panel.collapsed #apm-chevron {
    transform: rotate(-90deg);
}

/* Disabled State */
.output-panel.disabled {
    opacity: 0.4;
}

.output-panel.disabled .apm-titlebar .apm-title-actions,
.output-panel.disabled > *:not(.apm-titlebar) {
    pointer-events: none;
    user-select: none;
    filter: grayscale(1);
}

.apm-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.apm-title {
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
}

.apm-title-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.apm-filename {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    font-family: 'Inter', monospace;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.apm-dl {
    padding: 6px 14px !important;
    font-size: 12px !important;
}

/* Waveform Canvas */
.apm-canvas {
    width: 100%;
    height: 80px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Scrubber */
.apm-scrubber-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.apm-time {
    font-size: 12px;
    font-weight: 700;
    font-family: 'Inter', monospace;
    color: var(--text-secondary);
    min-width: 45px;
}

.apm-scrubber-wrap {
    flex: 1;
    height: 24px;
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.apm-scrubber-track {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    position: relative;
    overflow: visible;
}

.apm-scrubber-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-blue);
    border-radius: 3px;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.apm-scrubber-thumb {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
    transition: transform 0.1s ease;
}

.apm-scrubber-wrap:hover .apm-scrubber-thumb {
    transform: translate(-50%, -50%) scale(1.2);
}

/* Transport Controls */
.apm-transport {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    background: rgba(0,0,0,0.15);
    padding: 16px;
    border-radius: 14px;
}

.apm-transport-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.apm-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.apm-btn:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    border-color: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.apm-play-btn {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    border: none;
    font-size: 18px;
}

.apm-play-btn:hover {
    filter: brightness(1.2);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.apm-btn.apm-toggle.active {
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59,130,246,0.3);
}

/* Speed Chips */
.apm-speed-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.apm-ctrl-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.apm-speed-chips {
    display: flex;
    gap: 4px;
}

.apm-chip {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.apm-chip:hover { background: rgba(255,255,255,0.1); }

.apm-chip.active {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

/* Vol + VU Meter */
.apm-vol-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.apm-fader {
    accent-color: var(--accent-blue);
    cursor: pointer;
}

.apm-vu-wrap {
    width: 60px;
    height: 12px;
    background: #000;
    padding: 2px;
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.apm-vu-bar {
    height: 3px;
    width: 0%;
    background: linear-gradient(to right, #22c55e, #eab308 70%, #ef4444 95%);
    transition: width 0.1s linear;
}

.apm-vol-val {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 35px;
    font-variant-numeric: tabular-nums;
}

/* EQ Strip */
.apm-eq-strip {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 24px;
    border-radius: 14px;
}

.apm-eq-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.apm-eq-label {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.apm-eq-fader {
    height: 80px !important;
    width: 30px !important;
    appearance: slider-vertical;
}

.apm-eq-val {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-blue);
}

.apm-divider {
    width: 1px;
    background: var(--border-color);
    margin: 0 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .apm-transport {
        flex-direction: column;
        align-items: flex-start;
    }
    .apm-eq-strip {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Transcription Result Area */
.transcription-result-area {
    border-radius: 16px;
    overflow: hidden;
    animation: fadeIn 0.3s ease-out;
}

.transcription-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-color);
}

.transcription-actions {
    display: flex;
    gap: 8px;
}

#transcription-editor .ql-container {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
}

#transcription-editor .ql-editor {
    padding: 16px;
}

#transcription-editor .ql-editor.ql-blank::before {
    color: var(--text-secondary);
    font-style: normal;
    opacity: 0.5;
}


