/* HaoQingAi Pro V2 - Modern Dashboard Style */
/* Inspired by modern SaaS dashboard: rounded cards, gradients, soft shadows */

/* Button loading animation */
.pro-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: proSpinBtn 0.6s linear infinite;
    vertical-align: middle;
}
@keyframes proSpinBtn { to { transform: rotate(360deg); } }
.btn-loading { opacity: 0.75; pointer-events: none; }

@keyframes proStepPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 0 14px 5px rgba(99, 102, 241, 0.45); }
}
.pro-step-active {
    animation: proStepPulse 1.2s ease-in-out infinite;
    border-color: var(--accent-primary) !important;
}
@keyframes subtitleCalibratePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 0 8px 3px rgba(99, 102, 241, 0.6); }
}

/* ===== Light Theme (Default) ===== */
:root {
    --bg-body: #f0f4ff;
    --bg-primary: #f0f4ff;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f4f6fb;
    --bg-sidebar: #ffffff;
    --border-color: #e8ecf4;
    --border-active: #6366f1;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-dim: #94a3b8;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-pink: #ec4899;
    --accent-orange: #f97316;
    --accent-green: #10b981;
    --accent-cyan: #06b6d4;
    --accent-red: #ef4444;
    --accent-purple: #6366f1;
    --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
    --gradient-purple: linear-gradient(135deg, #6366f1, #a78bfa);
    --gradient-cyan: linear-gradient(135deg, #06b6d4, #6366f1);
    --gradient-warm: linear-gradient(135deg, #f97316, #ec4899);
    --gradient-danger: linear-gradient(135deg, #ef4444, #dc2626);
    --gradient-card: linear-gradient(145deg, #ffffff 0%, #f8faff 100%);
    --shadow-card: 0 2px 12px rgba(99,102,241,0.06), 0 1px 3px rgba(0,0,0,0.04);
    --shadow-card-hover: 0 8px 30px rgba(99,102,241,0.12), 0 2px 8px rgba(0,0,0,0.06);
    --shadow-btn: 0 2px 8px rgba(99,102,241,0.25);
    --sidebar-width: 200px;
    --sidebar-collapsed: 68px;
    --topbar-height: 56px;
    --radius: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --radius-pill: 50px;
}

/* ===== Dark Theme ===== */
[data-theme="dark"] {
    --bg-body: #0f1129;
    --bg-primary: #0f1129;
    --bg-secondary: #1a1d3a;
    --bg-card: #1e2145;
    --bg-input: #151833;
    --bg-sidebar: #161937;
    --border-color: #2a2d52;
    --border-active: #818cf8;
    --text-primary: #e8ecf4;
    --text-secondary: #94a3b8;
    --text-dim: #5a5e82;
    --accent-primary: #818cf8;
    --accent-secondary: #a78bfa;
    --accent-pink: #f472b6;
    --accent-orange: #fb923c;
    --accent-green: #34d399;
    --accent-cyan: #22d3ee;
    --accent-red: #f87171;
    --accent-purple: #818cf8;
    --gradient-primary: linear-gradient(135deg, #818cf8, #a78bfa);
    --gradient-purple: linear-gradient(135deg, #818cf8, #c4b5fd);
    --gradient-cyan: linear-gradient(135deg, #22d3ee, #818cf8);
    --gradient-warm: linear-gradient(135deg, #fb923c, #f472b6);
    --gradient-danger: linear-gradient(135deg, #f87171, #ef4444);
    --gradient-card: linear-gradient(145deg, #1e2145 0%, #1a1d3a 100%);
    --shadow-card: 0 2px 12px rgba(0,0,0,0.3);
    --shadow-card-hover: 0 8px 30px rgba(0,0,0,0.4);
    --shadow-btn: 0 2px 8px rgba(99,102,241,0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 13px;
    overflow: hidden;
    height: 100vh;
}

/* ===== Top Bar ===== */
.top-bar {
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: rgba(255,255,255,0.85);
}
[data-theme="dark"] .top-bar {
    background: rgba(22,25,55,0.9);
}
.top-left { display: flex; align-items: center; gap: 14px; }
.logo {
    font-size: 17px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.menu-toggle {
    background: none; border: none; color: var(--text-secondary);
    font-size: 18px; cursor: pointer; padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}
.menu-toggle:hover { background: var(--bg-input); color: var(--text-primary); }
.top-right { display: flex; align-items: center; gap: 14px; }
.user-info {
    color: var(--text-secondary); font-size: 13px;
    display: flex; align-items: center; gap: 6px;
    padding: 5px 12px;
    background: var(--bg-input);
    border-radius: var(--radius-pill);
}

/* ===== Layout ===== */
.app-layout {
    display: flex;
    margin-top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 12px 8px;
    overflow-y: auto;
    flex-shrink: 0;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .nav-text { display: none; }

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    font-size: 13px;
    font-weight: 500;
    border-left: none;
}
.nav-item:hover {
    background: rgba(99,102,241,0.08);
    color: var(--text-primary);
    transform: translateX(2px);
}
.nav-item.active {
    background: var(--gradient-primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 16px;
}

/* Page switching */
.page { display: none; }
.page.active { display: block; }
.page-header { margin-bottom: 20px; display: flex; align-items: center; gap: 12px; }
.page-header h2 { font-size: 20px; font-weight: 700; }

/* ===== Synthesis Mode Bar ===== */
.synthesis-mode-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 4px 0 8px;
    flex-shrink: 0;
}
.mode-toggle {
    display: flex;
    background: var(--bg-input);
    border-radius: var(--radius-pill);
    padding: 4px;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}
.mode-btn {
    padding: 7px 18px;
    font-size: 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-pill);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    font-weight: 500;
}
.mode-btn:hover { color: var(--text-primary); background: rgba(99,102,241,0.06); }
.mode-btn.active {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: var(--shadow-btn);
    transform: scale(1.02);
}

/* ===== Workspace Grid ===== */
.workspace-grid {
    display: flex;
    gap: 12px;
    height: calc(100vh - var(--topbar-height) - 60px);
    overflow: hidden;
}
.workspace-left {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
}
.workspace-left-top {
    display: grid;
    grid-template-columns: 1fr 1fr 1.15fr;
    grid-template-rows: 1fr 1fr;
    gap: 14px;
    flex: 1;
    min-height: 0;
}
.workspace-left-top .wk-col { display: contents; }
.workspace-left-top .wk-col:nth-child(1) > .card:nth-child(1) { grid-column: 1; grid-row: 1; }
.workspace-left-top .wk-col:nth-child(1) > .card:nth-child(2) { grid-column: 1; grid-row: 2; }
.workspace-left-top .wk-col:nth-child(2) > .card:nth-child(1) { grid-column: 2; grid-row: 1; }
.workspace-left-top .wk-col:nth-child(2) > .card:nth-child(2) { grid-column: 2; grid-row: 2; }
.workspace-left-top .wk-col:nth-child(3) > .card:nth-child(1) { grid-column: 3; grid-row: 1; }
.workspace-left-top .wk-col:nth-child(3) > .card:nth-child(2) { grid-column: 3; grid-row: 2; }

.workspace-left-top .card { overflow-y: auto; min-height: 0; }

/* Textarea fill remaining space */
.grid-extract { display: flex; flex-direction: column; }
.grid-extract .tab-content.active { display: flex; flex-direction: column; flex: 1; }
.grid-extract .tab-content.active .form-group:last-child { flex: 1; display: flex; flex-direction: column; }
.grid-extract .tab-content.active .form-group:last-child textarea { flex: 1; min-height: 40px; resize: vertical; }
.grid-rewrite { display: flex; flex-direction: column; }
.grid-rewrite .form-group:last-child { flex: 1; display: flex; flex-direction: column; }
.grid-rewrite .form-group:last-child textarea { flex: 1; min-height: 40px; resize: vertical; }

.workspace-left-bottom {
    display: flex;
    gap: 14px;
    flex-shrink: 0;
}
.workspace-left-bottom > .card { flex: 1; min-width: 0; }

.workspace-right {
    width: 330px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.grid-extract, .grid-rewrite, .grid-voice, .grid-digihuman,
.grid-subtitle, .grid-pipbgm, .grid-preview, .grid-cover, .grid-publish {}

/* Preview card fills right side */
.grid-preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.grid-preview .video-result { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.grid-preview .video-result .placeholder-box { flex: 1; }
.grid-preview .video-result video {
    width: 100%; max-height: 100%;
    border-radius: var(--radius-md);
    object-fit: contain;
}

/* Audio result compact */
.audio-result .placeholder-box { padding: 12px 8px; }
.audio-result .placeholder-box .icon { font-size: 24px; margin-bottom: 4px; }
.audio-result .placeholder-box p { font-size: 11px; margin-bottom: 2px; }
.audio-result .placeholder-box small { font-size: 10px; }

/* ===== Cards ===== */
.card {
    background: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow-card);
    font-size: 12px;
    transition: box-shadow 0.3s, transform 0.2s;
}
.card:hover {
    box-shadow: var(--shadow-card-hover);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.card-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}
.card-header h3 .icon-svg {
    color: var(--accent-primary);
}

/* ===== Tabs ===== */
.card-tabs { display: flex; gap: 3px; }
.tab {
    padding: 5px 12px;
    font-size: 11px;
    border: none;
    background: var(--bg-input);
    color: var(--text-secondary);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}
.tab:hover { color: var(--text-primary); background: rgba(99,102,241,0.1); }
.tab.active {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 2px 6px rgba(99,102,241,0.3);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Hot topics */
.hot-topic-item:hover { border-color: var(--accent-primary) !important; background: var(--bg-input) !important; }
#proHotTopicList::-webkit-scrollbar { width: 4px; }
#proHotTopicList::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

/* ===== Forms ===== */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
    font-size: 12px; color: var(--text-secondary); font-weight: 600;
    letter-spacing: 0.01em;
}
.form-row { display: flex; gap: 10px; }
.form-group.half { flex: 1; }

input[type="text"], input[type="number"], input[type="password"],
textarea, select {
    background: var(--bg-input);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 12px;
    outline: none;
    transition: all 0.2s;
    width: 100%;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
textarea { resize: vertical; font-family: inherit; }
select { cursor: pointer; }

.input-row { display: flex; gap: 8px; align-items: center; }
.input-row input, .input-row select { flex: 1; }
.unit { font-size: 11px; color: var(--text-secondary); white-space: nowrap; }

/* ===== Buttons ===== */
.btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    border: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.btn:active { transform: scale(0.96); }

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: var(--shadow-btn);
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 4px 14px rgba(99,102,241,0.35); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
}
.btn-outline:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(99,102,241,0.05);
}

.btn-gradient {
    background: var(--gradient-cyan);
    color: #fff;
    font-weight: 700;
    box-shadow: var(--shadow-btn);
}
.btn-gradient:hover { filter: brightness(1.1); }

.btn-gradient-purple {
    background: var(--gradient-purple);
    color: #fff;
    font-weight: 700;
    box-shadow: var(--shadow-btn);
    border-radius: var(--radius-sm);
}
.btn-gradient-purple:hover {
    filter: brightness(1.08);
    box-shadow: 0 4px 16px rgba(99,102,241,0.35);
    transform: translateY(-1px);
}

.btn-danger-outline {
    background: transparent;
    border: 1.5px solid var(--accent-red);
    color: var(--accent-red);
    border-radius: var(--radius-sm);
}
.btn-danger-outline:hover { background: rgba(239,68,68,0.08); }

.btn-link {
    background: none; border: none;
    color: var(--accent-primary);
    font-size: 12px; cursor: pointer; padding: 0;
    font-weight: 600;
}
.btn-link:hover { text-decoration: underline; }

.btn-sm { padding: 5px 10px; font-size: 11px; border-radius: var(--radius-xs); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.full-width { width: 100%; }

/* ===== Sliders ===== */
.slider-row { display: flex; align-items: center; gap: 8px; }
.slider-row input[type="range"] { flex: 1; }
input[type="range"] {
    -webkit-appearance: none;
    height: 5px;
    background: var(--border-color);
    border-radius: 3px;
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px;
    background: var(--gradient-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(99,102,241,0.3);
}

/* ===== Toggle ===== */
.toggle-label {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--text-secondary); cursor: pointer;
}
.toggle-label input[type="checkbox"] { accent-color: var(--accent-primary); }

/* ===== Radio ===== */
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-row label {
    display: flex; align-items: center; gap: 5px;
    font-size: 12px; color: var(--text-secondary); cursor: pointer;
}
.radio-row input[type="radio"] { accent-color: var(--accent-primary); }

/* ===== Placeholder Box ===== */
.placeholder-box {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 28px 16px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    text-align: center; color: var(--text-dim);
    background: var(--bg-input);
    transition: border-color 0.2s;
}
.placeholder-box:hover { border-color: var(--accent-primary); }
.placeholder-box.small { padding: 16px; }
.placeholder-box .icon { font-size: 36px; margin-bottom: 10px; opacity: 0.4; }
.placeholder-box p { font-size: 12px; margin-bottom: 4px; }
.placeholder-box small { font-size: 11px; }
.placeholder { color: var(--text-dim); font-size: 12px; }

/* Char count */
.char-count { text-align: right; font-size: 11px; color: var(--text-dim); }

/* Subtitle settings */
.subtitle-settings-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Cover options */
.cover-options { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cover-row { display: flex; gap: 8px; }
.cover-item { display: flex; align-items: center; gap: 6px; flex: 1; }
.cover-item span { font-size: 11px; color: var(--text-secondary); white-space: nowrap; }

/* ===== Manage Layout ===== */
.manage-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 18px;
}

/* Item list */
.item-list {
    display: flex; flex-direction: column; gap: 8px;
    max-height: 300px; overflow-y: auto;
}

/* ===== Platform List ===== */
.platform-list { display: flex; flex-direction: column; gap: 10px; }
.platform-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}
.platform-item:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 2px 8px rgba(99,102,241,0.08);
}
.platform-item .status { font-size: 11px; color: var(--text-dim); }

/* ===== Help Content ===== */
.help-content { line-height: 1.8; color: var(--text-secondary); }
.help-content h4 { color: var(--text-primary); margin: 14px 0 8px; font-weight: 700; }
.help-content ol { padding-left: 20px; }
.help-content li { margin-bottom: 5px; }

/* ===== Engine Status ===== */
.engine-status {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; background: var(--bg-input);
    border-radius: var(--radius-sm); font-size: 12px;
    color: var(--text-secondary);
}
.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-dim);
    display: inline-block;
}
.status-dot.running { background: var(--accent-green); box-shadow: 0 0 6px rgba(16,185,129,0.5); }
.status-dot.error { background: var(--accent-red); box-shadow: 0 0 6px rgba(239,68,68,0.5); }

.engine-status-badge {
    font-size: 11px; padding: 3px 12px;
    border-radius: var(--radius-pill);
    background: var(--bg-input); color: var(--text-secondary);
    font-weight: 600;
}
.engine-status-badge.available {
    background: rgba(16,185,129,0.12); color: var(--accent-green);
}
.engine-status-badge.unavailable {
    background: rgba(239,68,68,0.1); color: var(--accent-red);
}

.section-desc {
    font-size: 12px; color: var(--text-secondary); margin: 0 0 12px 0; line-height: 1.6;
}

/* Progress bar */
.preprocess-progress { margin-top: 8px; }
.progress-bar-container {
    width: 100%; height: 6px;
    background: var(--bg-input);
    border-radius: 3px; overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 3px;
    transition: width 0.3s;
}
.progress-text { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* ===== Compact Details (Collapsible) ===== */
.compact-details summary {
    font-size: 12px;
    color: var(--accent-primary);
    cursor: pointer;
    user-select: none;
    padding: 4px 0;
    list-style: none;
    font-weight: 600;
}
.compact-details summary::-webkit-details-marker { display: none; }
.compact-details summary::before { content: '\25B6 '; font-size: 9px; }
.compact-details[open] summary::before { content: '\25BC '; }
.compact-details .details-body { padding-top: 8px; font-size: 12px; }

.audio-result, .video-result, .preview-placeholder { margin-top: 4px; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ===== Responsive ===== */
@media (max-width: 1400px) {
    .workspace-grid { flex-direction: column; height: auto; overflow: visible; }
    .workspace-left { overflow: visible; }
    .workspace-right { width: 100%; }
    .workspace-left-top {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }
    .workspace-left-top .wk-col { display: flex; flex-direction: column; gap: 14px; }
    .workspace-left-top .wk-col > .card { grid-column: auto; grid-row: auto; }
    .workspace-left-bottom { flex-wrap: wrap; }
}
@media (max-width: 900px) {
    .workspace-left-top { grid-template-columns: 1fr; }
    .workspace-left-bottom { flex-direction: column; }
    .sidebar { width: var(--sidebar-collapsed); }
    .sidebar .nav-text { display: none; }
}

/* ===== Theme Toggle ===== */
.theme-toggle {
    background: var(--bg-input);
    border: 1.5px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 16px;
    transition: all 0.25s;
}
.theme-toggle:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(99,102,241,0.08);
    transform: rotate(15deg);
}

/* ===== Forbidden Word Tags ===== */
.forbidden-word-tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 12px; border-radius: var(--radius-pill); font-size: 12px;
    background: rgba(239,68,68,0.08); color: var(--accent-red);
    border: 1px solid rgba(239,68,68,0.2);
    transition: all 0.2s;
    font-weight: 500;
}
.forbidden-word-tag:hover { background: rgba(239,68,68,0.15); transform: scale(1.03); }
.forbidden-word-tag .remove-btn {
    cursor: pointer; font-size: 14px; line-height: 1;
    opacity: 0.6; transition: opacity 0.15s;
}
.forbidden-word-tag .remove-btn:hover { opacity: 1; }
[data-theme="dark"] .forbidden-word-tag {
    background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.25);
}

/* ===== Task Grid ===== */
.task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px; padding: 4px;
}
.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s;
}
.task-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
}
[data-theme="dark"] .task-card:hover { box-shadow: 0 8px 30px rgba(0,0,0,0.5); }

.task-card.portrait {
    grid-column: 1 / -1;
    display: flex; flex-direction: row; max-height: 320px;
}
.task-card.portrait .task-card-thumb {
    width: 180px; min-width: 180px; height: 320px; aspect-ratio: auto;
}
.task-card.portrait .task-card-info {
    flex: 1; display: flex; flex-direction: column; justify-content: center;
}
.task-card-thumb {
    position: relative; width: 100%; aspect-ratio: 16/9;
    background: var(--bg-input); overflow: hidden; cursor: pointer;
}
.task-card-thumb img, .task-card-thumb video {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.task-card-thumb .play-overlay {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.3); opacity: 0;
    transition: opacity 0.25s;
    backdrop-filter: blur(2px);
}
.task-card-thumb:hover .play-overlay { opacity: 1; }
.task-card-thumb .play-overlay i { font-size: 36px; color: #fff; }
.task-card-info { padding: 12px 14px; }
.task-card-info .task-name {
    font-size: 13px; font-weight: 600; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.task-card-info .task-meta {
    font-size: 11px; color: var(--text-secondary); margin-top: 5px;
    display: flex; justify-content: space-between; align-items: center;
}
.task-card-cover {
    width: 36px; height: 36px; border-radius: 6px; object-fit: cover;
    border: 1px solid var(--border-color); cursor: pointer;
}

/* ===== PIP Modal ===== */
.pip-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(6px);
    z-index: 99998;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity .3s ease;
}
.pip-modal-overlay.show { opacity: 1; }

.pip-modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: 0 24px 80px rgba(0,0,0,0.25);
    width: 800px; max-width: 92vw;
    max-height: 85vh;
    display: flex; flex-direction: column;
    transform: translateY(24px) scale(0.95);
    transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1);
}
.pip-modal-overlay.show .pip-modal-box { transform: translateY(0) scale(1); }

.pip-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border-color);
}
.pip-modal-header h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.pip-modal-close {
    background: var(--bg-input); border: none; color: var(--text-secondary);
    font-size: 18px; cursor: pointer; padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}
.pip-modal-close:hover { background: rgba(239,68,68,0.1); color: var(--accent-red); }

.pip-modal-toolbar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 12px 20px; border-bottom: 1px solid var(--border-color);
    background: var(--bg-input);
}
.pip-modal-toolbar label { font-size: 11px; color: var(--text-secondary); white-space: nowrap; font-weight: 600; }
.pip-modal-toolbar select, .pip-modal-toolbar input[type="number"] {
    font-size: 11px; padding: 4px 8px; border-radius: var(--radius-xs);
    border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-primary);
}

