/* ============================================
   DioLabs — Основные стили
   ============================================ */

/* === CSS Variables === */
:root {
    --color-bg: #FFFFFF;
    --color-text: #1A1A1A;
    --color-text-secondary: #666666;
    --color-text-muted: #9CA3AF;
    --color-sidebar-bg: #FAFAFA;
    --color-border: #E5E5E5;
    --color-accent: #000000;
    --color-accent-hover: #333333;
    --color-selected: #E8F4FD;
    --color-generated: #4CAF50;
    --color-not-generated: #D0D0D0;
    --color-pause: #FFF3E0;
    --color-error: #EF4444;
    --color-success: #22C55E;
    --color-link: #2563EB;

    --radius-card: 8px;
    --radius-btn: 6px;
    --radius-input: 4px;

    --sidebar-width: 260px;
    --topbar-height: 64px;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
}

a {
    color: var(--color-link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
}

/* === Typography === */
h1 {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
}

h3 {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px 20px;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: var(--color-accent);
    color: #FFFFFF;
}

.btn-primary:hover {
    background: var(--color-accent-hover);
    text-decoration: none;
}

.btn-primary:disabled {
    background: #999;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: #F5F5F5;
    text-decoration: none;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 16px;
}

.btn-full {
    width: 100%;
}

/* === Form === */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    font-family: var(--font-family);
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-input);
    outline: none;
    transition: border-color 0.15s ease;
}

.form-input:focus {
    border-color: var(--color-accent);
}

.form-input::placeholder {
    color: var(--color-text-muted);
}

.form-error {
    margin-top: 12px;
    padding: 10px 14px;
    background: #FEF2F2;
    color: var(--color-error);
    border-radius: var(--radius-input);
    font-size: 14px;
}

.form-note {
    margin-top: 6px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.input-with-icon {
    position: relative;
}

.input-with-icon .form-input {
    padding-right: 44px;
}

.input-icon-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
}

.input-icon-btn:hover {
    color: var(--color-text);
}

/* ============================================
   LANDING PAGE
   ============================================ */

.landing-body {
    background: var(--color-bg);
}

/* Landing Header */
.landing-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--color-border);
}

.landing-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

.landing-header .landing-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.landing-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
}

.landing-logo:hover {
    text-decoration: none;
}

/* Hero */
.hero {
    padding: 140px 0 80px;
    position: relative;
    overflow: hidden;
}

.hero-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 60px;
}

.hero-content {
    max-width: 520px;
    position: relative;
    z-index: 2;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--color-text);
    margin-bottom: 20px;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: 32px;
}

.hero-decoration {
    position: relative;
    width: 340px;
    height: 340px;
    flex-shrink: 0;
}

.hero-circle {
    position: absolute;
    border-radius: 50%;
}

.hero-circle-1 {
    width: 280px;
    height: 280px;
    top: 30px;
    left: 30px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.08), transparent 70%);
    animation: pulse-slow 6s ease-in-out infinite;
}

.hero-circle-2 {
    width: 200px;
    height: 200px;
    top: 80px;
    left: 80px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.12), rgba(236, 72, 153, 0.06), transparent 70%);
    animation: pulse-slow 6s ease-in-out infinite 3s;
}

.hero-wave {
    position: absolute;
    bottom: 80px;
    left: 20px;
    width: 300px;
    opacity: 0.7;
}

@keyframes pulse-slow {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.08);
        opacity: 0.7;
    }
}

/* Features */
.features {
    padding: 80px 0;
    border-top: 1px solid var(--color-border);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
}

.feature-card {
    text-align: center;
    padding: 32px 24px;
}

.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--color-sidebar-bg);
    border-radius: 12px;
    color: var(--color-text);
    margin-bottom: 20px;
}

.feature-title {
    margin-bottom: 10px;
}

.feature-text {
    color: var(--color-text-secondary);
    font-size: 15px;
    line-height: 1.6;
}

/* How it works */
.how-it-works {
    padding: 80px 0;
    border-top: 1px solid var(--color-border);
}

.section-title {
    text-align: center;
    margin-bottom: 48px;
}

.steps-grid {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
}

.step-card {
    text-align: center;
    padding: 24px;
    max-width: 260px;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--color-accent);
    color: #fff;
    border-radius: 50%;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.step-title {
    margin-bottom: 8px;
}

