/* ============================================
   SJ88 TiktokAi2026 WebApp — Design System
   Modern dark theme with glassmorphism
   ============================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ---------- CSS Variables ---------- */
:root {
    /* Background layers */
    --bg-deep:       #030a14;
    --bg-base:       #071426;
    --bg-surface:    #0d1b32;
    --bg-elevated:   #122444;
    --bg-card:       rgba(13, 27, 50, 0.7);
    --bg-glass:      rgba(13, 27, 50, 0.45);

    /* Borders */
    --border-subtle: rgba(59, 130, 246, 0.12);
    --border-default: rgba(59, 130, 246, 0.2);
    --border-strong: rgba(59, 130, 246, 0.35);

    /* Text */
    --text-primary:   #e6edf5;
    --text-secondary: #94a3b8;
    --text-muted:     #64748b;
    --text-inverted:  #0f172a;

    /* Accents */
    --accent-gold:    #ffd84d;
    --accent-gold-dim: rgba(255, 216, 77, 0.15);
    --accent-blue:    #3b82f6;
    --accent-blue-dim: rgba(59, 130, 246, 0.15);
    --accent-cyan:    #22d3ee;
    --accent-cyan-dim: rgba(34, 211, 238, 0.15);
    --accent-purple:  #a78bfa;
    --accent-purple-dim: rgba(167, 139, 250, 0.15);

    /* Status */
    --success:        #42d392;
    --success-dim:    rgba(66, 211, 146, 0.15);
    --error:          #ff6b7a;
    --error-dim:      rgba(255, 107, 122, 0.12);
    --warn:           #ffbd59;
    --warn-dim:       rgba(255, 189, 89, 0.12);
    --info:           #60a5fa;
    --info-dim:       rgba(96, 165, 250, 0.12);

    /* Layout */
    --sidebar-width:  280px;
    --header-height:  72px;
    --radius-sm:      8px;
    --radius-md:      12px;
    --radius-lg:      18px;
    --radius-xl:      24px;

    /* Shadows */
    --shadow-card:    0 4px 24px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(0, 0, 0, 0.2);
    --shadow-elevated: 0 8px 40px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-glow-gold: 0 0 20px rgba(255, 216, 77, 0.15);
    --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.15);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-main);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { color: var(--accent-cyan); }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.4); }

/* ---------- App Shell ---------- */
.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ---------- Auth Screen ---------- */
.auth-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 15%, rgba(59, 130, 246, 0.22), transparent 36%),
        radial-gradient(circle at 85% 10%, rgba(34, 211, 238, 0.16), transparent 30%),
        radial-gradient(circle at 80% 80%, rgba(167, 139, 250, 0.16), transparent 36%),
        linear-gradient(180deg, #030a14 0%, #071426 100%);
}

.auth-card {
    width: 100%;
    max-width: 430px;
    background: rgba(13, 27, 50, 0.82);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 28px 24px 24px;
    box-shadow: var(--shadow-elevated);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.auth-brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-gold), #ff9500);
    display: grid;
    place-items: center;
    font-size: 20px;
    box-shadow: var(--shadow-glow-gold);
}

.auth-brand h1 {
    font-size: 19px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.auth-brand p {
    margin-top: 3px;
    font-size: 13px;
    color: var(--text-muted);
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 18px;
}

.auth-tab {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: rgba(59, 130, 246, 0.05);
    color: var(--text-secondary);
    padding: 9px 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.auth-tab:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.auth-tab.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(37, 99, 235, 0.12));
    color: var(--text-primary);
    border-color: rgba(59, 130, 246, 0.45);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.auth-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.auth-field input {
    width: 100%;
    background: rgba(15, 23, 42, 0.76);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 11px 12px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.auth-field input::placeholder {
    color: var(--text-muted);
}

.auth-field input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

.auth-remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
    font-size: 13px;
    color: var(--text-secondary);
    -webkit-user-select: none;
    user-select: none;
}

.auth-remember input {
    width: 15px;
    height: 15px;
    accent-color: var(--accent-blue);
}

.auth-submit {
    width: 100%;
    justify-content: center;
    padding: 11px 16px;
    margin-top: 6px;
}

.auth-error {
    margin-top: 2px;
    font-size: 12px;
    border: 1px solid rgba(255, 107, 122, 0.38);
    background: rgba(255, 107, 122, 0.12);
    color: #ffd0d6;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: linear-gradient(180deg, #0a1628 0%, #0d1e38 100%);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-normal);
    z-index: 100;
}

.sidebar-backdrop {
    display: none;
}

.sidebar-header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-gold), #ff9500);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: var(--shadow-glow-gold);
}

