/* ===== Root Variables ===== */
:root {
    --bg: #06080d;
    --bg-2: #0c0f18;
    --surface: #111622;
    --surface-2: #171d2e;
    --surface-3: #1e2640;
    --border: #232d45;
    --border-light: #2a3656;
    --text: #e8ecf4;
    --text-2: #9aa3b8;
    --text-3: #5c6580;
    --accent: #e63946;
    --accent-2: #ff6b7a;
    --accent-glow: rgba(230, 57, 70, 0.25);
    --green: #10b981;
    --green-bg: rgba(16, 185, 129, 0.12);
    --orange: #f59e0b;
    --orange-bg: rgba(245, 158, 11, 0.12);
    --blue: #3b82f6;
    --blue-bg: rgba(59, 130, 246, 0.12);
    --purple: #a78bfa;
    --purple-bg: rgba(167, 139, 250, 0.12);
    --red-bg: rgba(230, 57, 70, 0.12);
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    font-size: 14px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow: hidden;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* ===== Header ===== */
.header {
    height: 56px;
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: relative;
    z-index: 10;
}

.header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.4;
}

.header-left,
.logo {
    display: flex;
    align-items: center;
}

.logo {
    gap: 10px;
}

.logo h1 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.logo h1 span {
    color: var(--accent-2);
}

.badge-version {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    background: var(--accent-glow);
    color: var(--accent-2);
    border-radius: 20px;
    border: 1px solid rgba(230, 57, 70, 0.2);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

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

.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-3);
    padding: 4px 12px;
    background: var(--surface-2);
    border-radius: 20px;
    border: 1px solid var(--border);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-3);
    transition: var(--transition);
}

.connection-status.connected .status-dot {
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
}

.connection-status.connected .status-text {
    color: var(--green);
}

.connection-status.connected {
    border-color: rgba(16, 185, 129, 0.3);
}

/* ===== Layout ===== */
.main {
    display: flex;
    height: calc(100vh - 56px);
}

.sidebar {
    width: 300px;
    min-width: 300px;
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* ===== Panels ===== */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.model-panel-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 280px;
    overflow: hidden;
}

/* ===== Collapsible Panel ===== */
.panel-collapsible .panel-toggle {
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

.panel-collapsible .panel-toggle:hover {
    background: var(--surface-2);
}

.panel-chevron {
    transition: transform 0.25s ease;
    color: var(--text-3);
    flex-shrink: 0;
}

.panel-collapsible.collapsed .panel-chevron {
    transform: rotate(-90deg);
}

.panel-collapse {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    opacity: 1;
}

.panel-collapsible.collapsed .panel-collapse {
    max-height: 0;
    opacity: 0;
}

.panel-header {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h3 {
    font-size: 13px;
    font-weight: 600;
}

.panel-body {
    padding: 12px;
}

.panel-body-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* ===== Model Filter Bar ===== */
.model-filter-bar {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 7px;
    background: var(--surface-2);
}

.input-sm {
    height: 30px;
    font-size: 12px;
    padding: 4px 10px;
}

.filter-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.filter-tab {
    font-size: 10px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 20px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-3);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.filter-tab:hover {
    border-color: var(--border-light);
    color: var(--text-2);
}

.filter-tab.active {
    background: var(--accent-glow);
    border-color: rgba(230, 57, 70, 0.4);
    color: var(--accent-2);
}

.model-count {
    font-size: 11px;
    color: var(--text-3);
    font-weight: 500;
}

/* ===== Forms ===== */
label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    padding: 9px 12px;
    outline: none;
    transition: var(--transition);
}

.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.input-group {
    display: flex;
    gap: 6px;
}

.input-group .input {
    flex: 1;
}

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

.form-group:last-child {
    margin-bottom: 0;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #c62836);
    color: #fff;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-block {
    width: 100%;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-2);
}