.step-text {
    color: var(--color-text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.step-connector {
    display: flex;
    align-items: center;
    padding-top: 44px;
}

/* Footer */
.landing-footer {
    padding: 32px 0;
    border-top: 1px solid var(--color-border);
    text-align: center;
    color: var(--color-text-muted);
    font-size: 14px;
}

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-body {
    background: var(--color-sidebar-bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

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

.login-logo {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text);
    text-align: center;
    margin-bottom: 8px;
}

.login-title {
    font-size: 18px;
    font-weight: 500;
    text-align: center;
    color: var(--color-text-secondary);
    margin-bottom: 28px;
}

.login-form .btn-full {
    margin-top: 8px;
}

.btn-loader {
    animation: spin 1s linear infinite;
}

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

/* ============================================
   APP LAYOUT (Sidebar + Main)
   ============================================ */

.app-body {
    overflow: hidden;
}

.app-layout {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--color-sidebar-bg);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-top {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--color-border);
}

.sidebar-logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
    display: block;
}

.sidebar-logo:hover {
    text-decoration: none;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--color-text-secondary);
    text-decoration: none;
    border-radius: var(--radius-btn);
    font-size: 14px;
    font-weight: 400;
    transition: all 0.12s ease;
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font-family);
    width: 100%;
    text-align: left;
}

.sidebar-link:hover {
    background: var(--color-border);
    color: var(--color-text);
    text-decoration: none;
}

.sidebar-link.active {
    background: var(--color-bg);
    color: var(--color-text);
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.sidebar-link svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-link.active svg,
.sidebar-link:hover svg {
    opacity: 1;
}

.sidebar-badge {
    margin-left: auto;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-border);
    border-radius: 4px;
    font-size: 14px;
    color: var(--color-text-muted);
    font-weight: 400;
}

.sidebar-bottom {
    padding: 16px 8px 32px 8px;
    border-top: 1px solid var(--color-border);
}

.sidebar-logout {
    color: var(--color-text-muted);
}

.sidebar-logout:hover {
    color: var(--color-error);
}

/* Main Area */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Top Bar */
.top-bar {
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-bar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text);
}

.top-bar-title svg {
    opacity: 0.5;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-bar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-family: var(--font-family);
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.12s ease;
}

.top-bar-btn:hover {
    background: var(--color-sidebar-bg);
    text-decoration: none;
}

.top-bar-btn svg {
    opacity: 0.6;
}

.top-bar-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all 0.12s ease;
}

.top-bar-icon:hover {
    background: var(--color-sidebar-bg);
    color: var(--color-text);
}

/* Page Content */
.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 75px;
}

/* ============================================
   DASHBOARD — «Текст в Речь»
   ============================================ */

.dashboard-layout {
    display: flex;
    gap: 0;
    height: 100%;
}

.dashboard-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 0;
}

.dashboard-right {
    width: 500px;
    min-width: 500px;
    border-left: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Textarea */
.tts-textarea-wrap {
    flex: 1;
    padding: 80px 32px;
    display: flex;
    justify-content: center;
}

.tts-textarea {
    width: 798px;
    height: 100%;
    min-height: 200px;
    border: none;
    outline: none;
    resize: none;
    font-family: var(--font-family);
    font-size: 15px;
    line-height: 1.7;
    color: var(--color-text);
    background: transparent;
}

.tts-textarea::placeholder {
    color: var(--color-text-muted);
}

/* Bottom bar */
.tts-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 32px 30px 32px;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
    flex-shrink: 0;
}

.tts-bottom-left {
    display: flex;
    align-items: center;
}

.credits-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.tts-bottom-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.char-counter {
    font-size: 13px;
    color: var(--color-text-muted);
}

.tts-download-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all 0.12s ease;
}

.tts-download-btn:hover:not(:disabled) {
    background: var(--color-sidebar-bg);
    color: var(--color-text);
}

.tts-download-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Quick Player */
.quick-player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 32px;
    border-top: 1px solid var(--color-border);
    background: var(--color-sidebar-bg);
}

.player-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.12s ease;
}

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