.sidebar-logo-text h1 {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.sidebar-logo-text span {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 12px 12px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin: 2px 0;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    position: relative;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    -webkit-user-select: none;
    user-select: none;
}

.nav-item:hover {
    background: rgba(59, 130, 246, 0.08);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.25);
    color: var(--text-primary);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--accent-blue);
    border-radius: 0 3px 3px 0;
}

.nav-item.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--accent-blue-dim);
    color: var(--accent-blue);
}

.nav-badge.gold {
    background: var(--accent-gold-dim);
    color: var(--accent-gold);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-subtle);
}

.sidebar-footer-text {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

/* ---------- Main Area ---------- */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-base);
}

/* ---------- Header ---------- */
.header {
    height: var(--header-height);
    min-height: var(--header-height);
    background: linear-gradient(180deg, rgba(10, 22, 40, 0.95), rgba(10, 22, 40, 0.8));
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-menu-btn {
    display: none;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--border-default);
    background: rgba(59, 130, 246, 0.1);
    color: var(--text-primary);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: rgba(59, 130, 246, 0.18);
    border-color: var(--border-strong);
}

.header-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.header-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 400;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 8px 5px 11px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.42);
    border: 1px solid var(--border-subtle);
}

.header-user-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
}

.header-user-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-user-role {
    margin-top: 1px;
    font-size: 10px;
    color: var(--text-muted);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--success-dim);
    border: 1px solid rgba(66, 211, 146, 0.2);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--success);
}

.header-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.header-credit {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--accent-gold-dim);
    border: 1px solid rgba(255, 216, 77, 0.2);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-gold);
}

/* ---------- Content Area ---------- */
.content-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 28px;
    background: radial-gradient(ellipse at 20% 0%, rgba(59, 130, 246, 0.04) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 100%, rgba(167, 139, 250, 0.03) 0%, transparent 60%),
                var(--bg-base);
}

/* ---------- Page Header ---------- */
.page-header {
    margin-bottom: 28px;
}