.pip-modal-body { flex: 1; overflow-y: auto; padding: 0; }

.pip-subtitle-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.pip-subtitle-table th {
    position: sticky; top: 0; z-index: 2;
    background: var(--bg-input); padding: 10px 12px;
    text-align: left; font-weight: 700; font-size: 11px;
    color: var(--text-secondary); border-bottom: 1px solid var(--border-color);
}
.pip-subtitle-table td {
    padding: 8px 12px; border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
.pip-subtitle-table tr:hover { background: rgba(99,102,241,0.04); }
.pip-subtitle-table .pip-time {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 11px; color: var(--accent-cyan); white-space: nowrap;
}
.pip-subtitle-table .pip-text {
    max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.pip-material-cell { display: flex; align-items: center; gap: 8px; }
.pip-material-thumb {
    width: 42px; height: 32px; border-radius: var(--radius-xs); object-fit: cover;
    border: 1px solid var(--border-color); cursor: pointer;
    background: var(--bg-input);
}
.pip-material-thumb.is-video { position: relative; }
.pip-material-name {
    font-size: 10px; color: var(--text-dim); max-width: 100px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pip-add-btn {
    background: none; border: 2px dashed var(--border-color);
    border-radius: var(--radius-xs); width: 42px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-dim); cursor: pointer; font-size: 14px;
    transition: all .2s;
}
.pip-add-btn:hover {
    border-color: var(--accent-primary); color: var(--accent-primary);
    background: rgba(99,102,241,0.06);
}
.pip-remove-btn {
    background: none; border: none; color: var(--text-dim);
    cursor: pointer; font-size: 12px; padding: 3px 5px; border-radius: 4px;
}
.pip-remove-btn:hover { color: var(--accent-red); background: rgba(239,68,68,0.08); }

.pip-modal-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; border-top: 1px solid var(--border-color);
}
.pip-modal-footer .pip-stats { font-size: 11px; color: var(--text-secondary); }

/* ===== Visual Subtitle Editor (VSE) ===== */
.vse-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 99998;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity .3s ease;
}
.vse-overlay.show { opacity: 1; }

