/* ========================================
   Video2Prompt - AdMuse Style
   Tencent Muse Inspired Dark Theme
   ======================================== */

:root {
    /* Color Palette - Dark Theme */
    --bg-body: #0a0a0c;
    --bg-sidebar: #121214;
    --bg-content: #141416;
    --bg-card: #1c1c1e;
    --bg-card-hover: #252528;
    --bg-input: #2a2a2d;
    --bg-overlay: rgba(0, 0, 0, 0.7);

    /* Brand Colors */
    --primary: #2b6de5; /* Tencent Blue-ish */
    --primary-hover: #1e5dd0;
    --primary-light: #4c85f0;
    --accent-purple: #9d5bd2;
    --accent-pink: #d946ef;
    --accent-orange: #f97316;
    --accent-green: #22c55e;
    --accent-cyan: #06b6d4;

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --text-placeholder: #52525b;
    --text-on-primary: #ffffff;

    /* Borders & Dividers */
    --border-base: #2e2e32;
    --border-light: #3f3f46;
    --border-focus: #3d7eff;

    /* Status Colors */
    --success: #22c55e;
    --success-hover: #16a34a;
    --success-bg: #15803d;
    --error: #ef4444;
    --error-bg: #dc2626;
    --warning: #f59e0b;
    --warning-bg: #d97706;
    --info: #3b82f6;

    /* Spacing & Sizing */
    --sidebar-width: 240px;
    --header-height: 64px;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(43, 109, 229, 0.25);

    /* Transitions */
    --trans-fast: 0.15s ease;
    --trans-normal: 0.25s ease;
}

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

body {
    font-family: 'PingFang SC', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
    overflow: hidden; /* App-like feel */
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; }
ul, ol { list-style: none; }

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

/* Layout Structure */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-base);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 100;
}

body.sidebar-collapsed .sidebar {
    width: 64px;
}

body.sidebar-auto-hide .sidebar {
    width: 56px;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow: hidden;
    transition: width 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 180;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.42);
}

body.sidebar-auto-hide .logo {
    padding: 0;
    justify-content: center;
}

body.sidebar-auto-hide .logo-text,
body.sidebar-auto-hide .nav-group-title,
body.sidebar-auto-hide .nav-item span,
body.sidebar-auto-hide .user-info,
body.sidebar-auto-hide .user-auth-actions {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-8px);
    transition: opacity 0.14s ease, transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.18s;
}

body.sidebar-auto-hide .nav-menu {
    padding: 12px 8px;
}

body.sidebar-auto-hide .nav-item {
    justify-content: center;
    padding: 10px 0;
    gap: 0;
    transition: padding 0.18s cubic-bezier(0.2, 0.8, 0.2, 1), gap 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}

body.sidebar-auto-hide .sidebar-footer {
    padding: 10px 8px;
}

body.sidebar-auto-hide .user-profile {
    justify-content: center;
    padding: 6px 0;
    gap: 0;
    transition: padding 0.18s cubic-bezier(0.2, 0.8, 0.2, 1), gap 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}

body.sidebar-auto-hide .logo-text,
body.sidebar-auto-hide .nav-item span {
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

body.sidebar-auto-hide .nav-group-title {
    max-height: 0;
    margin: 0;
    overflow: hidden;
}

body.sidebar-auto-hide .user-info,
body.sidebar-auto-hide .user-auth-actions {
    max-width: 0;
    overflow: hidden;
}

body.sidebar-auto-hide .user-auth-actions {
    display: inline-flex;
}

body.sidebar-auto-hide .sidebar:hover {
    width: var(--sidebar-width);
}

body.sidebar-auto-hide .sidebar:hover .logo {
    padding: 0 var(--space-lg);
    justify-content: flex-start;
}

body.sidebar-auto-hide .sidebar:hover .logo-text {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    transition-delay: 0.05s;
    max-width: 160px;
}

body.sidebar-auto-hide .sidebar:hover .nav-group-title,
body.sidebar-auto-hide .sidebar:hover .nav-item span,
body.sidebar-auto-hide .sidebar:hover .user-info {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    transition-delay: 0.05s;
}

body.sidebar-auto-hide .sidebar:hover .user-auth-actions {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    transition-delay: 0.05s;
}

body.sidebar-auto-hide .sidebar:hover .nav-group-title {
    max-height: 22px;
    margin: var(--space-md) 0 var(--space-xs) var(--space-sm);
}

body.sidebar-auto-hide .sidebar:hover .nav-item span {
    max-width: 180px;
}

body.sidebar-auto-hide .sidebar:hover .user-info {
    max-width: 140px;
}

body.sidebar-auto-hide .sidebar:hover .user-auth-actions {
    max-width: 120px;
}

body.sidebar-auto-hide .sidebar:hover .nav-menu {
    padding: var(--space-md);
}

body.sidebar-auto-hide .sidebar:hover .nav-item {
    justify-content: flex-start;
    padding: 10px 12px;
    gap: 12px;
}

body.sidebar-auto-hide .sidebar:hover .sidebar-footer {
    padding: var(--space-md);
}

body.sidebar-auto-hide .sidebar:hover .user-profile {
    justify-content: flex-start;
    padding: 8px;
    gap: 10px;
}

.logo {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 var(--space-lg);
    gap: var(--space-sm);
    border-bottom: 1px solid transparent; /* Subtle separator if needed */
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-purple) 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(90deg, #fff, #ccc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    flex: 1;
    padding: var(--space-md);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-group-title {
    font-size: 12px;
    color: var(--text-tertiary);
    margin: var(--space-md) 0 var(--space-xs) var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: var(--trans-fast);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.nav-item:hover {
    background-color: var(--bg-input);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: rgba(43, 109, 229, 0.1);
    color: var(--primary-light);
}

.nav-item i {
    width: 18px;
    text-align: center;
    font-size: 16px;
}

.sidebar-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--border-base);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--trans-fast);
}