.page-header h2 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--accent-gold) 0%, #ff9500 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* ---------- Stats Grid ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.stat-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card.gold::before { background: linear-gradient(90deg, var(--accent-gold), #ff9500); opacity: 1; }
.stat-card.blue::before { background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan)); opacity: 1; }
.stat-card.green::before { background: linear-gradient(90deg, var(--success), #2dd4bf); opacity: 1; }
.stat-card.purple::before { background: linear-gradient(90deg, var(--accent-purple), #ec4899); opacity: 1; }

.stat-icon {
    font-size: 28px;
    margin-bottom: 12px;
}

.stat-value {
    font-size: 30px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
    padding: 2px 8px;
    border-radius: 12px;
}

.stat-change.up {
    color: var(--success);
    background: var(--success-dim);
}

.stat-change.down {
    color: var(--error);
    background: var(--error-dim);
}

/* ---------- Dashboard Analytics ---------- */
.dashboard-analytics-grid {
    margin-bottom: 20px;
}

.analytics-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.analytics-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.legend-dot.jobs {
    background: linear-gradient(135deg, #3b82f6, #22d3ee);
}

.legend-dot.tts {
    background: linear-gradient(135deg, #f59e0b, #facc15);
}

.analytics-bars {
    min-height: 170px;
    padding: 10px 0 2px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
}

.analytics-day {
    min-width: 34px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.analytics-day-bars {
    height: 126px;
    width: 26px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
}

.analytics-bar {
    width: 9px;
    border-radius: 5px 5px 2px 2px;
    min-height: 4px;
    transition: height var(--transition-normal);
}

.analytics-bar.jobs {
    background: linear-gradient(180deg, #60a5fa, #2563eb);
}

.analytics-bar.tts {
    background: linear-gradient(180deg, #facc15, #f59e0b);
}

.analytics-day-label {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}

.analytics-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.analytics-kpi {
    padding: 11px 12px;
    border-radius: var(--radius-md);
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.analytics-kpi .kpi-label {
    font-size: 11px;
    color: var(--text-muted);
}

.analytics-kpi .kpi-value {
    margin-top: 4px;
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.analytics-mode-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.analytics-mode-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.analytics-mode-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
}

.analytics-mode-name {
    color: var(--text-primary);
    font-weight: 600;
}

.analytics-mode-count {
    color: var(--text-muted);
}

.analytics-mode-bar {
    height: 7px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.12);
    overflow: hidden;
}

.analytics-mode-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #3b82f6, #22d3ee);
}

/* ---------- Panel / Card ---------- */
.panel {
    background: var(--bg-card);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.panel-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-body {
    padding: 20px 24px;
}

.panel-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ---------- Grid Layouts ---------- */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

@media (max-width: 1200px) {
    .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ---------- Job Row ---------- */
.job-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition-fast);
}

.job-row:last-child { border-bottom: none; }
.job-row:hover { background: rgba(59, 130, 246, 0.04); margin: 0 -24px; padding-left: 24px; padding-right: 24px; }

.job-name {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.job-mode {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.job-mode.ai_autocut { background: var(--error-dim); color: var(--error); }
.job-mode.smart_auto { background: var(--accent-gold-dim); color: var(--accent-gold); }
.job-mode.easy_vdo { background: var(--accent-purple-dim); color: var(--accent-purple); }
.job-mode.tts { background: var(--accent-cyan-dim); color: var(--accent-cyan); }

/* ---------- Jobs Batch Controls ---------- */
.jobs-batch-bar {
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.jobs-batch-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.jobs-batch-controls label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.jobs-batch-controls .form-select {
    min-width: 80px;
    width: 90px;
}

.jobs-batch-result {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ---------- Status Badge ---------- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 14px;
}

.status-badge.done    { background: var(--success-dim); color: var(--success); }
.status-badge.running { background: var(--info-dim); color: var(--info); }
.status-badge.error   { background: var(--error-dim); color: var(--error); }
.status-badge.created { background: rgba(148, 163, 184, 0.12); color: var(--text-secondary); }
.status-badge.queued  { background: var(--warn-dim); color: var(--warn); }
.status-badge.cancelled { background: rgba(148, 163, 184, 0.08); color: var(--text-muted); }

.status-badge .badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-badge.running .badge-dot {
    animation: pulse 1.5s infinite;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-user-select: none;
    user-select: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    color: white;
    border-color: rgba(59, 130, 246, 0.5);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f8ff7, var(--accent-blue));
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-default);
}

.btn-outline:hover {
    background: rgba(59, 130, 246, 0.08);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--text-primary);
    border-color: var(--border-default);
}

/* ---------- Progress Bar ---------- */
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
    border-radius: 3px;
    transition: width var(--transition-slow);
}

/* ---------- Timeline / Feed ---------- */
.feed-item {
    display: flex;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
}

.feed-item:last-child { border-bottom: none; }

.feed-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.feed-dot.info  { background: var(--accent-blue); }
.feed-dot.warn  { background: var(--warn); }
.feed-dot.error { background: var(--error); }
.feed-dot.ok    { background: var(--success); }

.feed-content { flex: 1; }
.feed-content strong { color: var(--text-primary); }
.feed-time { color: var(--text-muted); font-size: 11px; margin-top: 4px; }

/* ---------- Incident Row ---------- */
.incident-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.incident-row:last-child { border-bottom: none; }

.incident-icon { font-size: 18px; flex-shrink: 0; }
.incident-message { flex: 1; font-size: 13px; color: var(--text-primary); }
.incident-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ---------- Monitor System Cards ---------- */
.system-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

.system-item {
    background: rgba(7, 20, 38, 0.6);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
}

.system-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.system-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ---------- Theme Customizer ---------- */
.theme-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 14px;
}

.theme-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.theme-field-full {
    grid-column: 1 / -1;
}

.theme-scale-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-scale-row input[type="range"] {
    width: 100%;
    accent-color: var(--accent-blue);
}

.theme-scale-row span {
    min-width: 56px;
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 700;
}

.theme-preview-row {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.theme-preview-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 11px;
    font-weight: 700;
}

.theme-preview-chip.chip-primary { background: var(--accent-blue-dim); color: var(--accent-blue); border-color: var(--border-default); }
.theme-preview-chip.chip-cyan { background: var(--accent-cyan-dim); color: var(--accent-cyan); border-color: var(--border-default); }
.theme-preview-chip.chip-gold { background: var(--accent-gold-dim); color: var(--accent-gold); border-color: rgba(255, 216, 77, 0.3); }
.theme-preview-chip.chip-purple { background: var(--accent-purple-dim); color: var(--accent-purple); border-color: rgba(167, 139, 250, 0.32); }

/* ---------- Language Settings ---------- */
.language-settings-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.language-settings-row label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}

.language-settings-row .form-select {
    min-width: 180px;
    width: 220px;
}

/* ---------- Share Preset ---------- */
.share-profile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.share-profile-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.share-profile-actions {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---------- Template Library ---------- */
.template-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.template-toolbar label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.template-toolbar .form-select {
    max-width: 180px;
}

.template-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 14px;
}

.template-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.template-field-full {
    grid-column: 1 / -1;
}

.template-list {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.template-item {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.45);
    padding: 12px;
}

.template-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.template-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border: 1px solid transparent;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.template-badge.tts { color: var(--accent-cyan); background: var(--accent-cyan-dim); border-color: rgba(34, 211, 238, 0.3); }
.template-badge.easyvdo { color: var(--accent-gold); background: var(--accent-gold-dim); border-color: rgba(255, 216, 77, 0.3); }
.template-badge.aicommand { color: var(--accent-purple); background: var(--accent-purple-dim); border-color: rgba(167, 139, 250, 0.35); }

.template-time {
    font-size: 11px;
    color: var(--text-muted);
}

.template-title {
    margin-top: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.template-snippet {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    white-space: pre-wrap;
}

.template-actions {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ---------- Notification Settings ---------- */
.notify-settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.notify-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    -webkit-user-select: none;
    user-select: none;
}

.notify-toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-blue);
}

.notify-status-text {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
    padding-top: 10px;
}

/* ---------- Density: Compact ---------- */
body.density-compact .header {
    padding-top: 0;
    padding-bottom: 0;
}

body.density-compact .content-area {
    padding: 20px;
}

body.density-compact .panel-header {
    padding: 14px 18px;
}

body.density-compact .panel-body {
    padding: 14px 18px;
}

body.density-compact .stat-card {
    padding: 16px 18px;
}

body.density-compact .job-row {
    padding-top: 10px;
    padding-bottom: 10px;
}

/* ---------- Connection Status ---------- */
.ws-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.ws-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
}

.ws-dot.connected { background: var(--success); }
.ws-dot.disconnected { background: var(--error); }

/* ---------- Toast ---------- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-elevated);
    animation: slideIn 0.3s ease-out;
    max-width: 380px;
}

.toast.success { background: rgba(66, 211, 146, 0.15); border: 1px solid rgba(66, 211, 146, 0.3); }
.toast.error   { background: rgba(255, 107, 122, 0.15); border: 1px solid rgba(255, 107, 122, 0.3); }
.toast.info    { background: rgba(59, 130, 246, 0.15); border: 1px solid rgba(59, 130, 246, 0.3); }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(30px); }
}

/* ---------- Loading Skeleton ---------- */
.skeleton {
    background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-elevated) 50%, var(--bg-surface) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .mobile-menu-btn {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(78vw, 280px);
        min-width: min(78vw, 280px);
        transform: translateX(-105%);
        transition: transform var(--transition-normal);
        box-shadow: var(--shadow-elevated);
        z-index: 110;
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(3, 10, 20, 0.58);
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--transition-fast);
        z-index: 105;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .main-area {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .content-area { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .theme-settings-grid { grid-template-columns: 1fr; }
    .theme-field-full { grid-column: auto; }
    .template-form-grid { grid-template-columns: 1fr; }
    .template-field-full { grid-column: auto; }
    .template-toolbar { flex-wrap: wrap; }
    .language-settings-row .form-select { width: 100%; max-width: 220px; }
    .share-profile-actions .btn { flex: 1 1 auto; justify-content: center; }
    .jobs-batch-controls { width: 100%; }
    .jobs-batch-controls .form-select { width: 100%; max-width: 120px; }
    .analytics-kpi-grid { grid-template-columns: 1fr; }
    .analytics-bars { min-height: 156px; }
    .analytics-day { min-width: 30px; }
    .analytics-day-bars { height: 112px; width: 24px; }
    .header-subtitle { display: none; }
    .header {
        height: auto;
        min-height: var(--header-height);
        padding: 10px 14px;
        align-items: flex-start;
        gap: 10px;
    }
    .header-right {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
    .header-user-role {
        display: none;
    }
    .header-credit,
    .header-status {
        padding: 5px 10px;
    }
}

@media (max-width: 600px) {
    .sidebar {
        width: min(86vw, 240px);
        min-width: min(86vw, 240px);
    }
    .stats-grid { grid-template-columns: 1fr; }
    .theme-scale-row { gap: 8px; }
    .theme-scale-row span { min-width: 50px; }
    .template-toolbar .form-select { max-width: 100%; width: 100%; }
    .template-actions .btn { flex: 1 1 auto; justify-content: center; }
    .language-settings-row .form-select { width: 100%; max-width: 100%; }
    .language-settings-row .btn { width: 100%; justify-content: center; }
    .share-profile-actions .btn { width: 100%; justify-content: center; }
    .jobs-batch-controls .btn { flex: 1 1 auto; justify-content: center; }
    .jobs-batch-result { width: 100%; }
    .share-target-row { width: 100%; }
    .share-target-btn {
        flex: 1 1 calc(50% - 6px);
        text-align: center;
    }
    .analytics-legend {
        gap: 10px;
        font-size: 11px;
    }
    .analytics-bars {
        gap: 8px;
        min-height: 145px;
    }
    .analytics-day { min-width: 28px; }
    .analytics-day-bars { height: 104px; width: 22px; gap: 3px; }
    .analytics-bar { width: 8px; }
    .analytics-day-label { font-size: 9px; }
    .auth-screen {
        padding: 16px;
    }
    .auth-card {
        padding: 24px 16px 18px;
    }
    .header {
        padding: 10px;
    }
    .header-left {
        min-width: 0;
    }
    .header-title {
        font-size: 17px;
    }
    .header-right {
        gap: 8px;
    }
    .header-status span:last-child,
    .header-credit span:first-child {
        display: none;
    }
    .header-user {
        padding: 4px 6px 4px 8px;
    }
    .header-user-name {
        max-width: 84px;
    }
}

/* ============================================
   Phase 2: AI AutoCut Step Flow
   ============================================ */

/* ---------- Utilities ---------- */
.hidden { display: none !important; }
.view-hidden { display: none; }
.panel-mt { margin-top: 16px; }
.btn-row { margin-top: 20px; display: flex; gap: 12px; align-items: center; }

/* ---------- Form Select ---------- */
.form-select {
    background: var(--bg-deep);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    transition: border-color var(--transition-fast);
}
.form-select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* ---------- Step Indicator ---------- */
.autocut-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 28px;
    padding: 16px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}

.step-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all var(--transition-normal);
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    transition: all var(--transition-normal);
}

.step-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    transition: color var(--transition-normal);
}

.step-line {
    width: 40px;
    height: 2px;
    background: var(--border-subtle);
    transition: background var(--transition-normal);
    flex-shrink: 0;
}

.step-item.active .step-number {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.step-item.active .step-label {
    color: var(--text-primary);
}

.step-item.done .step-number {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.step-item.done .step-label {
    color: var(--success);
}

.step-line.done {
    background: var(--success);
}

/* ---------- Drop Zone ---------- */
.drop-zone {
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-lg);
    padding: 48px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.drop-zone:hover {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.04);
}

.drop-zone.drag-over {
    border-color: var(--accent-cyan);
    background: var(--accent-cyan-dim);
}

.drop-zone-icon { font-size: 48px; margin-bottom: 12px; }
.drop-zone-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.drop-zone-hint { font-size: 13px; color: var(--text-muted); margin-top: 8px; }
.file-input-hidden { display: none; }

/* ---------- Selected Files ---------- */
.selected-files {
    margin-top: 16px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(7, 20, 38, 0.5);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 6px;
}

.file-item-icon { font-size: 18px; flex-shrink: 0; }
.file-item-name { flex: 1; font-size: 13px; font-weight: 500; color: var(--text-primary); }
.file-item-size { font-size: 12px; color: var(--text-muted); }

.upload-actions {
    margin-top: 16px;
    display: flex;
    gap: 12px;
}

/* ---------- Progress Text ---------- */
.progress-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
    text-align: center;
}

/* ---------- Processing Progress ---------- */
.processing-progress-container {
    text-align: center;
    padding: 16px 0;
}

.processing-progress-value {
    font-size: 48px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.progress-bar-lg {
    height: 12px;
    border-radius: 6px;
    margin: 16px 0;
}

.progress-fill-animated {
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan), var(--accent-purple));
    background-size: 200% 100%;
    animation: progress-glow 2s ease infinite;
}

@keyframes progress-glow {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.processing-progress-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ---------- Processing Log ---------- */
.processing-log {
    max-height: 280px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.8;
    background: rgba(3, 10, 20, 0.6);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
}

.log-line {
    padding: 2px 0;
    color: var(--text-secondary);
}

.log-line.success { color: var(--success); }
.log-line.error { color: var(--error); }
.log-line.info { color: var(--accent-cyan); }

/* ---------- Result Summary ---------- */
.result-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.result-item {
    background: rgba(7, 20, 38, 0.6);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.result-item-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
}

.result-item-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ---------- Download Buttons ---------- */
.download-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-user-select: none;
    user-select: none;
}

.btn-download.primary {
    background: linear-gradient(135deg, var(--success), #2dd4bf);
    color: var(--text-inverted);
    box-shadow: 0 4px 16px rgba(66, 211, 146, 0.25);
}

.btn-download.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(66, 211, 146, 0.35);
}

.btn-download.secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-default);
}

