/* --- PROTECTION SHIELD (Prevents Theme Bleed) --- */
#vv-app-root {
  --bg: #0b0b12; --panel: #151520; --muted: #1c1c2a; --accent: #d900d9;
  --text: #e9e9f0; --sub: #9aa0b4; --line: #2b2b3b; --radius: 12px;
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;

  /* FORCE DARK THEME & RESET */
  background-color: var(--bg) !important; color: var(--text) !important;
  font-family: var(--font-main); line-height: 1.5; width: 100%; box-sizing: border-box;
  font-size: 14px; text-align: left;
}
#vv-app-root * { box-sizing: border-box; max-width: 100%; }

/* NOTIFICATION BAR */
#vv-app-root .vv-notification-bar {
    background: linear-gradient(135deg, #d900d9, #a000a0);
    padding: 10px 20px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    position: relative;
    z-index: 51;
}
#vv-app-root .vv-notification-content {
    transition: opacity 0.3s ease, transform 0.3s ease;
}
#vv-app-root .vv-notification-content a {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 2px;
}
#vv-app-root .vv-notification-content a:hover {
    text-decoration: none;
}
#vv-app-root .vv-notification-bar.maintenance {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* HEADER */
#vv-app-root .vv-topbar {
    display: flex; gap: 16px; align-items: center; padding: 0 20px;
    border-bottom: 1px solid var(--line); background: rgba(11, 11, 18, 0.95);
    position: sticky; top: 0; z-index: 50; height: 60px; flex-shrink: 0;
}
#vv-app-root .vv-brand { display: flex; gap: 10px; align-items: center; font-weight: 700; color: #fff; }
#vv-app-root .vv-badge { background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 999px; font-size: 10px; }

#vv-app-root .vv-btn {
    cursor: pointer; border: none; border-radius: 6px; padding: 6px 12px;
    display: inline-flex; gap: 8px; align-items: center; background: var(--muted);
    color: var(--text); font-weight: 500; font-size: 12px; text-decoration: none;
    line-height: 1; height: 32px; white-space: nowrap;
}
#vv-app-root .vv-btn:hover { filter: brightness(1.2); }
#vv-app-root .vv-btn:disabled { opacity: 0.5; cursor: not-allowed; }
#vv-app-root .vv-btn.primary { background: linear-gradient(135deg, #d900d9, #a000a0); color: #fff; }
#vv-app-root .vv-btn.ghost { background: transparent; border: 1px solid var(--line); }

/* MAIN LAYOUT (Video Tab) */
#vv-app-root .vv-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) 300px;
    gap: 16px; padding: 16px;
    max-width: 1800px; margin: 0 auto;
    height: 100%;
    overflow: hidden;
}

/* CARDS */
#vv-app-root .vv-card {
    background: var(--panel) !important; border: 1px solid var(--line); border-radius: var(--radius);
    display: flex; flex-direction: column; overflow: hidden; height: 100%;
}
#vv-app-root .vv-h {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-bottom: 1px solid var(--line); background: rgba(0,0,0,0.2); flex-shrink: 0;
}
#vv-app-root .vv-h h3 { margin: 0; font-size: 11px; color: var(--sub); text-transform: uppercase; font-weight: 700; }

/* LEFT: WORKFLOWS */
#vv-app-root .vv-wf-list { 
    padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; flex: 1; 
}
#vv-app-root .vv-wf {
    background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
    overflow: hidden; cursor: pointer; transition: all 0.2s;
    display: flex; flex-direction: column; flex-shrink: 0;
}
#vv-app-root .vv-wf:hover { border-color: var(--sub); transform: translateY(-1px); }
#vv-app-root .vv-wf.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
#vv-app-root .vv-wf-media { width: 100%; aspect-ratio: 3/4; background: #000; position: relative; }
#vv-app-root .vv-wf-media video, #vv-app-root .vv-wf-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
#vv-app-root .vv-wf-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--sub); font-size: 20px; }
#vv-app-root .vv-wf-tag { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.7); color: #fff; font-size: 9px; font-weight: 700; padding: 2px 4px; border-radius: 4px; }
#vv-app-root .vv-wf-fav { position: absolute; top: 4px; left: 4px; color: rgba(255,255,255,0.4); font-size: 16px; cursor: pointer; transition: all 0.2s; text-shadow: 0 1px 2px rgba(0,0,0,0.5); z-index: 2; }
#vv-app-root .vv-wf-fav:hover { color: rgba(255,255,255,0.8); transform: scale(1.1); }
#vv-app-root .vv-wf-fav.active { color: #ffd700; }
#vv-app-root .vv-wf-info { padding: 8px; }
#vv-app-root .vv-wf-info strong { display: block; font-size: 12px; margin-bottom: 2px; color: #fff; }
#vv-app-root .vv-wf-info small { display: block; font-size: 10px; color: var(--sub); line-height: 1.3; }
#vv-app-root .vv-wf-locked { opacity: 0.5; position: relative; }
#vv-app-root .vv-wf-locked:hover { opacity: 0.7; }
#vv-app-root .vv-wf-lock { position: absolute; bottom: 6px; right: 6px; font-size: 16px; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.8)); }

/* CENTER: WORKSPACE */
#vv-app-root .vv-center { padding: 16px; display: flex; flex-direction: column; gap: 16px; }

#vv-app-root .vv-stage { 
    display: grid; 
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); 
    gap: 16px; 
    flex: 1; min-height: 0; overflow: hidden; 
}

#vv-app-root .vv-drop, #vv-app-root .vv-preview {
    border: 2px dashed var(--line); border-radius: var(--radius);
    background: rgba(255,255,255,0.02); display: flex; flex-direction: column;
    align-items: center; justify-content: center; position: relative; overflow: hidden;
    height: 100%; width: 100%;
}
#vv-app-root .vv-drop:hover { border-color: var(--accent); }
#vv-app-root .vv-drop.has-image { border-style: solid; background: #000; }
#vv-app-root .vv-drop-img-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: none; }
#vv-app-root .vv-drop.has-image .vv-drop-img-preview { display: block; }
#vv-app-root .vv-drop.has-image .vv-hint { display: none; }
#vv-app-root .vv-hint { text-align: center; color: var(--sub); padding: 20px; font-size: 13px; }

/* CONTROLS */
#vv-app-root .vv-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; flex-shrink: 0; }
#vv-app-root #vv-standard-prompts { display: contents; }
#vv-app-root .vv-field label { display: block; color: var(--sub); font-size: 10px; margin-bottom: 4px; font-weight: 700; text-transform: uppercase; }
#vv-app-root .vv-field textarea {
    width: 100%; background: var(--bg); border: 1px solid var(--line);
    color: var(--text); padding: 8px; border-radius: 6px; resize: none; font-size: 12px; height: 70px;
}
#vv-app-root .vv-toolbar { 
    display: flex; align-items: center; justify-content: space-between; 
    background: var(--bg); padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line);
    flex-shrink: 0;
}
#vv-app-root .vv-status { display: flex; gap: 8px; align-items: center; font-family: monospace; font-size: 11px; color: var(--sub); }
#vv-app-root .vv-status-badge { background: var(--line); padding: 2px 5px; border-radius: 3px; color: #fff; }
#vv-app-root .vv-status-badge.active { background: var(--accent); }

/* PROGRESS BAR */
#vv-app-root .vv-progress-track { height: 4px; background: #333; margin-top: 5px; border-radius: 2px; overflow: hidden; display: none; flex-shrink: 0; }
#vv-app-root .vv-progress-fill {
    height: 100%; width: 0%; transition: width 0.3s;
    background-image: linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);
    background-size: 10px 10px; animation: vv-stripes 1s linear infinite;
}
#vv-app-root .vv-progress-fill.uploading { background-color: #7d8590; width: 20% !important; }
#vv-app-root .vv-progress-fill.queued { background-color: #b7a34a; width: 50% !important; }
#vv-app-root .vv-progress-fill.rendering { background-color: #d900d9; width: 85% !important; }
#vv-app-root .vv-progress-fill.done { background-color: #3fb950; width: 100% !important; animation: none; }
@keyframes vv-stripes { 0% { background-position: 0 0; } 100% { background-position: 10px 10px; } }

/* RIGHT: TOOLS */
#vv-app-root .vv-right { padding: 14px; display: grid; grid-template-rows: auto auto 1fr; gap: 14px; }
#vv-app-root .vv-preset-list { display: flex; flex-wrap: wrap; gap: 4px; }
#vv-app-root .vv-preset { padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); font-size: 11px; cursor: pointer; color: var(--sub); }
#vv-app-root .vv-preset:hover { border-color: var(--accent); color: #fff; }