.user-profile:hover {
    background-color: var(--bg-input);
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--accent-purple);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.user-role {
    font-size: 12px;
    color: var(--text-tertiary);
}

body.sidebar-collapsed .logo {
    padding: 0;
    justify-content: center;
}

body.sidebar-collapsed .logo-text,
body.sidebar-collapsed .nav-group-title,
body.sidebar-collapsed .nav-item span,
body.sidebar-collapsed .user-info,
body.sidebar-collapsed .user-auth-actions {
    display: none;
}

body.sidebar-collapsed .nav-menu {
    padding: 12px 8px;
}

body.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 10px 0;
}

body.sidebar-collapsed .sidebar-footer {
    padding: 10px 8px;
}

body.sidebar-collapsed .user-profile {
    justify-content: center;
    padding: 6px 0;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-body);
    overflow: hidden;
    position: relative;
}

body.sidebar-auto-hide .main-content {
    margin-left: 56px;
    width: calc(100vw - 56px);
    z-index: 50;
    transition: margin-left 0.18s cubic-bezier(0.2, 0.8, 0.2, 1), width 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Header */
.header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-xl);
    border-bottom: 1px solid var(--border-base);
    background-color: rgba(10, 10, 12, 0.8);
    backdrop-filter: blur(10px);
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.sidebar-toggle-btn {
    width: 34px;
    height: 34px;
}

.sidebar-toggle-btn.active {
    background: var(--bg-input);
    color: var(--text-primary);
}

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

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

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

.header-key-btn {
    height: 32px;
    padding: 0 10px;
    white-space: nowrap;
}

.search-bar {
    position: relative;
    width: 280px;
}

.search-bar i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
}

.search-bar input {
    width: 100%;
    height: 36px;
    padding: 0 12px 0 36px;
    background-color: var(--bg-input);
    border: 1px solid transparent;
    border-radius: 18px;
    color: var(--text-primary);
    font-size: 13px;
    transition: var(--trans-fast);
}

.search-bar input:focus {
    outline: none;
    background-color: var(--bg-card);
    border-color: var(--border-light);
}

.lang-switch {
    display: flex;
    background: var(--bg-input);
    padding: 4px;
    border-radius: 16px;
    border: 1px solid var(--border-base);
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    padding: 2px 8px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 12px;
    transition: var(--trans-fast);
}

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

.lang-btn.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    font-weight: 500;
}

.notification-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--trans-fast);
}

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

/* Sections */
.section {
    flex: 1;
    overflow-y: auto;
    display: none;
    padding: var(--space-xl);
    animation: fadeIn 0.3s ease;
}

.section.active {
    display: block;
}

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

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 40px;
}

.section-header {
    margin-bottom: var(--space-xl);
}

.section-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Dashboard Home */
.dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #1e2025 0%, #101012 100%);
    border: 1px solid var(--border-base);
    border-radius: var(--radius-lg);
    padding: 40px 60px;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.hero-content {
    max-width: 500px;
    z-index: 2;
}

.hero-content h1 {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 16px;
    background: linear-gradient(90deg, #fff, #a5b4fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-content p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.hero-actions {
    display: flex;
    gap: 16px;
}

.hero-image {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 50%;
    pointer-events: none;
}

/* Floating cards decoration */
.floating-card {
    position: absolute;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 32px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.card-1 { width: 80px; height: 80px; top: 20%; right: 20%; transform: rotate(-10deg); animation: float 6s ease-in-out infinite; }
.card-2 { width: 100px; height: 120px; top: 40%; right: 10%; transform: rotate(5deg); animation: float 8s ease-in-out infinite reverse; }
.card-3 { width: 60px; height: 60px; top: 60%; right: 30%; transform: rotate(15deg); animation: float 7s ease-in-out infinite 1s; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); }
    50% { transform: translateY(-15px) rotate(var(--rot, 0deg)); }
}

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

.dashboard-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-base);
    border-radius: var(--radius-md);
    padding: 24px;
    cursor: pointer;
    transition: var(--trans-normal);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.dashboard-card:hover {
    transform: translateY(-4px);
    background-color: var(--bg-card-hover);
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
}

.dashboard-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 20px;
    color: white;
}