.player-progress-wrap {
    flex: 1;
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.player-progress-bar {
    height: 100%;
    background: var(--color-accent);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.player-time {
    font-size: 13px;
    color: var(--color-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Right panel */
.right-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    padding: 0 20px;
    flex-shrink: 0;
}

.right-tab {
    padding: 14px 16px;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 400;
    color: var(--color-text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.12s ease;
}

.right-tab:hover {
    color: var(--color-text);
}

.right-tab.active {
    color: var(--color-text);
    font-weight: 500;
    border-bottom-color: var(--color-accent);
}

.right-tab-content {
    display: none;
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.right-tab-content.active {
    display: block;
}

.right-section {
    margin-bottom: 20px;
}

.right-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 8px;
}

.form-select {
    width: 100%;
    padding: 10px 12px;
    font-family: var(--font-family);
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-input);
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239CA3AF' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.form-select:focus {
    border-color: var(--color-accent);
}

.right-add-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.right-add-link:hover {
    color: var(--color-text);
    text-decoration: none;
}

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

.history-empty {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 14px;
    padding: 40px 0;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius-btn);
    transition: background 0.1s ease;
}

.history-item:hover {
    background: var(--color-sidebar-bg);
}

.history-item-info {
    flex: 1;
    min-width: 0;
}

.history-item-text {
    display: block;
    font-size: 13px;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-meta {
    display: block;
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.history-item-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-left: 8px;
}

.history-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: all 0.12s ease;
}

.history-btn:hover {
    background: var(--color-border);
    color: var(--color-text);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    background: var(--color-bg);
    border-radius: var(--radius-card);
    width: 100%;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.modal-header h3 {
    font-size: 16px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--color-text);
}

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 24px 20px;
}

/* Page content override for dashboard */
.page-content:has(.dashboard-layout) {
    padding: 0;
    overflow: hidden;
}

/* Stub */
.stub-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.stub-inner {
    text-align: center;
}

.stub-title {
    margin-top: 16px;
    color: var(--color-text-muted);
}

.stub-text {
    margin-top: 8px;
    color: var(--color-text-muted);
    font-size: 14px;
}

/* ============================================
   SETTINGS PAGE
   ============================================ */

.settings-page {
    max-width: 600px;
}

.settings-section {
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--color-border);
}

.settings-section:last-of-type {
    border-bottom: none;
}