/* JOB LIST ITEMS (Updated) */
#vv-app-root .vv-job-item {
    padding: 8px; background: var(--muted); border: 1px solid var(--line);
    margin-bottom: 6px; border-radius: 6px; font-size: 11px;
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; transition: all 0.2s;
}
#vv-app-root .vv-job-item:hover { background: #252535; }
#vv-app-root .vv-job-item.selected { border-color: var(--accent); background: #252535; box-shadow: 0 0 0 1px var(--accent); }

#vv-app-root .vv-history { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; flex: 1; }
#vv-app-root .vv-history-item {
    display: flex; gap: 8px; padding: 6px; background: var(--bg);
    border: 1px solid var(--line); border-radius: 6px; align-items: center; flex-shrink: 0;
    cursor: pointer; transition: background 0.2s;
}
#vv-app-root .vv-history-item:hover { background: var(--muted); border-color: var(--sub); }
#vv-app-root .vv-history-item img, #vv-app-root .vv-history-item video { width: 32px; height: 32px; border-radius: 3px; object-fit: cover; background: #000; display: block; }
#vv-app-root .vv-history-meta { display: flex; flex-direction: column; flex: 1; gap: 1px; }
#vv-app-root .vv-history-meta a { color: var(--accent); font-size: 10px; text-decoration: none; }

/* ========================================
   MOBILE RESPONSIVE - VIDEO TAB
   ======================================== */

/* Mobile containers - hidden on desktop */
#vv-app-root .vv-mobile-jobs { display: none; }
#vv-app-root .vv-mobile-history { display: none; }

/* Tablet: hide right sidebar, show mobile jobs */
@media (max-width: 1100px) {
    #vv-app-root .vv-layout { grid-template-columns: 240px minmax(0, 1fr); }
    #vv-app-root .vv-right { display: none; }
    #vv-app-root .vv-mobile-jobs { display: block; }
    #vv-app-root .vv-mobile-history { display: block; }
}

/* Phone landscape / small tablet */
@media (max-width: 800px) {
    /* Stack everything vertically */
    #vv-app-root .vv-layout {
        grid-template-columns: 1fr;
        height: auto;
        display: flex;
        flex-direction: column;
        overflow: visible;
        padding: 10px;
        gap: 10px;
    }
    #vv-app-root .vv-right { display: none; }

    /* Tab content should scroll */
    #vv-app-root .vv-tab-content {
        height: auto;
        min-height: calc(100vh - 110px);
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* Topbar compact */
    #vv-app-root .vv-topbar {
        padding: 0 12px;
        height: 50px;
        gap: 8px;
    }
    #vv-app-root .vv-brand-text { font-size: 14px; }
    #vv-app-root .vv-feedback-btn .vv-feedback-text { display: none; }
    #vv-app-root #creditDisplay { font-size: 11px; padding: 4px 8px; }

    /* Workflow sidebar becomes horizontal scroller */
    #vv-app-root .vv-card.vv-left {
        order: -1;
        height: auto;
        max-height: none;
        border-radius: 10px;
    }
    #vv-app-root .vv-wf-list {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding: 8px;
        gap: 10px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    #vv-app-root .vv-wf-list::-webkit-scrollbar { display: none; }
    #vv-app-root .vv-wf {
        flex: 0 0 160px;
        min-width: 160px;
        scroll-snap-align: start;
    }
    #vv-app-root .vv-wf-info strong { font-size: 11px; }
    #vv-app-root .vv-wf-info small { font-size: 9px; }
    #vv-app-root .vv-h { padding: 8px 10px; }
    #vv-app-root .vv-h h3 { font-size: 10px; }

    /* Center workspace card */
    #vv-app-root .vv-card.vv-center {
        border-radius: 10px;
        height: auto;
    }

    /* Stage: stack image + preview vertically */
    #vv-app-root .vv-stage {
        grid-template-columns: 1fr;
        height: auto;
        min-height: auto;
        gap: 10px;
        overflow: visible;
    }
    #vv-app-root .vv-drop {
        height: 220px;
        min-height: 180px;
        border-radius: 10px;
    }
    #vv-app-root .vv-preview {
        height: 220px;
        min-height: 180px;
        border-radius: 10px;
    }

    /* Controls: stack prompts vertically */
    #vv-app-root .vv-controls {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    #vv-app-root .vv-field textarea {
        font-size: 14px;
        padding: 10px;
        min-height: 60px;
    }
    #vv-app-root .vv-field label {
        font-size: 11px;
    }

    /* Make Enhance button more tappable */
    #vv-app-root #i2vEnhanceBtn {
        padding: 8px 16px !important;
        font-size: 13px !important;
        min-height: 36px;
    }

    /* Toolbar: make Run button prominent and sticky */
    #vv-app-root .vv-toolbar {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
        position: sticky;
        bottom: 0;
        z-index: 10;
        border-radius: 0 0 10px 10px;
    }
    #vv-app-root .vv-toolbar .vv-status {
        width: 100%;
        justify-content: center;
    }
    #vv-app-root .vv-toolbar > div:last-child {
        width: 100%;
        display: flex;
    }
    #vv-app-root .vv-toolbar .vv-btn.primary {
        flex: 1;
        padding: 14px 20px;
        font-size: 16px;
        font-weight: 600;
        border-radius: 10px;
        min-height: 48px;
    }
    #vv-app-root .vv-toolbar .vv-btn.ghost {
        min-height: 48px;
        padding: 14px 16px;
        font-size: 14px;
    }

    /* Progress track thicker */
    #vv-app-root .vv-progress-track {
        height: 6px;
        border-radius: 3px;
    }

    /* Mobile jobs container */
    #vv-app-root .vv-mobile-jobs {
        display: block;
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: 10px;
        overflow: hidden;
    }
    #vv-app-root .vv-mobile-jobs .vv-mobile-jobs-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 12px;
        border-bottom: 1px solid var(--line);
        background: rgba(0,0,0,0.2);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    #vv-app-root .vv-mobile-jobs .vv-mobile-jobs-header h3 {
        margin: 0;
        font-size: 11px;
        color: var(--sub);
        text-transform: uppercase;
        font-weight: 700;
    }
    #vv-app-root .vv-mobile-jobs .vv-mobile-jobs-badge {
        background: var(--accent);
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        padding: 2px 7px;
        border-radius: 10px;
        min-width: 18px;
        text-align: center;
    }
    #vv-app-root .vv-mobile-jobs .vv-mobile-jobs-badge.empty {
        background: var(--line);
        color: var(--sub);
    }
    #vv-app-root .vv-mobile-jobs-list {
        padding: 6px;
    }
    #vv-app-root .vv-mobile-jobs-list .vv-job-item {
        margin-bottom: 4px;
        padding: 10px 12px;
        font-size: 12px;
        min-height: 44px;
    }
    #vv-app-root .vv-mobile-jobs-list .vv-job-item:last-child {
        margin-bottom: 0;
    }

    /* Mobile history - collapsible */
    #vv-app-root .vv-mobile-history {
        display: block;
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: 10px;
        overflow: hidden;
    }
    #vv-app-root .vv-mobile-history .vv-mobile-history-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 12px;
        border-bottom: 1px solid var(--line);
        background: rgba(0,0,0,0.2);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    #vv-app-root .vv-mobile-history .vv-mobile-history-header h3 {
        margin: 0;
        font-size: 11px;
        color: var(--sub);
        text-transform: uppercase;
        font-weight: 700;
    }
    #vv-app-root .vv-mobile-history-list {
        padding: 6px;
        max-height: 200px;
        overflow-y: auto;
    }
    #vv-app-root .vv-mobile-history-list .vv-history-item {
        padding: 8px;
        min-height: 44px;
    }
    #vv-app-root .vv-mobile-history .vv-collapse-icon {
        color: var(--sub);
        font-size: 10px;
        transition: transform 0.2s;
    }
    #vv-app-root .vv-mobile-history.collapsed .vv-mobile-history-list { display: none; }
    #vv-app-root .vv-mobile-history.collapsed .vv-collapse-icon { transform: rotate(-90deg); }

    /* Main tabs: horizontal scroll */
    #vv-app-root .vv-main-tabs {
        padding: 0 8px;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        -webkit-overflow-scrolling: touch;
    }
    #vv-app-root .vv-main-tabs::-webkit-scrollbar { display: none; }
    #vv-app-root .vv-main-tab {
        padding: 10px 14px;
        font-size: 13px;
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* Phone portrait */
@media (max-width: 480px) {
    #vv-app-root .vv-layout { padding: 6px; gap: 6px; }

    /* Even more compact topbar */
    #vv-app-root .vv-topbar {
        padding: 0 8px;
        height: 44px;
        gap: 6px;
    }
    #vv-app-root .vv-brand svg { width: 16px; height: 16px; }
    #vv-app-root .vv-brand-text { font-size: 13px; }
    #vv-app-root .vv-badge { font-size: 8px; padding: 1px 5px; }
    #vv-app-root #creditDisplay { font-size: 10px; padding: 3px 6px; height: 26px; }
    #vv-app-root .vv-feedback-btn { padding: 3px 6px; height: 26px; }

    /* Tabs smaller */
    #vv-app-root .vv-main-tab {
        padding: 8px 10px;
        font-size: 12px;
    }

    /* Workflows compact */
    #vv-app-root .vv-wf {
        flex: 0 0 140px;
        min-width: 140px;
    }
    #vv-app-root .vv-wf-info { padding: 5px; }
    #vv-app-root .vv-wf-info strong { font-size: 10px; }

    /* Stage smaller */
    #vv-app-root .vv-drop, #vv-app-root .vv-preview {
        height: 180px;
        min-height: 150px;
    }
    #vv-app-root .vv-hint { padding: 12px; font-size: 12px; }
    #vv-app-root .vv-hint strong { font-size: 13px; }

    /* Controls */
    #vv-app-root .vv-field textarea {
        font-size: 14px;
        height: 50px;
        min-height: 50px;
    }

    /* Run button */
    #vv-app-root .vv-toolbar .vv-btn.primary {
        padding: 12px 16px;
        font-size: 15px;
        min-height: 44px;
    }

    /* Variation bar compact */
    #vv-app-root #i2vVariationBar {
        gap: 4px !important;
        font-size: 11px !important;
    }
}