.gradient-blue { background: linear-gradient(135deg, #2b6de5, #4c85f0); }
.gradient-purple { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.gradient-pink { background: linear-gradient(135deg, #db2777, #f472b6); }
.gradient-orange { background: linear-gradient(135deg, #ea580c, #fb923c); }
.gradient-green { background: linear-gradient(135deg, #16a34a, #4ade80); }
.gradient-cyan { background: linear-gradient(135deg, #0891b2, #22d3ee); }

.dashboard-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.dashboard-card p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    flex: 1;
}

.card-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--primary-light);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: gap 0.2s;
}

.dashboard-card:hover .card-link {
    gap: 10px;
}

/* Common Components */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-base);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-base);
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-grid.three-cols {
    grid-template-columns: repeat(3, 1fr);
}

.form-group {
    margin-bottom: 20px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-control {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-base);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--trans-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(43, 109, 229, 0.2);
    background-color: #2e2e32;
}

textarea.form-control {
    resize: vertical;
    line-height: 1.5;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--trans-fast);
    border: none;
    line-height: 1.2;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(43, 109, 229, 0.3);
}

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

.btn-secondary:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--border-light);
}

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

.btn-success:hover {
    background-color: #166534;
    border-color: #166534;
    box-shadow: 0 4px 12px rgba(21, 128, 61, 0.3);
}

.btn-danger {
    background-color: var(--error-bg);
    color: white;
    border: 1px solid var(--error-bg);
}

.btn-danger:hover {
    background-color: #b91c1c;
    border-color: #b91c1c;
}

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

.btn-warning:hover {
    background-color: #b45309;
    border-color: #b45309;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 4px 8px;
}

.btn-text:hover {
    color: var(--text-primary);
    background-color: var(--bg-input);
}

.btn-text.danger:hover {
    color: #ef4444;
    background-color: rgba(239, 68, 68, 0.1);
}

.btn-lg {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.action-bar {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.action-bar.right-align {
    justify-content: flex-end;
}

.action-bar.center-align {
    justify-content: center;
}

.flex-grow { flex: 1; }
.wide { width: 100%; max-width: 400px; }

/* Upload Zones */
.upload-zone {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-md);
    padding: 32px;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: var(--trans-normal);
}

.upload-zone.large {
    padding: 48px;
    min-height: 240px;
}

.upload-zone:hover {
    border-color: var(--primary);
    background-color: rgba(43, 109, 229, 0.05);
}

.upload-zone.dragover {
    border-color: var(--primary);
    background-color: rgba(43, 109, 229, 0.1);
}

.upload-icon {
    font-size: 32px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.upload-text {
    font-weight: 600;
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Specific Component Styles */
.ref-image-upload-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background-color: var(--bg-input);
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.ref-image-upload-card:hover {
    border-color: var(--primary);
    background-color: rgba(43, 109, 229, 0.05);
}

.ref-image-preview {
    width: 64px;
    height: 64px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid var(--border-light);
}

.ref-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ref-image-info {
    flex: 1;
}

.ref-image-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.ref-image-hint {
    font-size: 12px;
    color: var(--text-tertiary);
}

.ref-image-icon {
    font-size: 24px;
    color: var(--text-tertiary);
}

/* Video Result Optimization */
.video-result-player {
    width: 100%;
    max-width: 100%;
    background: #000;
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    margin: 16px 0;
}

.video-result-player video {
    max-width: 100%;
    max-height: 500px; /* Constrain height to prevent page expansion */
    width: auto;
    height: auto;
    object-fit: contain;
}

.video-result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-base);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 24px;
    animation: fadeIn 0.3s ease;
}

.video-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

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

/* Tuner Styles */
.tuner-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    height: calc(100vh - 140px); /* Fill remaining space */
}

.tuner-block {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.full-height {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.tuner-scroll-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.segment-nav-list {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.segment-nav-item {
    padding: 12px;
    background-color: var(--bg-input);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
}

.segment-nav-item:hover {
    background-color: var(--bg-card-hover);
}

.segment-nav-item.active {
    border-color: var(--primary);
    background-color: rgba(43, 109, 229, 0.1);
    color: var(--primary-light);
}

.tuner-segments-header {
    gap: 12px;
    flex-wrap: wrap;
}

.tuner-segments-single-view {
    padding: 4px 4px 16px 0;
}

.ecommerce-seg-card {
    margin-bottom: 0;
    min-width: 0;
}

.ecommerce-seg-body {
    width: 100%;
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 16px;
    align-items: stretch;
    min-width: 0;
}

.ecommerce-seg-inputs {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.ecommerce-seg-script-container {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ecommerce-seg-group {
    margin-bottom: 0;
}

.ecommerce-seg-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.ecommerce-seg-input {
    min-height: 110px;
    resize: vertical;
}

.ecommerce-seg-script-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ecommerce-seg-script {
    flex: 1;
    min-height: 420px;
    resize: vertical;
    line-height: 1.6;
}

@media (max-width: 980px) {
    .ecommerce-seg-body {
        grid-template-columns: 1fr;
    }
    .ecommerce-seg-script {
        min-height: 320px;
    }
}

/* Replica Layout */
.replica-container {
    display: flex;
    gap: 24px;
    align-items: stretch;
    margin-bottom: 24px;
}

.replica-box {
    flex: 1;
    background-color: var(--bg-card);
    border: 1px solid var(--border-base);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.replica-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.step-num {
    background-color: var(--bg-input);
    color: var(--text-secondary);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.replica-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    font-size: 24px;
}

.upload-wrapper {
    flex: 1;
    min-height: 200px;
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--trans-fast);
    background-color: rgba(0,0,0,0.1);
}

.upload-wrapper:hover {
    border-color: var(--primary);
    background-color: rgba(43, 109, 229, 0.05);
}

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

.preview-wrapper {
    width: 100%;
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0,0,0,0.1);
    padding: 16px;
    box-sizing: border-box;
}

.preview-wrapper video, .preview-wrapper img {
    max-width: 100%;
    max-height: min(420px, 60vh);
    width: auto;
    height: auto;
    display: block;
    margin: auto;
    align-self: center;
    object-fit: contain;
}

.reverse-preview {
    display: grid;
    gap: 16px;
    justify-items: center;
}

.reverse-preview video {
    max-width: 100%;
    max-height: min(420px, 60vh);
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.reverse-actions {
    width: 100%;
    display: flex;
    justify-content: center;
}

.reupload-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    backdrop-filter: blur(4px);
}

/* Analysis Tags */
.analysis-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.analysis-tag {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

#analysisResultPrompt .analysis-text {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.7;
}

#reverseOutput {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.75;
    max-height: 58vh;
    overflow: auto;
}

.duration-slider-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
}

.duration-slider {
    flex: 1;
}

.duration-slider-value {
    min-width: 52px;
    text-align: right;
    font-weight: 600;
    color: var(--text-primary);
}

#chat .content-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    max-width: 100%;
    padding: 0;
}

#chat .section-header {
    display: none;
}

#chat.section {
    padding: 0;
    overflow: hidden;
    background: var(--bg-body);
}

#chat.section.active {
    display: flex;
}

#video .section-header {
    display: none;
}