.settings-heading {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.settings-hint {
    color: var(--color-text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.settings-actions {
    padding-top: 8px;
}

/* Выбор провайдера TTS (Google / OpenRouter) */
.provider-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.provider-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.provider-option:hover {
    background: var(--color-sidebar-bg);
}

.provider-option:has(input:checked) {
    border-color: var(--color-accent);
    background: var(--color-sidebar-bg);
}

.provider-option input[type="radio"] {
    margin-top: 3px;
    accent-color: var(--color-accent);
    cursor: pointer;
}

.provider-option-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.provider-option-text strong {
    font-size: 14px;
    font-weight: 500;
}

.provider-option-text small {
    font-size: 13px;
    color: var(--color-text-muted);
}

/* Service Account Status */
.sa-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #FEF2F2;
    border-radius: var(--radius-card);
    margin-bottom: 16px;
}

.sa-status.sa-status-ok {
    background: #F0FDF4;
}

.sa-status-icon {
    flex-shrink: 0;
    display: flex;
}

.sa-status-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sa-status-label {
    font-size: 14px;
    font-weight: 500;
}

.sa-status-email {
    font-size: 12px;
    color: var(--color-text-muted);
    word-break: break-all;
}

.sa-upload-btn {
    cursor: pointer;
    display: inline-flex;
    margin-bottom: 8px;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    min-width: 260px;
    max-width: 400px;
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.toast.toast-show {
    transform: translateX(0);
}

.toast-success {
    border-left: 3px solid var(--color-success);
}

.toast-error {
    border-left: 3px solid var(--color-error);
}

.toast-message {
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

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

@media (max-width: 768px) {
    .hero-inner {
        flex-direction: column;
        text-align: center;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-decoration {
        width: 200px;
        height: 200px;
    }

    .hero-circle-1 {
        width: 160px;
        height: 160px;
        top: 20px;
        left: 20px;
    }

    .hero-circle-2 {
        width: 120px;
        height: 120px;
        top: 40px;
        left: 40px;
    }

    .hero-wave {
        width: 160px;
        bottom: 40px;
        left: 10px;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .steps-grid {
        flex-direction: column;
        align-items: center;
    }

    .step-connector {
        transform: rotate(90deg);
        padding-top: 0;
    }

    .sidebar {
        display: none;
    }

    .top-bar-btn span:not(.top-bar-icon) {
        display: none;
    }
}

/* ============================================
   PROMPTS PAGE
   ============================================ */

.prompts-page {
    max-width: 1200px;
    margin: 0 auto;
}

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

.prompts-title {
    font-size: 24px;
    font-weight: 700;
}

.prompts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.prompts-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--color-text-muted);
    text-align: center;
}

/* Prompt Card */
.prompt-card {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    padding: 20px;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.prompt-card:hover {
    border-color: #CCC;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.prompt-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.prompt-card-name {
    font-size: 15px;
    font-weight: 600;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prompt-badge {
    font-size: 11px;
    padding: 2px 8px;
    background: #F0FDF4;
    color: #16A34A;
    border-radius: 10px;
    white-space: nowrap;
    font-weight: 500;
}

.prompt-card-text {
    font-size: 13px;
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    min-height: 40px;
}

.prompt-card-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

/* Icon Buttons */
.btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-icon:hover {
    background: #F5F5F5;
    color: var(--color-text);
    border-color: #CCC;
}

.btn-icon-danger:hover {
    background: #FEF2F2;
    color: #DC2626;
    border-color: #FECACA;
}

/* Danger Button */
.btn-danger {
    background: #DC2626;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius-button);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-danger:hover {
    background: #B91C1C;
}

/* Prompt textarea in modal */
.prompt-textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    padding: 20px;
}

.modal-card {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-card-sm {
    max-width: 400px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 0;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 4px;
    border-radius: 4px;
    transition: color 0.15s;
}

.modal-close:hover {
    color: var(--color-text);
}

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 24px 20px;
}

/* ============================================
   STUDIO PAGE
   ============================================ */

.studio-page {
    max-width: 1200px;
    margin: 0 auto;
}

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

.studio-title {
    font-size: 24px;
    font-weight: 700;
}

.projects-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.projects-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 60px 20px;
    color: var(--color-text-muted);
    text-align: center;
}

.projects-empty-hint {
    font-size: 13px;
    max-width: 380px;
    line-height: 1.5;
}

/* Project Row */
.project-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-card);
    text-decoration: none;
    color: inherit;
    transition: background 0.12s ease;
}

.project-row:hover {
    background: #F5F5F5;
    text-decoration: none;
}

.project-row-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F0F0F0;
    border-radius: 8px;
    flex-shrink: 0;
    color: var(--color-text-secondary);
}

.project-row-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.project-row-name {
    font-size: 15px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-row-meta {
    font-size: 12px;
    color: var(--color-text-muted);
}

.project-row-edit,
.project-row-delete {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.project-row:hover .project-row-edit,
.project-row:hover .project-row-delete {
    opacity: 1;
}

/* ============================================
   EDITOR PAGE — /studio/{project_id}
   ============================================ */

/* Full-page layout for editor */
.editor-body {
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    font-family: var(--font-family);
    color: var(--color-text);
    background: var(--color-bg);
}

.editor-layout {
    display: grid;
    grid-template-columns: 60px auto 1fr;
    grid-template-rows: 48px 1fr 56px 70px;
    grid-template-areas:
        "topbar topbar topbar"
        "leftnav sidepanel content"
        "player player player"
        "editorfooter editorfooter editorfooter";
    height: 100vh;
    overflow: hidden;
}

.editor-layout.no-panel {
    grid-template-columns: 60px 1fr;
    grid-template-areas:
        "topbar topbar"
        "leftnav content"
        "player player"
        "editorfooter editorfooter";
}

/* === Top Bar === */
.editor-top-bar {
    grid-area: topbar;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
    z-index: 10;
}

.editor-top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.editor-project-name {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
    cursor: default;
}

.editor-project-name-input {
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-family);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-input);
    padding: 2px 8px;
    outline: none;
    width: 300px;
}

.editor-project-name-input:focus {
    border-color: var(--color-accent);
}

.editor-top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.editor-credits {
    font-size: 13px;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.editor-export-btn {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-family);
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: background 0.12s ease;
}

.editor-export-btn:hover {
    background: var(--color-accent-hover);
}

/* === Left Nav (icons) === */
.editor-left-nav {
    grid-area: leftnav;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 12px;
    gap: 4px;
    border-right: 1px solid var(--color-border);
    background: var(--color-sidebar-bg);
    z-index: 5;
}

.editor-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 6px;
    width: 52px;
    border-radius: var(--radius-btn);
    cursor: pointer;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    transition: all 0.12s ease;
    border: none;
    background: none;
}

.editor-nav-item:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.editor-nav-item.active {
    background: var(--color-selected);
    color: var(--color-text);
}

