/* ====================================================
   Voice Studio — ElevenLabs TTS Recording Studio
   Prefix: .vs-
   ==================================================== */

#section-voice-studio.app-section {
    padding: 0;
    max-width: 100%;
    height: 100%;
}

/* ---- Cockpit ---- */
.vs-cockpit {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-body, #f0f4f8);
}

.vs-header {
    padding: 16px 20px 0;
    background: var(--bg-card, #fff);
    border-bottom: 1px solid var(--border-light, #e2e8f0);
}

.vs-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
}

.vs-header p {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--text-muted, #94a3b8);
}

/* ---- Tabs ---- */
.vs-tabs {
    display: flex;
    gap: 0;
    padding: 0 20px;
    background: var(--bg-card, #fff);
    border-bottom: 1px solid var(--border-light, #e2e8f0);
    overflow-x: auto;
}

.vs-tab {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition:
        color 0.15s,
        border-color 0.15s;
    white-space: nowrap;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
}

.vs-tab:hover {
    color: var(--text-primary, #1e293b);
}

.vs-tab.active {
    color: #7c3aed;
    border-bottom-color: #7c3aed;
}

.vs-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    background: #7c3aed;
    color: #fff;
}

/* ---- Tab Content ---- */
.vs-tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
}

.vs-tab-content.active {
    display: flex;
    flex-direction: column;
}

.vs-tab-content.active[data-tab-content='studio'] {
    flex-direction: row;
}

/* ---- Studio Form ---- */
.vs-studio-scroll {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 20px;
}

.vs-studio-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.vs-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.vs-field-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vs-input {
    padding: 9px 12px;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary, #1e293b);
    background: var(--bg-card, #fff);
    transition: border-color 0.15s;
}

.vs-input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.vs-textarea {
    min-height: 120px;
    max-height: 240px;
    resize: vertical;
    line-height: 1.5;
}

.vs-char-info {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
}

.vs-char-info span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* ---- Voice selector ---- */
.vs-voice-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.vs-select {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary, #1e293b);
    background: var(--bg-card, #fff);
    cursor: pointer;
}

.vs-select:focus {
    outline: none;
    border-color: #7c3aed;
}

.vs-btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 8px;
    background: var(--bg-card, #fff);
    cursor: pointer;
    font-size: 16px;
    transition:
        background 0.15s,
        border-color 0.15s;
    flex-shrink: 0;
}

.vs-btn-icon:hover {
    background: #f8fafc;
    border-color: #7c3aed;
}

/* ---- Slider ---- */
.vs-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vs-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: #e2e8f0;
    outline: none;
}

.vs-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #7c3aed;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.vs-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #7c3aed;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.vs-slider-value {
    min-width: 42px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}

/* ---- Radio Group ---- */
.vs-radio-group {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
}

.vs-radio-option {
    flex: 1;
    text-align: center;
}

.vs-radio-option input[type='radio'] {
    display: none;
}

.vs-radio-option label {
    display: block;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary, #64748b);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.vs-radio-option input[type='radio']:checked + label {
    background: var(--bg-card, #fff);
    color: #7c3aed;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    font-weight: 600;
}

/* ---- Collapsible ---- */
.vs-collapsible-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px 0;
    font-family: inherit;
}

.vs-collapsible-toggle:hover {
    color: #7c3aed;
}

.vs-collapsible-toggle .arrow {
    transition: transform 0.2s;
    font-size: 10px;
}

.vs-collapsible-toggle.open .arrow {
    transform: rotate(90deg);
}

.vs-collapsible-body {
    display: none;
    flex-direction: column;
    gap: 12px;
    padding: 8px 0 0 16px;
}

.vs-collapsible-body.open {
    display: flex;
}

/* ---- Generate Button ---- */
.vs-generate-btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition:
        opacity 0.15s,
        transform 0.1s;
    font-family: inherit;
    letter-spacing: 0.3px;
}

.vs-generate-btn:hover:not(:disabled) {
    opacity: 0.92;
    transform: translateY(-1px);
}

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

.vs-generate-btn .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: vs-spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* ---- Result Player ---- */
.vs-result {
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 10px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vs-result-player {
    width: 100%;
}

.vs-result-player audio {
    width: 100%;
    height: 40px;
    border-radius: 6px;
}

.vs-result-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.vs-btn-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #7c3aed;
    background: rgba(124, 58, 237, 0.08);
    border: 1px solid rgba(124, 58, 237, 0.2);
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
    font-family: inherit;
}

.vs-btn-download:hover {
    background: rgba(124, 58, 237, 0.14);
}

.vs-result-meta {
    display: flex;
    gap: 16px;
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
}

/* ---- Gallery ---- */
.vs-gallery-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--bg-card, #fff);
    border-bottom: 1px solid var(--border-light, #e2e8f0);
    flex-wrap: wrap;
}

.vs-gallery-search {
    flex: 1;
    min-width: 180px;
    padding: 8px 12px;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: var(--bg-body, #f0f4f8);
}

.vs-gallery-search:focus {
    outline: none;
    border-color: #7c3aed;
}

.vs-btn-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 7px;
    background: var(--bg-card, #fff);
    cursor: pointer;
    color: var(--text-secondary, #64748b);
    transition:
        border-color 0.15s,
        color 0.15s;
    font-family: inherit;
}

.vs-btn-toolbar:hover {
    border-color: #7c3aed;
    color: #7c3aed;
}

.vs-btn-toolbar.danger:hover {
    border-color: var(--danger, #ef4444);
    color: var(--danger, #ef4444);
}

.vs-gallery-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ---- Recording Card ---- */
.vs-recording-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 10px;
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}

.vs-recording-card:hover {
    border-color: rgba(124, 58, 237, 0.25);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.06);
}

.vs-recording-card.selected {
    border-color: #7c3aed;
    background: rgba(124, 58, 237, 0.02);
}

.vs-recording-check {
    margin-top: 4px;
    width: 16px;
    height: 16px;
    accent-color: #7c3aed;
    cursor: pointer;
    flex-shrink: 0;
}

.vs-recording-body {
    flex: 1;
    min-width: 0;
}

.vs-recording-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vs-recording-meta {
    display: flex;
    gap: 8px;
    margin-top: 3px;
    font-size: 12px;
    color: var(--text-muted, #94a3b8);
    flex-wrap: wrap;
    align-items: center;
}

.vs-recording-meta .sep {
    color: #e2e8f0;
}

.vs-badge-format {
    display: inline-block;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.vs-badge-format.mp3 {
    background: rgba(124, 58, 237, 0.1);
    color: #7c3aed;
}

.vs-badge-format.wav {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

.vs-recording-player {
    margin-top: 8px;
}

.vs-recording-player audio {
    width: 100%;
    height: 32px;
    border-radius: 4px;
}

.vs-recording-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* ---- MMS Export Menu ---- */
.vs-mms-option:hover {
    background: #f1f5f9 !important;
    color: #7c3aed;
}

/* ---- Empty State ---- */
.vs-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    flex: 1;
}

.vs-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.vs-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    margin-bottom: 4px;
}

.vs-empty-desc {
    font-size: 13px;
    color: var(--text-muted, #94a3b8);
}

/* ---- Humanizer ---- */
.vs-humanizer-checks {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.vs-humanizer-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-primary, #1e293b);
    cursor: pointer;
}
.vs-humanizer-check input[type='checkbox'] {
    width: 16px;
    height: 16px;
    accent-color: #7c3aed;
    cursor: pointer;
}
.vs-humanizer-hint {
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
}

/* ---- AI Script Generator Panel ---- */
.vs-ai-panel {
    flex: 1;
    min-width: 0;
    border-left: 1px solid var(--border-light, #e2e8f0);
    background: var(--bg-card, #fff);
    overflow-y: auto;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.vs-ai-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
    display: flex;
    align-items: center;
    gap: 6px;
}

.vs-ai-subtitle {
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
    margin-top: -8px;
}

.vs-ai-textarea {
    width: 100%;
    min-height: 80px;
    max-height: 160px;
    padding: 10px 12px;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary, #1e293b);
    background: var(--bg-body, #f0f4f8);
    resize: vertical;
    line-height: 1.5;
}

.vs-ai-textarea:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.vs-ai-style-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.vs-ai-chip {
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-light, #e2e8f0);
    background: var(--bg-body, #f0f4f8);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-secondary, #64748b);
    transition: all 0.15s;
}

.vs-ai-chip:hover {
    border-color: #7c3aed;
    color: #7c3aed;
}

.vs-ai-chip.active {
    background: #7c3aed;
    color: #fff;
    border-color: #7c3aed;
}

.vs-ai-duration-chips {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
}

.vs-ai-dur {
    flex: 1;
    text-align: center;
    padding: 6px 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary, #64748b);
    border-radius: 6px;
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    transition: all 0.15s;
}

.vs-ai-dur.active {
    background: var(--bg-card, #fff);
    color: #7c3aed;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    font-weight: 600;
}

.vs-ai-variants-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.vs-ai-var-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 8px;
    background: var(--bg-body, #f0f4f8);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-secondary, #64748b);
    transition: all 0.15s;
}

.vs-ai-var-btn.active {
    background: #7c3aed;
    color: #fff;
    border-color: #7c3aed;
}

.vs-ai-generate-btn {
    width: 100%;
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s;
}

.vs-ai-generate-btn:hover:not(:disabled) {
    opacity: 0.92;
}

.vs-ai-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.vs-ai-generate-btn .spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: vs-spin 0.6s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}

.vs-ai-variant {
    background: var(--bg-body, #f0f4f8);
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 10px;
    padding: 12px;
}

.vs-ai-variant-header {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.vs-ai-variant-text {
    font-size: 13px;
    line-height: 1.65;
    color: var(--text-primary, #1e293b);
    white-space: pre-wrap;
}

.vs-ai-variant-meta {
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
    margin-top: 8px;
}

.vs-ai-variant-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.vs-ai-action-btn {
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 6px;
    background: var(--bg-card, #fff);
    cursor: pointer;
    color: var(--text-secondary, #64748b);
    font-family: inherit;
    transition: all 0.15s;
}

.vs-ai-action-btn:hover {
    border-color: #7c3aed;
    color: #7c3aed;
}

.vs-ai-action-btn.primary {
    background: rgba(124, 58, 237, 0.08);
    color: #7c3aed;
    border-color: rgba(124, 58, 237, 0.2);
}

.vs-ai-action-btn.primary:hover {
    background: rgba(124, 58, 237, 0.15);
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .vs-tab-content.active[data-tab-content='studio'] {
        flex-direction: column;
    }

    .vs-ai-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-light, #e2e8f0);
        max-height: 50vh;
    }
}

@media (max-width: 768px) {
    .vs-studio-scroll {
        padding: 12px;
    }

    .vs-gallery-toolbar {
        padding: 10px 12px;
    }

    .vs-gallery-list {
        padding: 8px 12px;
    }

    .vs-tabs {
        padding: 0 12px;
    }

    .vs-recording-card {
        padding: 10px;
    }

    .vs-recording-actions {
        flex-direction: column;
    }
}