#video.section {
    padding: 0;
    overflow: hidden;
    background: var(--bg-body);
    flex-direction: column;
    min-height: 0;
}

#video.section.active {
    display: flex;
}

.chat-studio-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    background: var(--bg-body);
    border: none;
    box-shadow: none;
    border-radius: 0;
    margin-bottom: 0;
}

.chat-scroll-area {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.chat-input-fixed {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    background: var(--bg-body);
    padding: 6px 0 18px;
    width: 100%;
}

.chat-composer-wrap {
    position: static;
    z-index: 5;
    background: var(--bg-body);
    border-top: 1px solid var(--border-base);
    padding: 8px 16px 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
}

.chat-composer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid var(--border-base);
    border-radius: 24px;
    padding: 12px 14px 8px;
    cursor: text;
    background: var(--bg-card);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
    width: 100%;
}

#chatMediaDrop,
#videoMediaDrop {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

#video .chat-composer-wrap {
    position: static;
    z-index: 5;
    background: var(--bg-body);
    border-top: 1px solid var(--border-base);
    padding: 8px 24px 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    width: 100%;
    max-width: none;
    margin: 0;
}

#video .chat-messages,
#video .chat-suggestion-list,
#video .chat-disclaimer {
    width: 100%;
    max-width: none;
}

#video .chat-scroll-area {
    padding: 12px 24px 0;
    box-sizing: border-box;
}

#video .video-task-query-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

#video .video-task-query-panel .form-control {
    min-width: 0;
}

#video .video-task-query-status {
    min-height: 20px;
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 2px 8px;
}

#video .video-task-query-status.success {
    color: #21c06d;
}

#video .video-task-query-status.error {
    color: #ff6b6b;
}

#video .video-messages-frame {
    border: 1px solid var(--border-base);
    border-radius: 18px;
    background: var(--bg-card);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

#video .video-messages-frame .chat-messages {
    background: transparent;
    margin: 0;
    padding: 22px 20px 8px;
}

#video .video-messages-frame .chat-suggestion-list {
    margin: 0;
    padding: 0 20px 12px;
}

#video #videoMediaDrop {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid var(--border-base);
    border-radius: 24px;
    padding: 12px 14px 8px;
    cursor: text;
    background: var(--bg-card);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

#video #videoPromptInput {
    min-height: 120px;
    max-height: 400px;
    resize: none;
    border: none;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-primary);
    caret-color: var(--text-primary);
    font-size: 15px;
    line-height: 1.46;
    font-weight: 400;
    width: 100%;
    outline: none;
    box-shadow: none;
}

body.video-workspace-mode {
    background: var(--bg-body);
}

body.video-workspace-mode .main-content {
    background: var(--bg-body);
}

body.video-workspace-mode .header {
    background-color: rgba(10, 10, 12, 0.92);
    border-bottom: 1px solid var(--border-base);
}

body.video-workspace-mode .header-right .search-bar,
body.video-workspace-mode .header-right .header-key-actions,
body.video-workspace-mode .header-right .notification-btn {
    display: none;
}

body.video-workspace-mode #video.section {
    background: var(--bg-body);
}

body.video-workspace-mode #video .chat-scroll-area {
    padding: 10px 24px 0;
}

body.video-workspace-mode #video .video-task-query-panel {
    max-width: 1048px;
    margin: 0 auto 10px;
    grid-template-columns: minmax(0, 420px) auto auto;
    gap: 8px;
}

body.video-workspace-mode #video .video-task-query-status {
    max-width: 1048px;
    margin: 0 auto 10px;
    color: var(--text-secondary);
    font-size: 12px;
}