.vse-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 1040px; max-width: 95vw;
    max-height: 92vh;
    display: flex; flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,0.35);
    transform: translateY(24px) scale(0.95);
    transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1);
}
.vse-overlay.show .vse-box { transform: translateY(0) scale(1); }

.vse-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border-color);
}
.vse-header h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }

.vse-body { display: flex; flex: 1; overflow: hidden; }

.vse-preview-col {
    width: 380px; min-width: 340px;
    display: flex; flex-direction: column;
    align-items: center;
    padding: 14px;
    border-right: 1px solid var(--border-color);
    background: var(--bg-input);
    overflow-y: auto;
}

.vse-canvas-wrap {
    position: relative;
    width: 300px; height: 533px;
    background: #1a1a2e;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.vse-canvas-wrap.landscape { width: 533px; height: 300px; }
.vse-canvas-bg { width: 100%; height: 100%; object-fit: cover; display: block; }
.vse-draggable {
    position: absolute;
    cursor: move;
    user-select: none;
    padding: 2px 4px;
    border: 2px dashed transparent;
    border-radius: 4px;
    transition: border-color .15s;
}
.vse-canvas-wrap.has-preview .vse-draggable {
    color: transparent !important;
    text-shadow: none !important;
    -webkit-text-stroke: 0 !important;
}
.vse-draggable:hover, .vse-draggable.active { border-color: var(--accent-cyan); }
.vse-draggable.active { border-color: var(--accent-primary); }

.vse-settings-col {
    flex: 1;
    display: flex; flex-direction: column;
    overflow: hidden;
}

.vse-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-input);
}
.vse-tab {
    flex: 1;
    padding: 12px 14px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    transition: all .2s;
    background: none; border-top: none; border-left: none; border-right: none;
}
.vse-tab:hover { color: var(--text-primary); background: var(--bg-card); }
.vse-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    background: var(--bg-card);
}