/* FEEDBACK BUTTON */
#vv-app-root .vv-feedback-btn { gap: 6px; }
#vv-app-root .vv-feedback-btn .vv-feedback-icon { font-size: 14px; }

/* MODAL */
#vv-app-root .vv-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; opacity: 0; visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}
#vv-app-root .vv-modal-overlay.active { opacity: 1; visibility: visible; }
#vv-app-root .vv-modal {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); width: 90%; max-width: 450px;
    max-height: 90vh; overflow: hidden; display: flex; flex-direction: column;
    transform: scale(0.95); transition: transform 0.2s;
}
#vv-app-root .vv-modal-overlay.active .vv-modal { transform: scale(1); }
#vv-app-root .vv-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 15px 20px; border-bottom: 1px solid var(--line); background: rgba(0,0,0,0.2);
}
#vv-app-root .vv-modal-header h3 { margin: 0; font-size: 16px; color: #fff; }
#vv-app-root .vv-modal-close {
    background: none; border: none; color: var(--sub); font-size: 24px;
    cursor: pointer; padding: 0; line-height: 1; width: 30px; height: 30px;
}
#vv-app-root .vv-modal-close:hover { color: #fff; }
#vv-app-root .vv-modal-body { padding: 20px; overflow-y: auto; }
#vv-app-root .vv-modal-body .vv-field { margin-bottom: 15px; }
#vv-app-root .vv-modal-body select,
#vv-app-root .vv-modal-body input[type="text"] {
    width: 100%; background: var(--bg); border: 1px solid var(--line);
    color: var(--text); padding: 10px; border-radius: 6px; font-size: 13px;
}
#vv-app-root .vv-modal-body select { height: 40px; }
#vv-app-root .vv-modal-body textarea {
    width: 100%; background: var(--bg); border: 1px solid var(--line);
    color: var(--text); padding: 10px; border-radius: 6px; font-size: 13px;
    resize: vertical; min-height: 100px;
}

/* CREDITS MODAL */
#vv-app-root .vv-credits-modal { max-width: 380px; text-align: center; }
#vv-app-root .vv-credits-modal .vv-modal-header { justify-content: center; position: relative; }
#vv-app-root .vv-credits-modal .vv-modal-header h3 { color: var(--accent); }
#vv-app-root .vv-credits-modal .vv-modal-close { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); }

/* ========================================
   MAIN TABS (Image / Video)
   ======================================== */
#vv-app-root .vv-main-tabs {
    display: flex;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 0 20px;
    flex-shrink: 0;
}
#vv-app-root .vv-main-tab {
    padding: 14px 24px;
    font-size: 14px;
    font-weight: 600;
    color: var(--sub);
    cursor: pointer;
    background: none;
    border: none;
    outline: none;
    position: relative;
    transition: color 0.2s;
    font-family: var(--font-main);
    letter-spacing: 0.01em;
}
#vv-app-root .vv-main-tab::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: transparent;
    transition: background 0.2s;
}
#vv-app-root .vv-main-tab:hover {
    color: var(--text);
}
#vv-app-root .vv-main-tab:focus {
    outline: none;
}
#vv-app-root .vv-main-tab.active {
    color: var(--accent);
}
#vv-app-root .vv-main-tab.active::after {
    background: var(--accent);
}

/* ========================================
   TAB CONTENT CONTAINERS
   ======================================== */
#vv-app-root .vv-tab-content {
    display: none;
    height: calc(100vh - 110px);
    overflow: hidden;
    width: 100%;
}
#vv-app-root .vv-tab-content.active {
    display: flex;
}

/* Video tab fills container */
#vv-app-root #tabVideo .vv-layout {
    width: 100%;
    min-height: 100%;
}

/* ========================================
   IMAGE TAB LAYOUT (Three-Column)
   ======================================== */
#vv-app-root .vv-image-layout {
    display: grid;
    grid-template-columns: 380px minmax(0, 1fr) 200px;
    gap: 0;
    width: 100%;
    height: 100%;
}

/* T2I PANEL (Left Side) */
#vv-app-root .vv-t2i-panel {
    background: var(--panel);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* T2I Sub-tabs (Describe / Settings) */
#vv-app-root .vv-t2i-sub-tabs {
    display: flex;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}
#vv-app-root .vv-t2i-sub-tab {
    flex: 1;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--sub);
    cursor: pointer;
    text-align: center;
    background: none;
    border: none;
    transition: all 0.2s;
}
#vv-app-root .vv-t2i-sub-tab:hover {
    color: var(--text);
    background: rgba(255,255,255,0.03);
}
#vv-app-root .vv-t2i-sub-tab.active {
    color: var(--accent);
    background: rgba(217, 0, 217, 0.08);
}

/* T2I Tab Content */
#vv-app-root .vv-t2i-tab-content {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}
#vv-app-root .vv-t2i-tab-content.active {
    display: flex;
}

/* T2I Controls Container (scrollable) */
#vv-app-root .vv-t2i-controls {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ========================================
   T2I FORM FIELDS
   ======================================== */
#vv-app-root .vv-t2i-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
#vv-app-root .vv-t2i-field label {
    font-size: 11px;
    font-weight: 600;
    color: var(--sub);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
#vv-app-root .vv-t2i-field textarea,
#vv-app-root .vv-t2i-field input[type="text"],
#vv-app-root .vv-t2i-field input[type="number"] {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--text);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    transition: border-color 0.2s;
}
#vv-app-root .vv-t2i-field textarea:focus,
#vv-app-root .vv-t2i-field input:focus {
    outline: none;
    border-color: var(--accent);
}
#vv-app-root .vv-t2i-field textarea {
    resize: none;
    min-height: 80px;
}
#vv-app-root .vv-t2i-field textarea.small {
    min-height: 50px;
}

/* T2I Suggestion Chips */
#vv-app-root .vv-t2i-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
#vv-app-root .vv-t2i-chip {
    padding: 5px 12px;
    background: var(--muted);
    border: 1px solid var(--line);
    border-radius: 16px;
    color: var(--sub);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
#vv-app-root .vv-t2i-chip:hover {
    background: var(--line);
    color: var(--text);
    border-color: var(--sub);
}

/* Prompt Wrapper with Enhance Button */
#vv-app-root .vv-t2i-prompt-wrapper {
    position: relative;
}
#vv-app-root .vv-enhance-btn {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 32px;
    height: 32px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}
#vv-app-root .vv-enhance-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}
#vv-app-root .vv-enhance-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
#vv-app-root .vv-enhance-btn.loading {
    animation: enhance-pulse 1s ease-in-out infinite;
}
@keyframes enhance-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
}
#vv-app-root .vv-enhance-undo {
    position: absolute;
    right: 8px;
    bottom: 8px;
    font-size: 11px;
    color: var(--accent);
    cursor: pointer;
    background: var(--card);
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid var(--line);
    transition: all 0.2s;
}
#vv-app-root .vv-enhance-undo:hover {
    background: var(--muted);
}

/* Enhance nudge pulse */
#vv-app-root .vv-enhance-btn.nudge-pulse {
    animation: nudge-glow 1.5s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(102, 126, 234, 0.6);
}
@keyframes nudge-glow {
    0%, 100% { transform: scale(1); box-shadow: 0 0 8px rgba(102, 126, 234, 0.4); }
    50% { transform: scale(1.15); box-shadow: 0 0 18px rgba(102, 126, 234, 0.8); }
}