body.video-workspace-mode #video .video-messages-frame {
    max-width: 1048px;
    margin: 0 auto;
    border: 1px solid var(--border-base);
    border-radius: 14px;
    background: #141418;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

body.video-workspace-mode #video .video-messages-frame .chat-messages {
    padding: 16px 18px 10px;
    gap: 10px;
    background: transparent;
}

body.video-workspace-mode #video .chat-message.assistant {
    border: 1px solid #272a31;
    border-radius: 10px;
    background: #16181d;
    padding: 10px 12px;
}

body.video-workspace-mode #video .chat-message.assistant .chat-message-content {
    color: #d6d9e1;
    font-size: 13px;
    line-height: 1.5;
}

body.video-workspace-mode #video .chat-message.user .chat-message-content {
    background: #1d2b45;
    color: #dce5f7;
    border-radius: 10px;
    padding: 8px 11px;
    font-size: 13px;
}

body.video-workspace-mode #video .chat-result-video {
    border: 1px solid #2e3340;
    border-radius: 8px;
    max-height: 420px;
}

body.video-workspace-mode #video .chat-input-fixed {
    background: var(--bg-body);
    padding: 10px 0 16px;
}

body.video-workspace-mode #video .chat-composer-wrap {
    max-width: 1048px;
    padding: 0;
    border-top: none;
}

body.video-workspace-mode #video #videoMediaDrop {
    border: 1px solid #2d323d;
    border-radius: 12px;
    padding: 10px 12px 8px;
    background: #15171b;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.24);
}

body.video-workspace-mode #video #videoPromptInput {
    color: var(--text-primary);
    caret-color: var(--text-primary);
    min-height: 120px;
    max-height: 400px;
}

body.video-workspace-mode #video #videoPromptInput::placeholder {
    color: #7e8596;
}

body.video-workspace-mode #video .chat-icon-btn,
body.video-workspace-mode #video .video-param-toggle-btn {
    background: #20232b;
    border-color: #313744;
    color: #a7b2c8;
}

body.video-workspace-mode #video .chat-send-btn {
    background: var(--primary);
    width: 28px;
    height: 28px;
    font-size: 11px;
}

body.video-workspace-mode #video .video-param-panel {
    background: #181b21;
    border-color: #313744;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.44);
}

body.video-workspace-mode #video .video-option-btn {
    background: #1f232b;
    border-color: #343b49;
    color: #9ea9bf;
}

body.video-workspace-mode #video .video-option-btn.active {
    background: #202a3f;
    border-color: #4968b8;
    color: #b6c8f3;
}

.video-chat-composer {
    border-radius: 20px;
    padding: 14px;
    gap: 12px;
}

.video-chat-input {
    min-height: 110px;
    max-height: 220px;
}

.video-param-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.video-history-panel {
    margin: 16px auto 24px;
    width: 90%;
    max-width: 1400px;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-md);
    background: var(--bg-card);
}

.video-history-list {
    display: grid;
    gap: 12px;
    padding: 12px;
}

.video-history-item {
    border: 1px solid var(--border-base);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    padding: 10px;
    display: grid;
    gap: 8px;
}

.video-history-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.video-history-status {
    font-size: 12px;
}

.video-history-preview {
    width: 100%;
    border-radius: 10px;
    max-height: 220px;
    background: #000;
}

.chat-composer:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(43, 109, 229, 0.14);
}

.chat-composer.dragover {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(43, 109, 229, 0.2);
}

.chat-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.chat-toolbar-left,
.chat-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.chat-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid var(--border-light);
    background: var(--bg-input);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.chat-shortcut-btn {
    height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--border-light);
    background: #1a1a1d;
    color: #b3b7c4;
    font-weight: 450;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

.video-param-toggle-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid var(--border-light);
    background: var(--bg-input);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.video-param-toggle-btn.active {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(43, 109, 229, 0.14);
}

.video-composer-block {
    display: grid;
    gap: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    position: relative;
}

.video-param-panel {
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    z-index: 20;
    border: 1px solid var(--border-light);
    border-radius: 14px;
    background: var(--bg-input);
    padding: 12px;
    display: grid;
    gap: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

.video-param-section {
    display: grid;
    gap: 8px;
}

.video-param-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.video-option-grid {
    display: grid;
    gap: 8px;
}

.video-option-grid-7 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.video-option-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.video-option-btn {
    height: 34px;
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--trans-fast);
}

.video-option-btn:hover {
    border-color: var(--border-focus);
    color: var(--text-primary);
}

.video-option-btn.active {
    border-color: var(--border-focus);
    color: var(--text-primary);
    background: #1c2230;
}

.video-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.video-slider-row input[type="range"] {
    flex: 1;
    min-width: 0;
}

.video-slider-value {
    min-width: 64px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
}

.chat-send-btn {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: none;
    background: var(--primary);
    color: var(--text-on-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
}

.chat-media-preview-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 0;
}

.chat-media-preview {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: min(100%, 280px);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background: #17171b;
    padding: 4px 6px;
    min-height: 46px;
}

.chat-media-preview video,
.chat-media-preview img {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 6px;
    object-fit: cover;
    background: #000;
}

.chat-media-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    width: 100%;
    color: var(--text-secondary);
    font-size: 10.5px;
}