.vse-tab-content { flex: 1; overflow-y: auto; padding: 16px 18px; }
.vse-tab-panel { display: none; }
.vse-tab-panel.active { display: block; }

.vse-form-group { margin-bottom: 14px; }
.vse-form-group label {
    display: block; font-size: 11px; color: var(--text-secondary);
    margin-bottom: 5px; font-weight: 600;
}
.vse-form-row { display: flex; gap: 8px; align-items: center; }
.vse-form-group input[type="text"],
.vse-form-group input[type="number"],
.vse-form-group select {
    width: 100%; font-size: 12px; padding: 6px 10px;
    border: 1.5px solid var(--border-color); border-radius: var(--radius-xs);
    background: var(--bg-input); color: var(--text-primary);
}
.vse-form-group input[type="range"] { width: 100%; }
.vse-color-input {
    width: 30px; height: 26px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-xs);
    padding: 0; cursor: pointer;
}

/* Template grid */
.vse-template-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}
.vse-template-item {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 6px;
    text-align: center;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    transition: all .2s;
    min-height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
}
.vse-template-item:hover {
    border-color: var(--accent-primary);
    background: rgba(99,102,241,0.05);
    transform: scale(1.03);
}
.vse-template-item.selected {
    border-color: var(--accent-primary);
    background: rgba(99,102,241,0.1);
    box-shadow: 0 0 0 2px rgba(99,102,241,0.2);
}
.vse-template-item .tpl-label { font-size: 9px; color: var(--text-dim); font-weight: 400; }