/* Enhance tooltip */
#vv-app-root .vv-enhance-tooltip {
    position: absolute;
    right: 0;
    top: -32px;
    background: linear-gradient(135deg, #6c2bd9, #667eea);
    color: #fff;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 10;
    animation: tooltipFadeIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}
#vv-app-root .vv-enhance-tooltip::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 16px;
    width: 10px;
    height: 10px;
    background: #667eea;
    transform: rotate(45deg);
}
@keyframes tooltipFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Pre-generate enhance nudge */
#vv-app-root .vv-enhance-nudge {
    margin-top: 8px;
    animation: tooltipFadeIn 0.3s ease;
}
#vv-app-root .vv-enhance-nudge-inner {
    background: linear-gradient(135deg, rgba(108, 43, 217, 0.15), rgba(102, 126, 234, 0.15));
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #ccc;
    font-size: 13px;
}
#vv-app-root .vv-enhance-nudge-btns {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Suggestions Wrapper with Shuffle */
#vv-app-root .vv-t2i-suggestions-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 8px;
}
#vv-app-root .vv-t2i-suggestions-wrapper .vv-t2i-suggestions {
    flex: 1;
    margin-top: 0;
}
#vv-app-root .vv-shuffle-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: 1px solid var(--line);
    background: var(--muted);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
#vv-app-root .vv-shuffle-btn:hover {
    background: var(--line);
    border-color: var(--sub);
}
#vv-app-root .vv-shuffle-btn.spinning {
    animation: shuffle-spin 0.3s ease-out;
}
@keyframes shuffle-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(180deg); }
}

/* T2I Select/Dropdown */
#vv-app-root .vv-t2i-select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--text);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239aa0b4' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
#vv-app-root .vv-t2i-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Dropdown Grid (for multiple side-by-side) */
#vv-app-root .vv-t2i-dropdown-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ========================================
   BUTTON GROUPS
   ======================================== */
#vv-app-root .vv-t2i-btn-group {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
#vv-app-root .vv-t2i-btn-group button {
    flex: 1;
    min-width: 60px;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--sub);
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}
#vv-app-root .vv-t2i-btn-group button:hover {
    border-color: var(--sub);
    color: var(--text);
}
#vv-app-root .vv-t2i-btn-group button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ========================================
   SLIDERS
   ======================================== */
#vv-app-root .vv-t2i-slider-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
#vv-app-root .vv-t2i-slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#vv-app-root .vv-t2i-slider-header label {
    font-size: 11px;
    font-weight: 600;
    color: var(--sub);
    text-transform: uppercase;
}
#vv-app-root .vv-t2i-slider-value {
    font-size: 12px;
    color: var(--text);
    font-weight: 500;
}
#vv-app-root .vv-t2i-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #6366f1 0%, #6366f1 var(--slider-fill, 50%), var(--line) var(--slider-fill, 50%), var(--line) 100%);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}
#vv-app-root .vv-t2i-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #6366f1;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
}
#vv-app-root .vv-t2i-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}
#vv-app-root .vv-t2i-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #6366f1;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
}

/* ========================================
   TOGGLE SWITCH
   ======================================== */
#vv-app-root .vv-t2i-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}
#vv-app-root .vv-t2i-toggle-row label {
    font-size: 12px;
    color: var(--text);
    font-weight: 500;
}
#vv-app-root .vv-t2i-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    cursor: pointer;
}
#vv-app-root .vv-t2i-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
#vv-app-root .vv-t2i-toggle-track {
    position: absolute;
    inset: 0;
    background: var(--line);
    border-radius: 12px;
    transition: background 0.2s;
}
#vv-app-root .vv-t2i-toggle input:checked + .vv-t2i-toggle-track {
    background: var(--accent);
}
#vv-app-root .vv-t2i-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
#vv-app-root .vv-t2i-toggle input:checked ~ .vv-t2i-toggle-thumb {
    transform: translateX(20px);
}

/* ========================================
   SEED FIELD
   ======================================== */
#vv-app-root .vv-t2i-seed-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
#vv-app-root .vv-t2i-seed-row input[type="number"] {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--text);
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-family: monospace;
}
#vv-app-root .vv-t2i-seed-row input:disabled {
    opacity: 0.5;
}
#vv-app-root .vv-t2i-seed-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--muted);
    border: 1px solid var(--line);
    border-radius: 6px;
    cursor: pointer;
    color: var(--sub);
    font-size: 14px;
    transition: all 0.2s;
}
#vv-app-root .vv-t2i-seed-btn:hover {
    background: var(--line);
    color: var(--text);
}
#vv-app-root .vv-t2i-seed-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ========================================
   CHARACTER SELECTOR
   ======================================== */
#vv-app-root .vv-t2i-character-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
#vv-app-root .vv-t2i-character-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--sub);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}
#vv-app-root .vv-coming-soon-badge {
    font-size: 9px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
#vv-app-root .vv-t2i-character-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
#vv-app-root .vv-t2i-character-item {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--line);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--muted);
}
#vv-app-root .vv-t2i-character-item:hover {
    border-color: var(--sub);
}
#vv-app-root .vv-t2i-character-item.selected {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}
#vv-app-root .vv-t2i-character-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
#vv-app-root .vv-t2i-character-item.none {
    background: var(--bg);
    border-style: solid;
}
#vv-app-root .vv-t2i-character-item.none svg {
    width: 24px;
    height: 24px;
    color: var(--sub);
}
#vv-app-root .vv-t2i-character-item.add {
    border: 2px dashed var(--line);
    background: transparent;
}
#vv-app-root .vv-t2i-character-item.add:hover {
    border-color: #6366f1;
    color: #6366f1;
}
#vv-app-root .vv-t2i-character-item .add-icon {
    font-size: 20px;
    color: var(--sub);
}
#vv-app-root .vv-t2i-character-help {
    font-size: 12px;
    color: var(--sub);
    line-height: 1.4;
}
#vv-app-root .vv-t2i-character-help a {
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
}
#vv-app-root .vv-t2i-character-help a:hover {
    text-decoration: underline;
}

/* ========================================
   ATTRIBUTES SECTION
   ======================================== */
#vv-app-root .vv-t2i-attributes {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
    margin-top: 8px;
}
#vv-app-root .vv-t2i-attributes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#vv-app-root .vv-t2i-attributes-header .vv-t2i-attr-title {
    display: flex;
    align-items: center;
    gap: 8px;
}
#vv-app-root .vv-t2i-attributes-header .vv-t2i-attr-title span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
#vv-app-root .vv-t2i-badge-new {
    background: #6366f1;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}
#vv-app-root .vv-t2i-attributes-header .vv-t2i-disable-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--sub);
}
#vv-app-root .vv-t2i-attributes-help {
    font-size: 12px;
    color: var(--sub);
    line-height: 1.4;
}
#vv-app-root .vv-t2i-attributes-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
#vv-app-root .vv-t2i-attr-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
#vv-app-root .vv-t2i-attr-label {
    display: flex;
    align-items: center;
    gap: 8px;
}
#vv-app-root .vv-t2i-attr-label .attr-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sub);
}
#vv-app-root .vv-t2i-attr-label .attr-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}
#vv-app-root .vv-t2i-attr-slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
#vv-app-root .vv-t2i-attr-slider-row .vv-t2i-slider {
    flex: 1;
}
#vv-app-root .vv-t2i-attr-slider-row .attr-value {
    min-width: 70px;
    text-align: right;
    font-size: 13px;
    color: var(--text);
}

/* ========================================
   T2I FOOTER (Create Button + Cost)
   ======================================== */
#vv-app-root .vv-t2i-footer {
    padding: 16px;
    border-top: 1px solid var(--line);
    background: rgba(0,0,0,0.2);
    flex-shrink: 0;
}
#vv-app-root .vv-t2i-create-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #d900d9, #a000a0);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
}
#vv-app-root .vv-t2i-create-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}
#vv-app-root .vv-t2i-create-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
#vv-app-root .vv-t2i-cost {
    font-size: 12px;
    opacity: 0.9;
}

/* ========================================
   IMAGE PREVIEW PANEL (Right Side)
   ======================================== */
#vv-app-root .vv-image-preview-panel {
    background: var(--bg);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}
#vv-app-root .vv-image-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}
#vv-app-root .vv-image-preview-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
#vv-app-root .vv-image-preview-actions {
    display: flex;
    gap: 8px;
}
#vv-app-root #btnUseInVideo {
    color: var(--accent);
}
#vv-app-root #btnUseInVideo:hover {
    background: var(--accent);
    color: #fff;
}
#vv-app-root #btnUseInVideo:hover svg {
    stroke: #fff;
}
#vv-app-root .vv-image-preview-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
}
#vv-app-root .vv-image-preview-empty {
    text-align: center;
    color: var(--sub);
}
#vv-app-root .vv-image-preview-empty .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}
#vv-app-root .vv-image-preview-empty p {
    margin: 0;
    font-size: 14px;
}