.chat-media-actions span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
    opacity: 0.9;
}

.chat-media-actions .btn {
    position: relative;
    width: 18px;
    height: 18px;
    min-width: 18px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid #34363f;
    background: #1b1c22;
    color: transparent;
    font-size: 0;
    line-height: 0;
    margin-left: 2px;
}

.chat-media-actions .btn::after {
    content: '×';
    position: absolute;
    inset: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #9ca3b2;
    font-size: 12px;
    line-height: 1;
}

.chat-media-actions .btn:hover {
    border-color: #444854;
    background: #22232b;
}

.chat-media-actions .btn:hover::after {
    color: #d3d8e2;
}

.chat-prompt-group {
    margin-bottom: 0;
}

.chat-input {
    min-height: 32px;
    max-height: 154px;
    resize: none;
    border: none;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-primary);
    caret-color: var(--text-primary);
    font-size: 15px;
    line-height: 1.46;
    font-weight: 400;
    width: 100%;
    outline: none;
    box-shadow: none;
}

.chat-input::placeholder {
    color: #6f7380;
    opacity: 1;
}

.chat-input:focus {
    border: none;
    outline: none;
    box-shadow: none;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 100%;
    overflow: visible;
    padding: 28px 16px 8px;
    background: var(--bg-body);
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
}

.chat-message {
    border: none;
    border-radius: 0;
    padding: 0;
    background: transparent;
}

.chat-message.user {
    display: flex;
    justify-content: flex-end;
}

.chat-message.user .chat-message-content {
    max-width: min(70%, 620px);
    border-radius: 14px;
    background: #1d2b45;
    padding: 9px 13px;
}

.chat-message.assistant .chat-message-content {
    max-width: 100%;
}

.chat-message-content {
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.72;
    letter-spacing: 0;
}

.chat-user-inline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
}

.chat-inline-previews {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.chat-inline-thumb {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: #111;
    display: block;
}

.chat-inline-text {
    min-width: 0;
    display: inline-block;
}

#video .video-user-prompt-preview {
    min-width: 0;
    display: inline-block;
}

#video .video-user-prompt-preview.collapsed {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    cursor: pointer;
}

.chat-result-video-wrap {
    margin-top: 10px;
    width: min(100%, 860px);
}

.chat-result-video {
    width: 100%;
    max-height: min(58vh, 520px);
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: #000;
    display: block;
}

.chat-message-media {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chat-message-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}

.chat-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid #2f3035;
    background: #151518;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.chat-thinking-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 2px 0 0;
}

.chat-thinking-spinner {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 1px solid #2f3035;
    background: #151518;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.chat-suggestion-list {
    width: 90%;
    max-width: 1400px;
    margin: 2px auto 0;
    padding: 0 16px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chat-suggestion-btn {
    border: 1px solid #2c2e35;
    background: #141418;
    color: #9ca3b2;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
}

.chat-disclaimer {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 400;
    padding: 0 2px;
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
}

.chat-drop-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin: 0 2px;
    width: 90%;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 900px) {
    .chat-studio-card {
        min-height: 0;
    }

    .chat-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .chat-toolbar-left,
    .chat-toolbar-right {
        justify-content: flex-start;
    }

    .chat-composer-wrap,
    .chat-messages,
    .chat-suggestion-list,
    .chat-disclaimer,
    .chat-drop-hint {
        width: 100%;
        max-width: 100%;
    }

    .video-param-grid {
        grid-template-columns: 1fr;
    }

    .video-option-grid-7 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .chat-media-preview-group {
        flex-direction: column;
    }

    .chat-media-preview {
        max-width: 100%;
    }

    .chat-shortcut-btn {
        font-size: 12px;
        padding: 0 8px;
    }

    .chat-message-content {
        font-size: 15px;
        line-height: 1.75;
    }

    .chat-suggestion-btn {
        width: 100%;
        text-align: left;
    }

    .chat-disclaimer,
    .chat-drop-hint,
    .chat-input {
        font-size: 14px;
        line-height: 1.45;
    }
}

/* Templates */
.template-categories {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.category-btn {
    background-color: var(--bg-input);
    border: 1px solid var(--border-base);
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 13px;
    transition: var(--trans-fast);
}

.category-btn:hover {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}

.category-btn.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

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

.template-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-base);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: var(--trans-normal);
    display: flex;
    flex-direction: column;
}

.template-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-light);
}

.template-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.template-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.template-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    flex: 1;
}

.template-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.template-tag {
    font-size: 11px;
    padding: 2px 6px;
    background-color: var(--bg-input);
    border-radius: 4px;
    color: var(--text-tertiary);
}

.template-action {
    color: var(--primary-light);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Guide Styles */
.guide-container {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 32px;
}

.guide-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.guide-link {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    transition: var(--trans-fast);
}

.guide-link:hover {
    background-color: var(--bg-input);
    color: var(--text-primary);
}

.guide-link.active {
    background-color: rgba(43, 109, 229, 0.1);
    color: var(--primary-light);
    font-weight: 500;
}

.guide-sections {
    color: var(--text-secondary);
}

.guide-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.guide-section.active {
    display: block;
}

.guide-section h2 {
    color: var(--text-primary);
    margin-bottom: 24px;
    font-size: 20px;
}

.guide-card {
    margin-bottom: 24px;
}

.guide-card h3 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-base);
}