.btn-ghost:hover {
    background: var(--surface-2);
    border-color: var(--border-light);
    color: var(--text);
}

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

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-2);
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-icon:hover {
    background: var(--surface-3);
    color: var(--text);
    border-color: var(--border-light);
}

.btn-icon.btn-xs {
    width: 26px;
    height: 26px;
    font-size: 11px;
}

/* ===== Generate Button ===== */
.btn-generate {
    padding: 0 32px;
    height: 48px;
    background: linear-gradient(135deg, #ff4444, #e53935, #c62828);
    color: #fff;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    border: none;
    box-shadow: 0 4px 24px rgba(229, 57, 53, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    z-index: 1;
}

.btn-generate-glow {
    position: absolute;
    inset: -2px;
    border-radius: 26px;
    background: linear-gradient(135deg, #ff4444, #e53935, #c62828, #ff4444);
    background-size: 300% 300%;
    animation: glowShift 3s ease infinite;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: -1;
    filter: blur(8px);
}

.btn-generate:hover:not(:disabled) .btn-generate-glow {
    opacity: 0.6;
}

@keyframes glowShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.btn-generate-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    transition: transform 0.3s;
}

.btn-generate:hover:not(:disabled) .btn-generate-icon {
    transform: translateY(-2px);
}

.btn-generate-arrow {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0;
    transform: translateX(-6px);
    transition: all 0.3s;
}

.btn-generate:hover:not(:disabled) .btn-generate-arrow {
    opacity: 1;
    transform: translateX(0);
}

.btn-generate::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
    transition: none;
}

.btn-generate:hover:not(:disabled)::before {
    animation: btnShimmer 1.5s ease;
}

@keyframes btnShimmer {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

.btn-generate:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(229, 57, 53, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-generate:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

.btn-generate:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    filter: grayscale(0.3);
}

/* ===== Stats ===== */
.stats-mini {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-size: 12px;
    color: var(--text-3);
}

.stat-value {
    font-size: 13px;
    font-weight: 600;
}

.stat-value.accent {
    color: var(--accent-2);
}

.progress-bar-wrap {
    margin-top: 10px;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-3);
    margin-bottom: 5px;
}

.progress-bar {
    height: 5px;
    background: var(--surface-3);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease, background 0.3s;
}

/* Key Detail Link */
.btn-key-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-key-detail:hover {
    background: var(--surface-3);
    color: var(--accent-2);
    border-color: rgba(230, 57, 70, 0.3);
}

/* ===== Model List ===== */
.model-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.model-card {
    padding: 9px 11px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.model-card:hover {
    background: var(--surface-3);
    border-color: var(--border-light);
}

.model-card.active {
    background: var(--surface-3);
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-glow);
}

.model-name {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
    line-height: 1.3;
}

.model-vendor {
    font-size: 10px;
    color: var(--text-3);
    margin-bottom: 4px;
}

.model-desc-short {
    font-size: 10px;
    color: var(--text-3);
    line-height: 1.4;
    margin-bottom: 5px;
}

.model-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.model-cost {
    font-size: 11px;
    color: var(--orange);
    font-weight: 600;
}

.model-type-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    white-space: nowrap;
}

.type-text-to-image {
    background: var(--blue-bg);
    color: var(--blue);
}

.type-image-to-video {
    background: var(--purple-bg);
    color: var(--purple);
}

.type-text-to-video {
    background: var(--green-bg);
    color: var(--green);
}

.type-video-to-video {
    background: var(--orange-bg);
    color: var(--orange);
}

.model-no-results {
    text-align: center;
    padding: 20px;
    font-size: 12px;
    color: var(--text-3);
}

/* ===== Placeholder ===== */
.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 40px;
    text-align: center;
}

.placeholder-icon {
    font-size: 52px;
    margin-bottom: 18px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.placeholder h2 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.placeholder p {
    font-size: 14px;
    color: var(--text-3);
    margin-bottom: 32px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 560px;
    width: 100%;
}

.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: left;
    transition: var(--transition);
}