/* Image Grid Display */
#vv-app-root .vv-image-grid {
    display: grid;
    gap: 12px;
    width: 100%;
    height: 100%;
    max-width: 100%;
}
#vv-app-root .vv-image-grid.grid-1 {
    grid-template-columns: 1fr;
}
#vv-app-root .vv-image-grid.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}
#vv-app-root .vv-image-grid.grid-4 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}
#vv-app-root .vv-image-grid-item {
    border-radius: 8px;
    overflow: hidden;
    background: var(--panel);
    position: relative;
    cursor: pointer;
}
#vv-app-root .vv-image-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
#vv-app-root .vv-image-grid-item:hover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(217, 0, 217, 0.1);
    border: 2px solid var(--accent);
    border-radius: 8px;
}

/* Button Spinner */
#vv-app-root .vv-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: vv-spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

/* Generation Progress */
#vv-app-root .vv-t2i-generating {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: var(--text);
}
#vv-app-root .vv-t2i-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: vv-spin 1s linear infinite;
}
@keyframes vv-spin {
    to { transform: rotate(360deg); }
}
#vv-app-root .vv-t2i-progress-text {
    font-size: 14px;
    color: var(--sub);
}

/* T2I Progress Section */
#vv-app-root .vv-t2i-progress-section {
    padding: 12px 16px;
    border-top: 1px solid var(--line);
    background: rgba(0,0,0,0.2);
    flex-shrink: 0;
}
#vv-app-root .vv-t2i-status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
#vv-app-root .vv-t2i-progress-section .vv-status-badge {
    background: var(--line);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    color: var(--sub);
    text-transform: uppercase;
}
#vv-app-root .vv-t2i-progress-section .vv-status-badge.active {
    background: var(--accent);
    color: #fff;
}
#vv-app-root .vv-t2i-progress-section .vv-status-text {
    font-size: 12px;
    color: var(--text);
}
#vv-app-root .vv-t2i-progress-section .vv-progress-track {
    height: 4px;
    background: #333;
    border-radius: 2px;
    overflow: hidden;
}
#vv-app-root .vv-t2i-progress-section .vv-progress-fill {
    height: 100%;
    width: 0%;
    transition: width 0.3s;
    background-image: linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);
    background-size: 10px 10px;
    animation: vv-stripes 1s linear infinite;
}
#vv-app-root .vv-t2i-progress-section .vv-progress-fill.uploading {
    background-color: #7d8590;
    width: 20%;
}
#vv-app-root .vv-t2i-progress-section .vv-progress-fill.queued {
    background-color: #b7a34a;
    width: 50%;
}
#vv-app-root .vv-t2i-progress-section .vv-progress-fill.rendering {
    background-color: #d900d9;
    width: 85%;
}
#vv-app-root .vv-t2i-progress-section .vv-progress-fill.done {
    background-color: #3fb950;
    width: 100%;
    animation: none;
}

/* ========================================
   T2I HISTORY SIDEBAR
   ======================================== */
#vv-app-root .vv-t2i-history-sidebar {
    background: var(--panel);
    border-left: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}
#vv-app-root .vv-t2i-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}
#vv-app-root .vv-t2i-history-header h3 {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--sub);
    text-transform: uppercase;
}
#vv-app-root .vv-t2i-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
#vv-app-root .vv-t2i-history-thumb {
    width: 100%;
    aspect-ratio: 9/16;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    flex-shrink: 0;
}
#vv-app-root .vv-t2i-history-thumb:hover {
    border-color: var(--sub);
    transform: scale(1.02);
}
#vv-app-root .vv-t2i-history-thumb.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(217, 0, 217, 0.3);
}
#vv-app-root .vv-t2i-history-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
#vv-app-root .vv-t2i-history-empty {
    text-align: center;
    color: var(--sub);
    font-size: 12px;
    padding: 20px 10px;
}

/* Image History Thumbnails (bottom of preview panel) - OLD, keep for video */
#vv-app-root .vv-image-history {
    padding: 12px 16px;
    border-top: 1px solid var(--line);
    flex-shrink: 0;
}
#vv-app-root .vv-image-history h4 {
    margin: 0 0 10px 0;
    font-size: 11px;
    color: var(--sub);
    text-transform: uppercase;
    font-weight: 600;
}
#vv-app-root .vv-image-history-grid {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}
#vv-app-root .vv-image-history-grid::-webkit-scrollbar {
    height: 4px;
}
#vv-app-root .vv-image-history-grid::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 2px;
}
#vv-app-root .vv-image-history-thumb {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}
#vv-app-root .vv-image-history-thumb:hover {
    border-color: var(--sub);
}
#vv-app-root .vv-image-history-thumb.active {
    border-color: var(--accent);
}
#vv-app-root .vv-image-history-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========================================
   MOBILE RESPONSIVE - IMAGE TAB
   ======================================== */
/* Hide history sidebar on medium screens */
@media (max-width: 1200px) {
    #vv-app-root .vv-image-layout {
        grid-template-columns: 380px minmax(0, 1fr);
    }
    #vv-app-root .vv-t2i-history-sidebar {
        display: none;
    }
}

@media (max-width: 900px) {
    /* Image layout: stack vertically */
    #vv-app-root .vv-image-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: auto;
    }

    /* Hide history sidebar */
    #vv-app-root .vv-t2i-history-sidebar {
        display: none;
    }

    /* T2I Panel adjustments */
    #vv-app-root .vv-t2i-panel {
        border-right: none;
        border-bottom: 1px solid var(--line);
        max-height: none;
        height: auto;
    }

    /* Controls container - reduce padding */
    #vv-app-root .vv-t2i-controls {
        padding: 12px;
        gap: 12px;
        max-height: 50vh;
    }

    /* Preview panel */
    #vv-app-root .vv-image-preview-panel {
        min-height: 300px;
    }

    /* Preview container padding */
    #vv-app-root .vv-image-preview-container {
        padding: 12px;
    }
}

@media (max-width: 768px) {
    /* Main tabs - smaller */
    #vv-app-root .vv-main-tabs {
        padding: 0 12px;
    }
    #vv-app-root .vv-main-tab {
        padding: 12px 16px;
        font-size: 13px;
    }

    /* Tab content height */
    #vv-app-root .vv-tab-content {
        height: auto;
        min-height: calc(100vh - 120px);
    }

    /* Image layout */
    #vv-app-root .vv-image-layout {
        display: flex;
        flex-direction: column;
    }

    /* T2I panel takes less space */
    #vv-app-root .vv-t2i-controls {
        max-height: 45vh;
        overflow-y: auto;
    }

    /* Dropdown grid - stack on very small */
    #vv-app-root .vv-t2i-dropdown-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Button groups - wrap nicely */
    #vv-app-root .vv-t2i-btn-group button {
        min-width: 50px;
        padding: 8px 10px;
        font-size: 11px;
    }

    /* Character grid - 3 columns */
    #vv-app-root .vv-t2i-character-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Seed row - smaller buttons */
    #vv-app-root .vv-t2i-seed-btn {
        width: 32px;
        height: 32px;
    }

    /* Footer - fixed at bottom */
    #vv-app-root .vv-t2i-footer {
        padding: 12px;
    }
    #vv-app-root .vv-t2i-create-btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    /* Preview panel */
    #vv-app-root .vv-image-preview-panel {
        min-height: 250px;
        flex: 1;
    }

    /* Image grid on mobile */
    #vv-app-root .vv-image-grid {
        gap: 8px;
    }
    #vv-app-root .vv-image-grid.grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    /* History thumbnails smaller */
    #vv-app-root .vv-image-history {
        padding: 10px 12px;
    }
    #vv-app-root .vv-image-history-thumb {
        flex: 0 0 40px;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    /* Very small screens */
    #vv-app-root .vv-main-tab {
        padding: 10px 12px;
        font-size: 12px;
    }

    /* Reduce control padding more */
    #vv-app-root .vv-t2i-controls {
        padding: 10px;
        gap: 10px;
        max-height: 40vh;
    }

    /* Smaller text areas */
    #vv-app-root .vv-t2i-field textarea {
        min-height: 60px;
    }
    #vv-app-root .vv-t2i-field textarea.small {
        min-height: 40px;
    }

    /* Sub-tabs smaller */
    #vv-app-root .vv-t2i-sub-tab {
        padding: 10px 12px;
        font-size: 12px;
    }

    /* Button groups more compact */
    #vv-app-root .vv-t2i-btn-group {
        gap: 3px;
    }
    #vv-app-root .vv-t2i-btn-group button {
        min-width: 44px;
        padding: 7px 8px;
        font-size: 10px;
    }

    /* Character grid - 4 columns still but smaller */
    #vv-app-root .vv-t2i-character-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        padding: 10px;
        max-height: 140px;
    }

    /* Attributes content smaller */
    #vv-app-root .vv-t2i-attributes-content {
        padding: 10px;
        gap: 10px;
    }

    /* Slider thumb smaller */
    #vv-app-root .vv-t2i-slider::-webkit-slider-thumb {
        width: 14px;
        height: 14px;
    }
    #vv-app-root .vv-t2i-slider::-moz-range-thumb {
        width: 14px;
        height: 14px;
    }

    /* Create button */
    #vv-app-root .vv-t2i-create-btn {
        padding: 11px 14px;
        font-size: 13px;
        border-radius: 8px;
    }

    /* Preview empty icon smaller */
    #vv-app-root .vv-image-preview-empty .icon {
        font-size: 36px;
    }
    #vv-app-root .vv-image-preview-empty p {
        font-size: 13px;
    }

    /* Generating spinner smaller */
    #vv-app-root .vv-t2i-spinner {
        width: 40px;
        height: 40px;
    }
}
/* ==================== STORYBOARD TAB ==================== */
#vv-app-root .vv-storyboard-layout { padding: 20px; max-width: 1400px; margin: 0 auto; }
#vv-app-root .vv-storyboard-setup { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 30px; }
#vv-app-root .vv-storyboard-setup h3 { margin: 0 0 8px 0; color: #fff; font-size: 16px; }
#vv-app-root .vv-storyboard-hint { color: #888; font-size: 12px; margin: 0 0 12px 0; }