.btn-download.secondary:hover {
    background: var(--bg-surface);
    border-color: var(--border-strong);
}

.btn-download.share {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    color: var(--text-inverted);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.28);
}

.btn-download.share:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(34, 211, 238, 0.32);
}

.share-target-row {
    width: 100%;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.share-target-btn {
    border: 1px solid var(--border-default);
    background: rgba(15, 23, 42, 0.74);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.share-target-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
    background: rgba(59, 130, 246, 0.14);
}

/* ---------- Output File List ---------- */
.output-file-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
}

.output-file-row:last-child { border-bottom: none; }

.output-file-icon { font-size: 18px; }
.output-file-name { flex: 1; font-weight: 500; color: var(--text-primary); }
.output-file-size { color: var(--text-muted); font-size: 12px; }
.output-file-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}
.output-file-badge.video { background: var(--accent-purple-dim); color: var(--accent-purple); }
.output-file-badge.report { background: var(--accent-cyan-dim); color: var(--accent-cyan); }
.output-file-badge.other { background: rgba(148, 163, 184, 0.1); color: var(--text-muted); }

/* ---------- Sidebar footer margin ---------- */
.sidebar-footer-mt { margin-top: 8px; }

/* ---------- Utility classes ---------- */
.view-hidden { display: none; }
.hidden { display: none !important; }
.btn-row { display: flex; gap: 12px; margin-bottom: 20px; }