.guide-card ul {
    list-style: disc;
    padding-left: 20px;
}

.guide-card li {
    margin-bottom: 8px;
}

.code-block {
    background-color: #121214;
    padding: 16px;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 13px;
    color: #e2e8f0;
    border: 1px solid var(--border-base);
}

.guide-table {
    width: 100%;
    border-collapse: collapse;
}

.guide-table th, .guide-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-base);
}

.guide-table th {
    color: var(--text-primary);
    font-weight: 600;
}

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

.style-card {
    background-color: var(--bg-input);
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-base);
}

.style-card h4 {
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 14px;
}

.style-card code {
    display: block;
    margin-top: 12px;
    background-color: rgba(0,0,0,0.3);
    padding: 8px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--primary-light);
}

/* Batch Generation Styles (Optimized Grid) */
.batch-segments-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.batch-segment-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-base);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.batch-segment-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-light);
}

.batch-segment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
}

.batch-segment-status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    background-color: var(--bg-input);
    color: var(--text-tertiary);
}

.batch-segment-prompt textarea {
    width: 100%;
    height: 80px; /* Reduced height for compactness */
    font-size: 12px;
    resize: none;
    margin-bottom: 0;
}

.batch-segment-video {
    margin-top: 0; /* Reset previous margin if any */
    background-color: #000;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-sm);
    height: 160px; /* Fixed height for video preview */
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    font-size: 12px;
    overflow: hidden;
    padding: 0;
}

.batch-segment-video video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.user-auth-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
}

.auth-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.auth-modal-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(420px, calc(100vw - 32px));
    background: var(--bg-card);
    border: 1px solid var(--border-base);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 16px;
}

.auth-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.auth-modal-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.auth-tab-btn.active {
    background: rgba(43, 109, 229, 0.2);
    color: var(--primary-light);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-status-text {
    min-height: 18px;
    font-size: 13px;
    line-height: 1.4;
    color: #f87171;
}

#video.section {
    background: var(--bg-body);
}

#video.section.active {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

#video .video-v2-main {
    flex: 1;
    overflow-y: auto;
    padding: 28px clamp(20px, 3vw, 40px);
    max-width: 1720px;
    margin: 0 auto;
    width: 100%;
}

#video .video-v2-log-card {
    background: var(--bg-card);
    border: 1px solid var(--border-base);
    border-radius: 16px;
    padding: 24px;
    margin-top: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

#video #videoMessages.chat-messages {
    margin: 0;
    padding: 0;
    max-width: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: transparent;
}

#video .video-v2-log-card .chat-suggestion-list {
    margin: 12px 0 0;
    padding: 0;
    max-width: none;
}

#video .video-v2-bottom-bar {
    position: relative;
    width: 100%;
    padding: 16px 24px 24px;
    box-sizing: border-box;
    z-index: 10;
    background: var(--bg-body);
}

#video #videoComposerBlock {
    position: relative;
    width: 100%;
    max-width: 1480px;
    margin: 0 auto;
}

#video .video-v2-chat-input-container {
    background: var(--bg-card);
    border: 1px solid var(--border-base);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 12px 16px;
    position: relative;
}

#video #videoMediaPreviewGroup {
    margin-bottom: 8px;
}

#video #videoImagePreviewWrap.video-v2-image-preview-strip {
    display: block;
    border: none;
    background: transparent;
    padding: 0;
    min-height: 0;
    max-width: 100%;
}

#video .video-v2-image-thumb-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

#video .video-v2-image-thumb {
    position: relative;
    width: 54px;
    height: 54px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #2f3543;
    background: #111319;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
}

#video .video-v2-image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#video .video-v2-image-remove-btn {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 999px;
    background: rgba(10, 12, 16, 0.78);
    color: #d5dbe8;
    font-size: 12px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

#video .video-v2-image-remove-btn:hover {
    background: rgba(231, 74, 95, 0.95);
    color: #fff;
}

#video #videoMediaDrop.video-v2-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    position: relative;
    padding: 6px 48px 6px 12px;
    border: 1px solid var(--border-base);
    border-radius: 14px;
    background: var(--bg-input, #1a1d24);
    box-shadow: none;
    min-width: 0;
    min-height: 44px;
    transition: border-color 0.16s ease, background-color 0.16s ease;
}

#video #videoMediaDrop.video-v2-input-row:focus-within {
    border-color: #4c67ad;
    box-shadow: 0 0 0 3px rgba(73, 104, 184, 0.18);
}

#video #videoMediaDrop.video-v2-input-row.dragover {
    outline: 2px dashed var(--border-focus);
    outline-offset: 2px;
    border-radius: 10px;
}

#video .video-v2-plus-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

#video #videoPromptInput.video-v2-chat-input {
    flex: 1;
    display: block;
    box-sizing: border-box;
    border: none;
    outline: none;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    min-height: 120px;
    max-height: 400px;
    height: 120px;
    background: transparent;
    padding: 8px 44px 8px 0;
    overflow-y: auto;
    resize: none;
    white-space: pre-wrap;
    word-break: break-word;
}