/* Base image selector */
#vv-app-root .vv-storyboard-base-selector { display: flex; gap: 16px; margin-bottom: 12px; }
#vv-app-root .vv-storyboard-base-preview { width: 150px; height: 150px; background: #1a1a1a; border: 2px dashed #333; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #666; font-size: 12px; text-align: center; flex-shrink: 0; overflow: hidden; }
#vv-app-root .vv-storyboard-base-preview img { width: 100%; height: 100%; object-fit: cover; }
#vv-app-root .vv-storyboard-base-list { display: flex; flex-wrap: wrap; gap: 8px; max-height: 140px; overflow: hidden; flex: 1; }
#vv-app-root .vv-sb-thumb { position: relative; width: 60px; height: 60px; border-radius: 6px; overflow: hidden; cursor: pointer; border: 2px solid transparent; transition: all 0.2s; }
#vv-app-root .vv-sb-thumb-delete { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; background: rgba(0,0,0,0.7); color: #fff; border: none; font-size: 14px; line-height: 16px; cursor: pointer; display: none; padding: 0; text-align: center; z-index: 2; }
#vv-app-root .vv-sb-thumb:hover .vv-sb-thumb-delete { display: block; }
#vv-app-root .vv-sb-thumb-delete:hover { background: #d90000; }
#vv-app-root .vv-sb-thumb:hover { border-color: #666; transform: scale(1.05); }
#vv-app-root .vv-sb-thumb.active { border-color: var(--accent, #d900d9); box-shadow: 0 0 10px rgba(217, 0, 217, 0.3); }
#vv-app-root .vv-sb-thumb img { width: 100%; height: 100%; object-fit: cover; }
#vv-app-root .vv-sb-empty { color: #666; font-size: 12px; text-align: center; padding: 20px; }

/* Base info */
#vv-app-root .vv-storyboard-base-info { background: #1a1a1a; padding: 10px 12px; border-radius: 6px; font-size: 11px; color: #aaa; }
#vv-app-root .vv-storyboard-base-info div { margin-bottom: 4px; }
#vv-app-root .vv-storyboard-base-info div:last-child { margin-bottom: 0; }
#vv-app-root .vv-storyboard-base-info strong { color: #888; }
#vv-app-root .vv-storyboard-base-info span { color: #ccc; word-break: break-word; }

/* Story concept */
#vv-app-root .vv-storyboard-concept textarea { width: 100%; height: 100px; background: #1a1a1a; border: 1px solid #333; border-radius: 8px; padding: 12px; color: #fff; font-size: 14px; resize: vertical; margin-bottom: 12px; }
#vv-app-root .vv-storyboard-concept textarea:focus { border-color: var(--accent, #d900d9); outline: none; }
#vv-app-root .vv-storyboard-concept .vv-btn { width: 100%; }

/* Cards section */
#vv-app-root .vv-storyboard-cards-section h3 { color: #fff; font-size: 16px; margin: 0 0 16px 0; }
#vv-app-root .vv-storyboard-cards-hint { color: #666; font-size: 12px; font-weight: normal; }
#vv-app-root .vv-storyboard-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; background: linear-gradient(135deg, #1a1a1a 0%, #252525 50%, #1a1a1a 100%); padding: 24px; border-radius: 16px; border: 1px solid #333; box-shadow: inset 0 2px 20px rgba(0,0,0,0.3); }
#vv-app-root .vv-storyboard-empty { grid-column: 1 / -1; text-align: center; padding: 60px 20px; color: #888; }
#vv-app-root .vv-storyboard-empty p { margin: 0; }

/* Individual cards */
#vv-app-root .vv-sb-card { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.2); transition: transform 0.2s, box-shadow 0.2s; }
#vv-app-root .vv-sb-card:hover { transform: translateY(-4px) rotate(1deg); box-shadow: 0 8px 20px rgba(0,0,0,0.4); }
#vv-app-root .vv-sb-card.generating { opacity: 0.7; }
#vv-app-root .vv-sb-card-image { aspect-ratio: 1; background: #222; display: flex; align-items: center; justify-content: center; }
#vv-app-root .vv-sb-card-image img { width: 100%; height: 100%; object-fit: cover; }
#vv-app-root .vv-sb-card-placeholder { color: #555; font-size: 14px; font-weight: bold; }
#vv-app-root .vv-sb-card-prompt { padding: 10px; font-size: 10px; color: #333; line-height: 1.4; max-height: 60px; overflow-y: auto; background: #f5f5f5; }
#vv-app-root .vv-sb-card-actions { display: flex; gap: 6px; padding: 8px; background: #eee; }
#vv-app-root .vv-sb-card-actions .vv-btn { flex: 1; font-size: 11px; padding: 6px 8px; }
#vv-app-root .vv-sb-card-actions .vv-btn.ghost { flex: 0; padding: 6px 10px; }

/* Mobile responsive */
@media (max-width: 1024px) {
    #vv-app-root .vv-storyboard-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    #vv-app-root .vv-storyboard-setup { grid-template-columns: 1fr; }
    #vv-app-root .vv-storyboard-base-selector { flex-direction: column; }
    #vv-app-root .vv-storyboard-base-preview { width: 100%; height: 200px; }
    #vv-app-root .vv-storyboard-cards { grid-template-columns: repeat(2, 1fr); padding: 16px; }
}


/* Storyboard tab needs scrolling */
#vv-app-root #tabStoryboard {
    overflow-y: auto;
    flex-direction: column;
}
#vv-app-root #tabStoryboard::-webkit-scrollbar { width: 8px; }
#vv-app-root #tabStoryboard::-webkit-scrollbar-track { background: #1a1a1a; }
#vv-app-root #tabStoryboard::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
#vv-app-root #tabStoryboard::-webkit-scrollbar-thumb:hover { background: #555; }


/* Storyboard card status and progress */
#vv-app-root .vv-sb-card-status {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.85);
    padding: 8px;
    text-align: center;
}
#vv-app-root .vv-sb-status-text {
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
#vv-app-root .vv-sb-progress-track {
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    overflow: hidden;
}
#vv-app-root .vv-sb-progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}
#vv-app-root .vv-sb-progress-fill.queued {
    width: 30%;
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    animation: sb-pulse 1.5s ease-in-out infinite;
}
#vv-app-root .vv-sb-progress-fill.rendering {
    width: 70%;
    background: linear-gradient(90deg, #d900d9, #ff00ff);
    animation: sb-progress 2s ease-in-out infinite;
}
@keyframes sb-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}
@keyframes sb-progress {
    0% { width: 40%; }
    50% { width: 85%; }
    100% { width: 40%; }
}
#vv-app-root .vv-sb-card.generating .vv-sb-card-placeholder {
    opacity: 0.5;
}
#vv-app-root .vv-sb-card-image {
    position: relative;
}

/* Card header with controls */
#vv-app-root .vv-sb-card-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; background: #222; border-bottom: 1px solid #333; }
#vv-app-root .vv-sb-card-number { font-size: 11px; font-weight: bold; color: #888; }
#vv-app-root .vv-sb-card-controls { display: flex; gap: 4px; }
#vv-app-root .vv-sb-ctrl { width: 22px; height: 22px; border: none; border-radius: 4px; background: #333; color: #999; cursor: pointer; font-size: 10px; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
#vv-app-root .vv-sb-ctrl:hover:not(:disabled) { background: #444; color: #fff; }
#vv-app-root .vv-sb-ctrl:disabled { opacity: 0.3; cursor: not-allowed; }
#vv-app-root .vv-sb-ctrl.delete:hover:not(:disabled) { background: #a33; color: #fff; }