/* ============================================
   Phase 3: Smart Auto + TTS + VEO
   ============================================ */

/* ---------- Smart Auto Sliders ---------- */
.smart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) { .smart-grid { grid-template-columns: 1fr; } }

.smart-param {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.smart-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.smart-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(59, 130, 246, 0.15);
    outline: none;
    transition: background var(--transition-fast);
}

.smart-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    cursor: pointer;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
    transition: transform var(--transition-fast);
}

.smart-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.smart-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    cursor: pointer;
    border: none;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.smart-slider-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-cyan);
    text-align: right;
}

/* ---------- TTS Layout ---------- */
.tts-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
}

@media (max-width: 1100px) { .tts-layout { grid-template-columns: 1fr; } }

.tts-textarea {
    width: 100%;
    min-height: 180px;
    background: var(--bg-deep);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 16px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.7;
    resize: vertical;
    transition: border-color var(--transition-fast);
}

.tts-textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

.tts-textarea::placeholder { color: var(--text-muted); }

.tts-char-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.tts-quick-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.tts-setting-group {
    margin-bottom: 16px;
}

.tts-setting-group:last-of-type { margin-bottom: 0; }

/* TTS History Item */
.tts-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.tts-history-item:last-child { border-bottom: none; }

.tts-history-icon { font-size: 20px; flex-shrink: 0; }