.editor-nav-spacer {
    flex: 1;
}

/* === Side Panels Container === */
.editor-side-panels {
    grid-area: sidepanel;
    overflow: hidden;
}

.editor-layout.no-panel .editor-side-panels {
    display: none;
}

.editor-side-panel {
    width: 370px;
    border-right: 1px solid var(--color-border);
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.editor-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    flex-shrink: 0;
}

.editor-panel-title {
    font-size: 14px;
    font-weight: 600;
}

.editor-panel-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.editor-panel-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-input);
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: all 0.12s ease;
}

.editor-panel-btn:hover {
    background: #F5F5F5;
    color: var(--color-text);
    border-color: #CCC;
}

.editor-panel-body {
    overflow-y: auto;
    padding: 12px 16px;
}

/* Panel: Settings */
.editor-setting-group {
    margin-bottom: 16px;
}

.editor-setting-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.editor-setting-select {
    width: 100%;
    padding: 8px 10px;
    font-family: var(--font-family);
    font-size: 13px;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-input);
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239CA3AF' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.editor-setting-select:focus {
    border-color: var(--color-accent);
}

/* Panel: Chapters */
.chapter-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chapter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: background 0.1s ease;
    font-size: 14px;
    color: var(--color-text);
}

.chapter-item:hover {
    background: #F5F5F5;
}

.chapter-item.active {
    background: var(--color-selected);
    font-weight: 500;
}

.chapter-item-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chapter-item-count {
    font-size: 11px;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.chapter-item-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.12s ease;
}

.chapter-item:hover .chapter-item-actions {
    opacity: 1;
}

.chapter-action-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all 0.1s ease;
}

.chapter-action-btn:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.chapter-action-btn.danger:hover {
    background: #FEF2F2;
    color: #DC2626;
}

/* === Content Area === */
.editor-content {
    grid-area: content;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Toolbar */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    min-height: 57px;
    flex-shrink: 0;
}

.toolbar-spacer {
    flex: 1;
}

.editor-generate-btn {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-family);
    background: transparent;
    color: var(--color-text);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-generate-btn:hover {
    background: #F0F0F0;
}

.editor-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: transparent;
}

/* Вертикальный разделитель между кнопками тулбара */
.toolbar-divider {
    width: 1px;
    height: 22px;
    background: var(--color-border);
    flex-shrink: 0;
}

/* Block Editor */
.editor-blocks-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 24px 24px 80px;
}

.editor-blocks {
    max-width: 780px;
    margin: 0 auto;
    min-height: 200px;
}

.paragraph-block {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    position: relative;
}

.paragraph-indicator {
    width: 3px;
    flex-shrink: 0;
    border-radius: 2px;
    margin-right: 12px;
    background: var(--color-not-generated);
    transition: background 0.2s ease;
}

.paragraph-indicator.generated {
    background: var(--color-generated);
}

.paragraph-indicator.generating {
    animation: indicator-pulse 1.8s ease-in-out infinite;
}

@keyframes indicator-pulse {

    0%,
    100% {
        background: var(--color-not-generated);
    }

    50% {
        background: #F9A825;
    }
}

.paragraph-text {
    flex: 1;
    min-height: 24px;
    padding: 6px 8px;
    font-family: var(--font-family);
    font-size: 15px;
    line-height: 1.7;
    color: var(--color-text);
    outline: none;
    border: none;
    border-radius: var(--radius-input);
    word-wrap: break-word;
    overflow-wrap: break-word;
    transition: background 0.12s ease;
}

.paragraph-text:focus {
    background: #FAFAFA;
}

.paragraph-block.selected .paragraph-text {
    background: var(--color-selected);
}

.paragraph-text:empty::before {
    content: attr(data-placeholder);
    color: var(--color-text-muted);
    pointer-events: none;
}

/* Delete button on paragraph (shows on hover) */
.paragraph-delete-btn {
    position: absolute;
    right: -8px;
    top: 4px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    cursor: pointer;
    color: var(--color-text-muted);
    opacity: 0;
    transition: opacity 0.15s ease, color 0.12s ease, border-color 0.12s ease;
    z-index: 2;
}

.paragraph-block:hover .paragraph-delete-btn {
    opacity: 1;
}

.paragraph-delete-btn:hover {
    color: #E53935;
    border-color: #E53935;
}

/* Clear all button in toolbar */
.editor-clear-btn {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-family);
    background: none;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-btn);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.12s ease;
}