.vse-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; border-top: 1px solid var(--border-color);
}

.vse-orient-toggle {
    display: flex; gap: 0;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-pill);
    overflow: hidden; margin-top: 12px;
}
.vse-orient-btn {
    padding: 5px 14px; font-size: 11px; cursor: pointer;
    background: var(--bg-input); border: none; color: var(--text-secondary);
    transition: all .2s; font-weight: 500;
}
.vse-orient-btn.active {
    background: var(--gradient-primary); color: #fff;
}

/* ===== Avatar List Items ===== */
.avatar-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}
.avatar-list-item:hover {
    background: var(--bg-card);
    border-color: var(--accent-primary);
    box-shadow: 0 2px 8px rgba(99,102,241,0.08);
}
.avatar-thumb {
    width: 48px; height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-input);
}
.avatar-name {
    flex: 1;
    font-size: 13px; font-weight: 600;
    color: var(--text-primary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ===== Extra Modern Touches ===== */

/* Gradient text for card step numbers */
.card-header h3 i.icon-svg {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Subtle gradient border on active card */
.card:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(99,102,241,0.08), var(--shadow-card);
}

/* Smooth page transitions */
.page {
    animation: pageIn 0.3s ease;
}
@keyframes pageIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Task tab styling */
.task-tab {
    border-radius: 0;
    font-weight: 600;
}
.task-tab.active {
    border-bottom-color: var(--accent-primary) !important;
    color: var(--accent-primary) !important;
}