/* Add card button */
#vv-app-root .vv-sb-add-card { background: transparent; border: 2px dashed #333; display: flex; align-items: center; justify-content: center; min-height: 280px; transition: all 0.2s; }
#vv-app-root .vv-sb-add-card:hover { border-color: #555; background: rgba(255,255,255,0.02); transform: none; box-shadow: none; }
#vv-app-root .vv-sb-add-btn { background: none; border: none; color: #666; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px; transition: color 0.2s; }
#vv-app-root .vv-sb-add-btn:hover { color: var(--accent, #d900d9); }
#vv-app-root .vv-sb-add-icon { font-size: 36px; line-height: 1; }
#vv-app-root .vv-sb-add-btn span:last-child { font-size: 13px; }

/* ==================== STORYBOARD VIDEO FEATURES ==================== */

/* Video overlay button */
#vv-app-root .vv-sb-video-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 5;
}
#vv-app-root .vv-sb-video-btn:hover {
    background: var(--accent, #d900d9);
    transform: scale(1.1);
}

/* Download button */
#vv-app-root .vv-sb-download-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 5;
}
#vv-app-root .vv-sb-download-btn:hover {
    background: var(--accent, #d900d9);
}

/* Media navigation */
#vv-app-root .vv-sb-media-nav {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.7);
    padding: 4px 10px;
    border-radius: 20px;
    z-index: 5;
}
#vv-app-root .vv-sb-media-nav button {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
#vv-app-root .vv-sb-media-nav button:hover:not(:disabled) {
    background: rgba(255,255,255,0.2);
}
#vv-app-root .vv-sb-media-nav button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
#vv-app-root .vv-sb-media-nav span {
    color: #fff;
    font-size: 12px;
    min-width: 30px;
    text-align: center;
}

/* Card image container needs position relative for overlays */
#vv-app-root .vv-sb-card-image {
    position: relative;
}
#vv-app-root .vv-sb-card-image video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Video modal */
.vv-sb-video-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}
.vv-sb-video-modal-content {
    background: #1a1a1a;
    border-radius: 16px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.vv-sb-video-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #333;
}
.vv-sb-video-modal-header h3 {
    margin: 0;
    color: #fff;
    font-size: 18px;
}
.vv-sb-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #333;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.vv-sb-modal-close:hover {
    background: #444;
    color: #fff;
}

/* Workflow grid */
.vv-sb-workflow-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 20px;
    overflow-y: auto;
    max-height: 400px;
}
.vv-sb-wf-card {
    background: #252525;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}
.vv-sb-wf-card:hover {
    border-color: #444;
    transform: translateY(-2px);
}
.vv-sb-wf-card.selected {
    border-color: var(--accent, #d900d9);
    box-shadow: 0 0 15px rgba(217, 0, 217, 0.3);
}
.vv-sb-wf-preview {
    aspect-ratio: 16/9;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.vv-sb-wf-preview video,
.vv-sb-wf-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.vv-sb-wf-placeholder {
    color: #555;
    font-size: 24px;
}
.vv-sb-wf-name {
    padding: 10px;
    color: #ccc;
    font-size: 12px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Modal footer */
.vv-sb-video-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-top: 1px solid #333;
    background: #151515;
}
.vv-sb-video-cost {
    color: #888;
    font-size: 14px;
}
.vv-sb-video-modal-footer .vv-btn {
    min-width: 180px;
}
.vv-sb-video-modal-footer .vv-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}

/* Responsive modal */
@media (max-width: 600px) {
    .vv-sb-workflow-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Editable prompt */
#vv-app-root .vv-sb-card-prompt {
    cursor: pointer;
    transition: background 0.2s;
}
#vv-app-root .vv-sb-card-prompt:hover:not(.editing) {
    background: #e8e8e8;
}
#vv-app-root .vv-sb-card-prompt.editing {
    padding: 0;
    background: #fff;
}
#vv-app-root .vv-sb-prompt-edit {
    width: 100%;
    height: 60px;
    padding: 10px;
    border: none;
    border-radius: 0;
    background: #fff;
    color: #333;
    font-size: 10px;
    line-height: 1.4;
    resize: none;
    outline: none;
    box-shadow: inset 0 0 0 2px var(--accent, #d900d9);
}

/* Video prompt section in modal */
.vv-sb-video-prompt-section {
    padding: 16px 20px;
    border-top: 1px solid #333;
}
.vv-sb-video-prompt-section label {
    display: block;
    color: #ccc;
    font-size: 13px;
    margin-bottom: 8px;
}
.vv-sb-video-prompt-section textarea {
    width: 100%;
    height: 70px;
    background: #252525;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 10px;
    color: #fff;
    font-size: 13px;
    resize: vertical;
}
.vv-sb-video-prompt-section textarea:focus {
    outline: none;
    border-color: var(--accent, #d900d9);
}
.vv-sb-video-prompt-section textarea::placeholder {
    color: #666;
}

/* ==================== STORYBOARD EXPORT FEATURES ==================== */

/* Checkbox on media */
#vv-app-root .vv-sb-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 5;
    cursor: pointer;
}
#vv-app-root .vv-sb-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}
#vv-app-root .vv-sb-checkmark {
    display: block;
    width: 24px;
    height: 24px;
    background: rgba(0,0,0,0.6);
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 4px;
    transition: all 0.2s;
}
#vv-app-root .vv-sb-checkbox:hover .vv-sb-checkmark {
    border-color: #fff;
    background: rgba(0,0,0,0.8);
}
#vv-app-root .vv-sb-checkbox input:checked ~ .vv-sb-checkmark {
    background: var(--accent, #d900d9);
    border-color: var(--accent, #d900d9);
}
#vv-app-root .vv-sb-checkmark:after {
    content: '';
    display: none;
    position: absolute;
    left: 8px;
    top: 4px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
#vv-app-root .vv-sb-checkbox input:checked ~ .vv-sb-checkmark:after {
    display: block;
}

/* Export bar */
#vv-app-root .vv-sb-export-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #2a1a2a 0%, #1a1a2a 100%);
    border: 1px solid var(--accent, #d900d9);
    border-radius: 10px;
    padding: 12px 20px;
    margin-bottom: 16px;
    color: #fff;
}
#vv-app-root .vv-sb-export-bar span {
    font-size: 14px;
}
#vv-app-root .vv-sb-export-actions {
    display: flex;
    gap: 10px;
}

/* Video dropdown menu */
#vv-app-root .vv-sb-dropdown {
    position: relative;
    display: inline-block;
}

#vv-app-root .vv-sb-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    min-width: 200px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    z-index: 100;
    padding: 8px;
}

#vv-app-root .vv-sb-dropdown-menu.active {
    display: block;
}

#vv-app-root .vv-sb-dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 8px;
    color: #fff;
    text-align: left;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 4px;
}

#vv-app-root .vv-sb-dropdown-menu button:last-child {
    margin-bottom: 0;
}

#vv-app-root .vv-sb-dropdown-menu button:hover {
    background: var(--accent, #d900d9);
    transform: translateX(2px);
}

#vv-app-root .vv-sb-dropdown-menu button .vv-dropdown-icon {
    font-size: 14px;
    flex-shrink: 0;
}

/* ========================================
   SCENE CHAIN STYLES
   ======================================== */

.vv-chain-container {
    padding: 20px;
    max-width: 1200px;
    margin: 0;
}

.vv-chain-header {
    margin-bottom: 20px;
}

.vv-chain-header h2 {
    margin: 0 0 5px 0;
    color: #fff;
}

.vv-chain-header p {
    margin: 0;
    color: #888;
    font-size: 14px;
}

.vv-chain-layout {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 30px;
}

.vv-chain-left {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.vv-chain-section {
    background: #1a1a1a;
    border-radius: 12px;
    padding: 20px;
}

.vv-chain-section h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #888;
    text-transform: uppercase;
}

.vv-chain-image-upload {
    cursor: pointer;
}

.vv-chain-preview {
    min-height: 200px;
    background: #222;
    border: 2px dashed #444;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 14px;
    transition: border-color 0.2s;
}

.vv-chain-preview:hover {
    border-color: #666;
}

.vv-chain-preview img {
    max-width: 100%;
    max-height: 250px;
    border-radius: 8px;
}

.vv-chain-workflow-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vv-chain-step {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #222;
    padding: 12px;
    border-radius: 8px;
}

.vv-chain-step-num {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #ff6b9d, #c44569);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    flex-shrink: 0;
}

.vv-chain-workflow-select {
    flex: 1;
    background: #333;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 8px 10px;
    color: #fff;
    font-size: 13px;
}

.vv-chain-remove-btn {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    font-size: 16px;
    transition: color 0.2s;
}