.editor-clear-btn:hover {
    color: #E53935;
    border-color: #E53935;
}

.editor-copy-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-btn);
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all 0.12s ease;
}

.editor-copy-btn:hover {
    color: var(--color-accent);
    border-color: var(--color-accent);
}

/* Empty state for editor */
.editor-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--color-text-muted);
    text-align: center;
    gap: 12px;
}

.editor-empty-text {
    font-size: 14px;
}

/* === Player Bar === */
.editor-player {
    grid-area: player;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
    gap: 16px;
    z-index: 10;
}

/* Подвал редактора: таймлайн (шкала + волна + playhead) */
.editor-footer {
    grid-area: editorfooter;
    position: relative;
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
    overflow: hidden;
}

.timeline-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: pointer;
    touch-action: none; /* Перетаскивание playhead без прокрутки страницы */
}

.timeline-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--color-text-muted);
    pointer-events: none;
    background: var(--color-bg);
}

.editor-player-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-player-center {
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-player-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-nav-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: all 0.12s ease;
}

.player-nav-btn:hover {
    background: #F0F0F0;
    color: var(--color-text);
}

.player-main-btn {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.12s ease;
}

.player-main-btn:hover {
    background: var(--color-accent-hover);
}

.player-duration {
    font-size: 13px;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.player-download-link {
    font-size: 13px;
    color: var(--color-text-muted);
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: none;
    font-family: var(--font-family);
    transition: color 0.12s ease;
}

.player-download-link:hover {
    color: var(--color-text);
}

/* Generating indicator */
.paragraph-generating {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--color-text-muted);
}

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

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

/* Chapter rename input */
.chapter-rename-input {
    width: 100%;
    padding: 4px 8px;
    font-family: var(--font-family);
    font-size: 14px;
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-input);
    outline: none;
}

/* ====== Stage 7: Pause blocks ====== */
.pause-block {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    margin: 4px 0 14px 0;
    background: rgba(255, 193, 7, 0.08);
    border: 1px dashed rgba(255, 193, 7, 0.35);
    border-radius: 6px;
    color: #bbb;
    font-size: 13px;
    user-select: none;
}

.pause-block svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.pause-block-text {
    flex: 1;
}

.pause-block-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    padding: 2px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .15s;
}

.pause-block:hover .pause-block-delete {
    opacity: 1;
}

.pause-block-delete:hover {
    color: var(--color-error);
}

/* Pause popup */
.pause-popup {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 6px;
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
    z-index: 100;
}

.pause-popup input {
    width: 70px;
    padding: 5px 8px;
    font-size: 13px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    text-align: center;
}

.pause-popup-label {
    font-size: 13px;
    color: #aaa;
    white-space: nowrap;
}

.pause-popup-insert {
    padding: 5px 12px;
    font-size: 13px;
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.pause-popup-insert:hover {
    opacity: .85;
}

/* Pause toolbar button (иконка вставки паузы) */
.editor-pause-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    color: var(--color-text);
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background .12s ease;
}

.editor-pause-btn:hover {
    background: #F0F0F0;
}

/* ====== Stage 7: Automation toggle ====== */
.automation-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #888;
    font-size: 12px;
    user-select: none;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color .15s;
}

.automation-toggle:hover {
    color: #bbb;
}

.automation-toggle.active {
    color: #16A34A;
}

.automation-toggle .toggle-track {
    width: 32px;
    height: 16px;
    background: #444;
    border-radius: 8px;
    position: relative;
    transition: background .2s;
}

.automation-toggle.active .toggle-track {
    background: #22C55E;
}

.automation-toggle .toggle-thumb {
    width: 12px;
    height: 12px;
    background: #ccc;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: left .2s, background .2s;
}

.automation-toggle.active .toggle-thumb {
    left: 18px;
    background: #fff;
}

/* Stop automation button */
.editor-stop-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    font-size: 13px;
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s;
    animation: pulse-stop 1.5s infinite;
}

.editor-stop-btn:hover {
    background: rgba(255, 107, 107, 0.2);
}