.feature-card:hover {
    background: var(--surface-2);
    border-color: var(--border-light);
}

.feature-icon {
    font-size: 26px;
    margin-bottom: 10px;
}

.feature-title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 5px;
}

.feature-desc {
    font-size: 12px;
    color: var(--text-3);
    line-height: 1.5;
}

/* ===== Workspace ===== */
.workspace {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.prompt-section {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-2);
    position: relative;
    overflow: visible;
}

.prompt-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 12px;
}

.workspace-model-info {
    flex: 1;
    min-width: 0;
}

.workspace-model-info h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 3px;
}

.workspace-desc {
    font-size: 11px;
    color: var(--text-3);
    display: block;
    line-height: 1.4;
    max-width: 500px;
}

.cost-badge {
    font-size: 12px;
    color: var(--text-3);
    padding: 5px 12px;
    background: var(--surface);
    border-radius: 20px;
    border: 1px solid var(--border);
    white-space: nowrap;
    flex-shrink: 0;
}

.cost-badge strong {
    color: var(--orange);
}

/* ===== Global Drop Overlay ===== */
.global-drop-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(6, 8, 13, 0.85);
    border: 2px dashed var(--accent);
    border-radius: var(--radius-lg);
    z-index: 100;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.global-drop-overlay.active {
    display: flex;
}

.global-drop-inner {
    text-align: center;
    color: var(--accent-2);
}

.global-drop-icon {
    font-size: 48px;
    margin-bottom: 10px;
    animation: float 2s ease-in-out infinite;
}

/* ===== Textarea ===== */
.textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    padding: 12px;
    outline: none;
    resize: vertical;
    min-height: 80px;
    transition: var(--transition);
    line-height: 1.6;
}

.textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

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

/* ===== Workspace Body Layout ===== */
.workspace-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Text-only mode: prompt LEFT, params RIGHT */
.workspace-body.layout-text-only {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    align-items: start;
}

.workspace-body.layout-text-only .prompt-area {
    display: flex;
    flex-direction: column;
}

.workspace-body.layout-text-only .prompt-area .textarea {
    flex: 1;
    min-height: 200px;
    resize: none;
}

.workspace-body.layout-text-only .params-layout {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 0;
}

.workspace-body.layout-text-only .params-media {
    display: none;
}

.workspace-body.layout-text-only .params-controls {
    grid-column: 1 / -1;
}

/* ===== Params Layout (2-column: media left, controls right) ===== */
.params-layout {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 20px;
    margin-top: 14px;
    align-items: start;
}

.params-media {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Frames row: start + end frame side by side on desktop */
.frames-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.frames-row .frame-item {
    min-width: 0;
}

.params-controls {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* When no media dropzone is visible, controls take full width */
.params-media:empty+.params-controls,
.params-layout:has(.params-media:empty) .params-controls {
    grid-column: 1 / -1;
}

.param-field {
    margin-bottom: 0;
}

.param-hint {
    font-size: 10px;
    color: var(--text-3);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    margin-left: 4px;
}

.param-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.param-label-row label {
    margin-bottom: 0;
}

/* Radio Groups */
.radio-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.radio-card {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-2);
    transition: var(--transition);
    user-select: none;
    text-transform: none;
    letter-spacing: 0;
}

.radio-card input[type="radio"] {
    display: none;
}

.radio-card:hover {
    border-color: var(--border-light);
    color: var(--text);
}

.radio-card.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent-2);
    font-weight: 600;
}

.ratio-group {
    flex-wrap: wrap;
    gap: 5px;
}

.ratio-group .radio-card {
    padding: 5px 9px;
    font-size: 11px;
    min-width: auto;
}

/* ===== Slider ===== */
.slider-val {
    color: var(--accent-2);
    font-weight: 700;
    margin-left: 6px;
    font-size: 14px;
}