.vv-chain-remove-btn:hover {
    color: #ff4444;
}

.vv-chain-cost {
    text-align: center;
    padding: 10px;
    background: #222;
    border-radius: 8px;
    color: #888;
    margin-bottom: 10px;
}

.vv-chain-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    background: #1a1a1a;
    border-radius: 8px;
    color: #888;
}

.vv-chain-right {
    background: #1a1a1a;
    border-radius: 12px;
    padding: 20px;
}

.vv-chain-right h3 {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #888;
    text-transform: uppercase;
}

.vv-chain-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.vv-chain-result {
    background: #222;
    border-radius: 8px;
    padding: 15px;
}

.vv-chain-result-header {
    font-size: 13px;
    color: #888;
    margin-bottom: 10px;
}

.vv-chain-result video {
    max-height: 180px;
    width: auto;
    max-width: 100%;
}

@media (max-width: 950px) {
    .vv-chain-layout {
        grid-template-columns: 1fr;
    }
}
/* Fix chain tab scrolling */
#tabChain {
    overflow-y: auto;
    max-height: calc(100vh - 120px);
}

.vv-chain-container {
    min-height: auto;
    padding-bottom: 40px;
}

.vv-chain-left {
    max-height: none;
    overflow: visible;
}

/* Override for chain tab scrolling - more specific */
#vv-app-root #tabChain.vv-tab-content {
    overflow-y: auto !important;
    overflow-x: hidden;
}

#vv-app-root #tabChain .vv-chain-container {
    height: auto;
    min-height: 100%;
}

/* Chain Step Layout */
.vv-chain-step {
    display: flex;
    flex-direction: column !important;
    background: #222;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.vv-chain-step-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.vv-chain-step-prompt {
    width: 100%;
    margin-top: 10px;
    box-sizing: border-box;
}

.vv-chain-prompt-input {
    width: 100%;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 10px 12px;
    color: #fff;
    font-size: 13px;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
    box-sizing: border-box;
}

.vv-chain-prompt-input::placeholder {
    color: #555;
}

.vv-chain-prompt-input:focus {
    border-color: #ff6b9d;
    outline: none;
    background: #222;
}


/* Play overlay for workflow thumbnails */
#vv-app-root .vv-wf-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    pointer-events: none;
}
#vv-app-root .vv-wf-media { position: relative; }

/* Video play indicator for storyboard cards */
#vv-app-root .vv-sb-card-image video {
    cursor: pointer;
}
#vv-app-root .vv-sb-card-image video:not(:hover)::before {
    content: "▶";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    color: rgba(255,255,255,0.8);
    pointer-events: none;
}
#vv-app-root .vv-sb-card-image {
    position: relative;
}
#vv-app-root .vv-sb-card-image video[data-card-idx]:not(:hover) + .vv-play-overlay,
#vv-app-root .vv-sb-card-image:has(video:paused)::after {
    content: "▶ Hover to play";
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    pointer-events: none;
}

/* Membership Badge Styles */
#vv-app-root .vv-member-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 10px;
    vertical-align: middle;
}

#vv-app-root .vv-tier-plus {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: #fff;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

#vv-app-root .vv-tier-premium {
    background: linear-gradient(135deg, #9C27B0, #7B1FA2);
    color: #fff;
    box-shadow: 0 2px 4px rgba(156, 39, 176, 0.3);
}

#vv-app-root .vv-tier-pro {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #1a1a1a;
    box-shadow: 0 2px 4px rgba(255, 215, 0, 0.3);
}

/* ===== AI CHARACTER / FACESWAP STYLES ===== */

#vv-app-root .vv-t2i-character-section {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

#vv-app-root .vv-t2i-character-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

#vv-app-root .vv-t2i-character-label svg {
    width: 18px;
    height: 18px;
    fill: var(--accent);
}

#vv-app-root .vv-t2i-character-upload-area {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

#vv-app-root .vv-t2i-character-preview {
    width: 80px;
    height: 80px;
    border: 2px dashed var(--line);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: var(--bg);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

#vv-app-root .vv-t2i-character-preview:hover {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), 0.05);
}

#vv-app-root .vv-t2i-character-preview.has-image {
    border-style: solid;
    border-color: var(--accent);
}

#vv-app-root .vv-t2i-character-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

#vv-app-root .vv-upload-hint {
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    padding: 8px;
}

#vv-app-root .vv-t2i-character-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

#vv-app-root .vv-t2i-character-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

#vv-app-root .vv-t2i-character-remove {
    background: transparent;
    color: var(--danger, #e53935);
    border: 1px solid var(--danger, #e53935);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

#vv-app-root .vv-t2i-character-remove:hover {
    background: var(--danger, #e53935);
    color: #fff;
}

#vv-app-root .vv-t2i-character-help {
    font-size: 12px;
    color: var(--muted);
    margin: 8px 0 0 0;
}

/* Highlight animation for validation */
@keyframes vv-highlight-pulse {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.4); }
}

#vv-app-root .vv-highlight {
    animation: vv-highlight-pulse 0.6s ease-out 2;
}

/* Attributes section fade-in */
#vv-app-root .vv-t2i-attributes {
    transition: opacity 0.3s ease, max-height 0.3s ease;
}

#vv-app-root .vv-t2i-attributes.vv-fade-in {
    animation: vv-fade-in 0.3s ease;
}

@keyframes vv-fade-in {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* SCENE WORKFLOW - Multi-prompt fields (inside .vv-stage grid) */
#vv-app-root #vv-scene-prompts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding: 12px;
    border: 2px solid var(--line, #222);
    border-radius: var(--radius, 8px);
    background: rgba(255,255,255,0.02);
}
#vv-app-root .vv-scene-prompt-field {
    background: rgba(217, 0, 217, 0.05);
    border: 1px solid rgba(217, 0, 217, 0.15);
    border-radius: 8px;
    padding: 10px 12px;
}
#vv-app-root .vv-scene-label {
    display: block;
    color: var(--accent, #d900d9);
    font-size: 10px;
    margin-bottom: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
#vv-app-root .vv-scene-textarea {
    width: 100%;
    background: var(--bg, #0b0b12);
    border: 1px solid var(--line, #222);
    color: var(--text, #e0e0e0);
    padding: 8px;
    border-radius: 6px;
    resize: none;
    font-size: 12px;
    height: 60px;
    font-family: inherit;
}
#vv-app-root .vv-scene-textarea:focus {
    border-color: var(--accent, #d900d9);
    outline: none;
}
@media (max-width: 1100px) {
    #vv-app-root #vv-scene-prompts {
        gap: 8px;
    }
    #vv-app-root .vv-scene-textarea {
        height: 50px;
        font-size: 11px;
    }
}

/* ==================== AUDIO TAB ==================== */
#vv-app-root .vv-audio-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr) 300px;
    gap: 12px;
    padding: 12px;
    height: calc(100vh - 140px);
    min-height: 500px;
}
#vv-app-root .vv-audio-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    overflow-y: auto;
}
#vv-app-root .vv-audio-panel .vv-t2i-create-btn {
    display: block;
    text-align: center;
}
#vv-app-root .vv-audio-drop {
    position: relative;
    border: 2px dashed var(--line);
    border-radius: var(--radius);
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s;
}
#vv-app-root .vv-audio-drop:hover {
    border-color: var(--accent);
}
#vv-app-root .vv-audio-drop.has-image .vv-hint { display: none; }
#vv-app-root .vv-audio-drop .vv-drop-img-preview {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none;
}
#vv-app-root .vv-audio-drop.has-image .vv-drop-img-preview { display: block; }
#vv-app-root .vv-audio-preview-panel {
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 0;
}
#vv-app-root .vv-audio-preview {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a14;
    min-height: 0;
}
#vv-app-root .vv-audio-preview video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
#vv-app-root .vv-audio-history-sidebar {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
#vv-app-root .vv-audio-history-sidebar .vv-h {
    flex-shrink: 0;
}
#vv-app-root .vv-audio-history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    overflow-y: auto;
}

/* Audio responsive */
@media (max-width: 1100px) {
    #vv-app-root .vv-audio-layout {
        grid-template-columns: 300px minmax(0, 1fr);
        height: auto;
    }
    #vv-app-root .vv-audio-history-sidebar {
        display: none;
    }
    #vv-app-root .vv-audio-preview {
        min-height: 350px;
    }
}
@media (max-width: 768px) {
    #vv-app-root .vv-audio-layout {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 10px;
    }
    #vv-app-root .vv-audio-panel {
        max-height: none;
        order: 1;
    }
    #vv-app-root .vv-audio-preview-panel {
        order: 2;
        min-height: 300px;
    }
    #vv-app-root .vv-audio-history-sidebar {
        display: flex;
        order: 3;
        max-height: 200px;
    }
    #vv-app-root .vv-audio-drop {
        height: 80px;
    }
}