@keyframes pulse-stop {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Pipeline generating indicator on paragraph */
.paragraph-pipeline-pending {
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 11px;
    color: #888;
}

/* ============================================
   DOWNLOADS & HISTORY PAGES
   ============================================ */

.downloads-page {
    max-width: 1200px;
    margin: 0 auto;
}

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

.downloads-title {
    font-size: 24px;
    font-weight: 700;
}

/* Filter buttons */
.downloads-filters {
    display: flex;
    gap: 4px;
    background: var(--color-sidebar-bg);
    border-radius: 8px;
    padding: 3px;
    border: 1px solid var(--color-border);
}

.filter-btn {
    padding: 7px 16px;
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 400;
    color: var(--color-text-secondary);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.filter-btn:hover {
    color: var(--color-text);
}

.filter-btn.active {
    background: var(--color-bg);
    color: var(--color-text);
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Downloads list */
.downloads-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Downloads row */
.downloads-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-radius: var(--radius-card);
    transition: background 0.12s ease;
}

.downloads-row:hover {
    background: var(--color-sidebar-bg);
}

.downloads-row-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-sidebar-bg);
    border-radius: 8px;
    color: var(--color-text-muted);
}

.downloads-row:hover .downloads-row-icon {
    background: var(--color-border);
}

.downloads-row-main {
    flex: 1;
    min-width: 0;
}

.downloads-row-text {
    font-size: 14px;
    font-weight: 400;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.downloads-row-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    font-size: 12px;
    color: var(--color-text-muted);
    flex-wrap: wrap;
}

.downloads-meta-sep {
    color: var(--color-border);
}

.downloads-meta-source {
    color: var(--color-text-secondary);
}

/* Action buttons */
.downloads-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.downloads-action-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: all 0.15s ease;
    text-decoration: none;
}

.downloads-action-btn:hover {
    background: var(--color-bg);
    color: var(--color-text);
    border-color: #CCC;
    text-decoration: none;
}

.downloads-action-btn.playing {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}

.downloads-action-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Empty state */
.downloads-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 80px 20px;
    color: var(--color-text-muted);
    text-align: center;
}

.downloads-empty p {
    font-size: 16px;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-top: 6px;
}

.downloads-empty-hint {
    font-size: 13px;
    color: var(--color-text-muted);
}

/* Load more */
.downloads-load-more {
    display: flex;
    justify-content: center;
    padding: 24px 0;
}

/* Header right side (filters + clear all) */
.downloads-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Danger outline button (Очистить всё) */
.btn-danger-outline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 500;
    color: #DC2626;
    background: transparent;
    border: 1px solid #FECACA;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-danger-outline:hover {
    background: #FEF2F2;
    border-color: #DC2626;
}

/* Delete action button (trash icon on rows) */
.downloads-action-delete:hover {
    color: #DC2626;
    border-color: #FECACA;
    background: #FEF2F2;
}

/* Small modal card */
.modal-card-sm {
    max-width: 400px;
}

/* === Export Files Panel === */
.export-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}

.export-item:last-child {
    border-bottom: none;
}

.export-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4CAF50;
}

.export-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.export-duration {
    font-size: 14px;
    font-weight: 600;
    color: #3a3a3a;
    line-height: 1.2;
}

.export-meta {
    font-size: 11px;
    color: #999;
    line-height: 1.3;
}

.export-download {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    border-radius: 6px;
    transition: color 0.15s ease, background 0.15s ease;
}

.export-download:hover {
    color: #1A1A1A;
    background: #F0F0F0;
}

/* === Variations Panel === */
.editor-panel-divider {
    height: 1px;
}

.variations-empty {
    color: #999;
    font-size: 12px;
    padding: 8px 15px;
    margin: 0;
}

.variation-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 15px;
    border-radius: 0px;
    transition: background 0.12s ease;
}

.variation-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.variation-active {
    background: rgba(74, 144, 226, 0.08);
}

.variation-active:hover {
    background: rgba(74, 144, 226, 0.12);
}

.variation-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.variation-name {
    font-size: 12px;
    font-weight: 500;
    color: #3a3a3a;
    line-height: 1.3;
}

.variation-active .variation-name {
    color: var(--color-accent);
}

.variation-meta {
    font-size: 11px;
    color: #999;
    line-height: 1.3;
}

.variation-btn {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 2px solid #999999;
    border-radius: 50px;
    color: #676262;
    cursor: pointer;
    transition: all 0.12s ease;
}

.variation-btn:hover {
    color: #333;
    border-color: #aaa;
    background: #f5f5f5;
}

.variation-btn-play:hover {
    color: var(--color-accent);
    border-color: var(--color-accent);
}

.variation-btn-apply:hover {
    color: #4CAF50;
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.06);
}