.slider-input {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 3px;
    background: var(--surface-3);
    outline: none;
    margin: 8px 0 4px;
    cursor: pointer;
    transition: var(--transition);
}

.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 0 3px var(--accent-glow);
    transition: var(--transition);
}

.slider-input::-webkit-slider-thumb:hover {
    background: var(--accent-2);
    box-shadow: 0 0 0 5px var(--accent-glow);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-3);
    text-transform: none;
    letter-spacing: 0;
}

/* ===== Dropzone ===== */
.dropzone {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg);
    transition: var(--transition);
}

.dropzone.drag-over {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
    background: var(--surface-2);
}

.dropzone-inner {
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropzone-inner:hover {
    background: var(--surface-2);
}

.dropzone-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-3);
    font-size: 12px;
    pointer-events: none;
}

.dropzone-svg-icon {
    width: 42px;
    height: 42px;
    color: var(--text-3);
    opacity: 0.5;
    transition: var(--transition);
    margin-bottom: 4px;
}

.dropzone:hover .dropzone-svg-icon,
.dropzone.drag-over .dropzone-svg-icon {
    opacity: 0.85;
    color: var(--accent-2);
}

.dropzone-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
}

.dropzone-or {
    font-size: 11px;
    color: var(--text-3);
}

.dropzone-browse {
    color: var(--blue);
    cursor: pointer;
    text-decoration: underline;
    pointer-events: all;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
}

.file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.dropzone-url {
    border-top: 1px solid var(--border);
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    font-size: 12px;
    padding: 8px 12px;
}

.dropzone-url:focus {
    border-color: var(--accent);
    border-radius: 0;
    box-shadow: none;
}

.dropzone-preview {
    position: relative;
    background: var(--bg);
}

.dropzone-preview img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

.dropzone-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.dropzone-remove:hover {
    background: var(--accent);
}

.upload-progress {
    height: 4px;
    background: var(--surface-3);
}

.upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
    animation: progressPulse 1.5s ease-in-out infinite;
}

@keyframes progressPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* ===== Image URLs (multi-slot) ===== */
.image-urls-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 6px;
}

.image-url-slot {
    display: flex;
    gap: 6px;
    align-items: center;
    animation: slideUp 0.2s ease;
}

.image-url-slot .input {
    flex: 1;
    font-size: 11px;
    padding: 6px 9px;
}

.slot-preview {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    background: var(--surface-2);
    border: 1px solid var(--border);
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: var(--text-3);
    position: relative;
    transition: var(--transition);
}

.slot-preview:hover {
    border-color: var(--accent);
}

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

.slot-preview input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.btn-remove-slot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    transition: var(--transition);
}

.btn-remove-slot:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ===== Prompt Actions ===== */
.prompt-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}

.shortcut-hint {
    font-size: 11px;
    color: var(--text-3);
}

/* ===== Results Section ===== */
.results-section {
    flex: 1;
    overflow-y: auto;
    padding: 18px 20px;
    background: var(--bg);
}

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

.results-header h3 {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.task-count {
    font-size: 10px;
    color: var(--text-3);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
    font-weight: 600;
}

.results-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    align-items: start;
}

.results-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-3);
    grid-column: 1 / -1;
}

.empty-icon {
    font-size: 42px;
    margin-bottom: 12px;
    opacity: 0.4;
    animation: float 3s ease-in-out infinite;
}

.results-empty p {
    font-size: 14px;
    font-weight: 500;
}

/* ===== Result Card ===== */
.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

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

.result-card.card-completed {
    border-color: rgba(16, 185, 129, 0.3);
}

.result-card.card-completed:hover {
    border-color: rgba(16, 185, 129, 0.6);
}

.result-card.card-failed {
    border-color: rgba(230, 57, 70, 0.3);
}

/* Card Media Header */
.result-media-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--surface-2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-3);
    font-size: 13px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    padding: 16px;
}