.tts-history-info { flex: 1; min-width: 0; }

.tts-history-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tts-history-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.tts-history-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    background: var(--accent-cyan-dim);
    color: var(--accent-cyan);
}

/* ---------- VEO Queue ---------- */
.veo-add-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.veo-prompt-input {
    min-height: 90px;
}

.veo-queue-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.veo-queue-item:last-child { border-bottom: none; }

.veo-queue-prompt {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.veo-queue-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.veo-badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.veo-badge.pending { background: var(--warn-dim); color: var(--warn); }
.veo-badge.processing { background: var(--info-dim); color: var(--info); }
.veo-badge.done { background: var(--success-dim); color: var(--success); }
.veo-badge.error { background: var(--error-dim); color: var(--error); }
.veo-badge.normal { background: rgba(148, 163, 184, 0.1); color: var(--text-muted); }
.veo-badge.high { background: var(--warn-dim); color: var(--warn); }
.veo-badge.urgent { background: var(--error-dim); color: var(--error); }

/* VEO Success Item */
.veo-success-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.veo-success-item:last-child { border-bottom: none; }

.veo-success-url {
    flex: 1;
    font-size: 13px;
    color: var(--accent-cyan);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- About Text ---------- */
.about-text {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
}

/* ============================================
   Phase 4: Easy VDO + AI Command
   ============================================ */

/* ---------- Easy VDO Mode Grid ---------- */
.evdo-mode-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.evdo-mode-card {
    background: var(--bg-elevated);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}
.evdo-mode-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), transparent);
    opacity: 0;
    transition: opacity var(--transition-normal);
}
.evdo-mode-card:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.15);
}
.evdo-mode-card:hover::before { opacity: 1; }
.evdo-mode-card.active {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.08);
    box-shadow: 0 0 0 1px var(--accent-blue), 0 4px 16px rgba(59, 130, 246, 0.2);
}
.evdo-mode-card.active::before { opacity: 1; }
.evdo-mode-icon {
    font-size: 36px;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}