#video #videoPromptInput.video-v2-chat-input::placeholder {
    color: var(--text-secondary);
}

#video .video-v2-send-btn {
    border: 1px solid #5880dd;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 28%, #6ea0ff 0%, #4f7fe6 45%, #3f6fd8 100%);
    color: var(--text-on-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(43, 109, 229, 0.28);
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease, border-color 0.16s ease;
    position: absolute;
    right: 6px;
    bottom: 6px;
}

#video .video-v2-send-btn:hover {
    filter: brightness(1.08);
    border-color: #6f97f0;
    box-shadow: 0 8px 18px rgba(43, 109, 229, 0.32);
}

#video .video-v2-send-btn:active {
    transform: translateY(1px);
    box-shadow: 0 4px 10px rgba(43, 109, 229, 0.24);
}

#video .video-v2-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0 4px;
    border-top: 1px solid var(--border-base);
    margin-top: 4px;
}

#video .video-v2-controls-actions {
    display: inline-flex;
    align-items: center;
    gap: 20px;
}

#video .video-v2-control-item {
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    user-select: none;
    border: none;
    background: transparent;
    padding: 0;
}

#video .video-v2-control-item:hover {
    color: var(--text-primary);
}

#video .video-v2-add-media-btn {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    padding: 0;
    justify-content: center;
}

#video .video-v2-task-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    width: min(520px, calc(100vw - 40px));
    background: #181b21;
    border: 1px solid #313744;
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.44);
    padding: 16px;
    gap: 12px;
    z-index: 2100;
}

#video .chat-message.user .chat-message-content {
    max-width: min(82%, 980px);
}

#video .chat-result-video-wrap {
    width: min(100%, 1280px);
}

#video .chat-result-video {
    max-height: min(72vh, 760px);
}

@media (max-width: 1280px) {
    #video .video-v2-main {
        max-width: 100%;
        padding: 20px 16px;
    }

    #video #videoComposerBlock {
        max-width: 100%;
    }

    #video .video-v2-log-card {
        padding: 16px;
    }

    #video .chat-message.user .chat-message-content {
        max-width: min(90%, 760px);
    }
}

#video .video-v2-task-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

#video .video-task-query-status {
    min-height: 20px;
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
}

#video .video-task-query-status.success {
    color: #21c06d;
}

#video .video-task-query-status.error {
    color: #ff6b6b;
}

#video .video-v2-task-history {
    border: 1px solid #2f3645;
    border-radius: 12px;
    background: #14181f;
    padding: 10px;
    display: grid;
    gap: 8px;
}

#video .video-v2-task-history-title {
    font-size: 12px;
    color: #aab3c9;
}

#video .video-v2-task-history-list {
    display: grid;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}

#video .video-v2-task-history-item {
    border: 1px solid #2f3645;
    border-radius: 10px;
    background: #1a202b;
    padding: 8px;
    display: grid;
    gap: 6px;
}

#video .video-v2-task-history-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

#video .video-v2-task-id-btn {
    border: none;
    background: transparent;
    color: #d8e2f9;
    cursor: pointer;
    padding: 0;
    text-align: left;
    font-size: 12px;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#video .video-v2-task-status-tag {
    font-size: 11px;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 999px;
    border: 1px solid #3a4255;
    color: #aab3c9;
}

#video .video-v2-task-status-tag.succeeded {
    border-color: #2f7d52;
    color: #5ed494;
}

#video .video-v2-task-status-tag.running {
    border-color: #4868b7;
    color: #8badff;
}

#video .video-v2-task-status-tag.failed {
    border-color: #915050;
    color: #f09c9c;
}

#video .video-v2-task-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

#video .video-v2-task-mini-btn {
    border: 1px solid #3c4558;
    background: #232a38;
    color: #d9e3fb;
    border-radius: 8px;
    height: 26px;
    padding: 0 10px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

#video .video-v2-task-mini-btn:hover {
    border-color: #5677c8;
}

#video .video-v2-task-empty {
    font-size: 12px;
    color: #8f98ac;
    padding: 6px 2px;
}

#video .video-v2-task-preview {
    border: 1px solid #313744;
    border-radius: 12px;
    background: #11161e;
    padding: 10px;
    display: grid;
    gap: 10px;
}

#video .video-v2-task-preview video {
    width: 100%;
    max-height: 220px;
    border-radius: 10px;
    border: 1px solid #2b3240;
    background: #000;
}

#video .video-v2-param-panel {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    width: 360px;
    background: #181b21;
    border: 1px solid #313744;
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.44);
    padding: 24px;
    gap: 20px;
    z-index: 2000;
}

#video .video-v2-param-group {
    display: grid;
    gap: 10px;
}

#video .video-v2-param-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

#video .video-v2-btn-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

#video .video-v2-btn-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

#video .video-v2-param-panel .video-option-btn {
    padding: 6px;
    font-size: 12px;
    border: 1px solid #343b49;
    background: #1f232b;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    color: #9ea9bf;
}

#video .video-v2-param-panel .video-option-btn.active {
    border-color: #4968b8;
    color: #b6c8f3;
    background: #202a3f;
}

#video .video-v2-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

#video .video-v2-slider-row input[type="range"] {
    width: 100%;
}

#video .video-v2-slider-value {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}