.result-media-placeholder.pulsing {
    background: linear-gradient(-45deg, var(--surface-2), var(--surface-3), var(--surface-2));
    background-size: 200% 200%;
    animation: placeholderShimmer 2s ease infinite;
    color: var(--blue);
    border-bottom-color: rgba(59, 130, 246, 0.2);
}

@keyframes placeholderShimmer {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.failed-placeholder {
    background: var(--red-bg);
    color: var(--accent);
    border-bottom-color: rgba(230, 57, 70, 0.2);
}

.result-media-gallery {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.output-media-item {
    position: relative;
    width: 100%;
    background: #000;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.output-media-item video,
.output-media-item img {
    width: 100%;
    max-height: 480px;
    object-fit: contain;
    display: block;
}

.output-hover-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: var(--transition);
}

.output-media-item:hover .output-hover-actions,
.output-hover-actions:hover {
    opacity: 1;
}

.output-hover-actions .btn-icon {
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    backdrop-filter: blur(4px);
    font-size: 13px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.output-hover-actions .btn-icon:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(1.05);
}

/* Card Content Body */
.result-card-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.result-model {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}

.result-status {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    flex-shrink: 0;
    white-space: nowrap;
}

.status-pending {
    background: var(--orange-bg);
    color: var(--orange);
}

.status-polling {
    background: var(--blue-bg);
    color: var(--blue);
}

.status-completed {
    background: var(--green-bg);
    color: var(--green);
}

.status-failed {
    background: var(--red-bg);
    color: var(--accent);
}

.result-prompt {
    font-size: 12px;
    color: var(--text-2);
    line-height: 1.5;
    background: var(--bg);
    padding: 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: pre-wrap;
    word-break: break-all;
}

.result-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-3);
    font-weight: 500;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Polling Indicator ===== */
.pulse-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--blue);
    margin-bottom: 8px;
    animation: pulseDot 1.4s ease-in-out infinite;
    box-shadow: 0 0 10px var(--blue);
}

@keyframes pulseDot {

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

    50% {
        opacity: 0.4;
        transform: scale(0.6);
        box-shadow: 0 0 2px var(--blue);
    }
}

/* ===== Spinner ===== */
.spinner {
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ===== Toast ===== */
#toastContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 10px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    animation: toastIn 0.3s ease;
    box-shadow: var(--shadow);
    max-width: 360px;
}

.toast-success {
    background: var(--green);
    color: #fff;
}

.toast-error {
    background: var(--accent);
    color: #fff;
}

.toast-info {
    background: var(--blue);
    color: #fff;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== Drawer Toggle (hidden on desktop) ===== */
.drawer-toggle {
    display: none;
    width: 36px;
    height: 36px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-2);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
    padding: 0;
    margin-right: 8px;
}

.drawer-toggle svg {
    width: 18px;
    height: 18px;
}

.drawer-toggle:hover {
    background: var(--surface-3);
    color: var(--text);
}

.drawer-backdrop {
    display: none;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .drawer-toggle {
        display: flex;
    }

    .drawer-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 90;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .drawer-open .drawer-backdrop {
        opacity: 1;
        visibility: visible;
    }

    .main {
        flex-direction: column;
        position: relative;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 300px;
        max-width: 85vw;
        min-width: auto;
        max-height: none;
        z-index: 100;
        border-right: 1px solid var(--border);
        border-bottom: none;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
        padding-top: 16px;
    }

    .drawer-open .sidebar {
        transform: translateX(0);
        box-shadow: 8px 0 40px rgba(0, 0, 0, 0.5);
    }

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

    .params-layout {
        grid-template-columns: 1fr;
    }

    .workspace-body.layout-text-only {
        grid-template-columns: 1fr;
    }

    .frames-row {
        grid-template-columns: 1fr;
    }

    .btn-generate {
        padding: 0 24px;
        height: 44px;
        font-size: 14px;
    }

    .prompt-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
}