.evdo-mode-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
}
.evdo-mode-desc {
    font-size: 12px;
    color: var(--text-muted);
    position: relative;
    z-index: 1;
}

/* ---------- Easy VDO Settings ---------- */
.evdo-settings-layout {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 24px;
}
.evdo-settings-left, .evdo-settings-right {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel-note {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Easy VDO history items */
.evdo-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
}
.evdo-history-item:last-child { border-bottom: none; }
.evdo-history-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.evdo-history-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.evdo-history-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
.evdo-history-badge.ai_only        { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.evdo-history-badge.ai_real_audio  { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.evdo-history-badge.ai_real_tts    { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.evdo-history-badge.ai_real_tts_cut { background: rgba(245, 158, 11, 0.15); color: var(--accent-yellow); }
.evdo-history-badge.real_tts_cut   { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.evdo-history-badge.ab_roll        { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.evdo-history-badge.product        { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.evdo-history-badge.tutorial       { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.evdo-history-badge.story          { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.evdo-history-badge.health         { background: rgba(245, 158, 11, 0.15); color: var(--accent-yellow); }
.evdo-history-badge.food           { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.evdo-history-badge.promo          { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }

/* ---------- AI Command Chat ---------- */
.ai-chat-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    align-items: start;
}
.ai-chat-main { min-width: 0; }
.ai-chat-sidebar { min-width: 0; }

.ai-chat-body {
    max-height: 420px;
    min-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px !important;
}
.ai-chat-body::-webkit-scrollbar { width: 6px; }
.ai-chat-body::-webkit-scrollbar-track { background: transparent; }
.ai-chat-body::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 3px; }

.ai-msg {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeSlideUp 0.3s ease-out;
}
.ai-msg-bot { align-self: flex-start; }
.ai-msg-user { align-self: flex-end; flex-direction: row-reverse; }

.ai-msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
}
.ai-msg-user .ai-msg-avatar {
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    border: none;
}

.ai-msg-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    min-width: 0;
}
.ai-msg-user .ai-msg-content {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.3);
}

.ai-msg-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
    word-break: break-word;
}
.ai-msg-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

.ai-chat-input-row {
    display: flex;
    gap: 10px;
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-card);
}
.ai-chat-input {
    flex: 1;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 14px;
    font-family: var(--font-main);
    outline: none;
    transition: border-color var(--transition-fast);
}
.ai-chat-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.ai-chat-input::placeholder { color: var(--text-muted); }

/* AI Quick Commands */
.ai-quick-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.ai-quick-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    padding: 10px 14px;
    font-size: 13px;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}
.ai-quick-btn:hover {
    background: rgba(59, 130, 246, 0.08);
    border-color: var(--accent-blue);
    color: var(--text-primary);
    transform: translateY(-1px);
}

/* AI Info Sidebar */
.ai-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
}
.ai-info-item:last-child { border-bottom: none; }
.ai-info-label {
    font-size: 13px;
    color: var(--text-muted);
}
.ai-info-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

/* AI Command History */
.ai-cmd-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
}
.ai-cmd-item:last-child { border-bottom: none; }
.ai-cmd-text {
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ai-cmd-time {
    font-size: 11px;
    color: var(--text-muted);
}

/* Typing animation */
.ai-typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.ai-typing-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.2s infinite;
}
.ai-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-6px); opacity: 1; }
}
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .evdo-mode-grid { grid-template-columns: repeat(2, 1fr); }
    .evdo-settings-layout { grid-template-columns: 1fr; }
    .ai-chat-layout { grid-template-columns: 1fr; }
    .ai-quick-grid { grid-template-columns: repeat(2, 1fr); }
}
