/* ═══════════════════════════════════════════════════════════════
   VEO Pipeline — Dashboard Stylesheet
   Dark mode with golden accents (biblical/cinematic theme)
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-card: #16161f;
    --bg-card-hover: #1c1c28;
    --bg-input: #1a1a25;

    --border: #2a2a3a;
    --border-light: #333345;

    --text-primary: #e8e6f0;
    --text-secondary: #9995aa;
    --text-muted: #665f77;

    --gold: #d4a853;
    --gold-dim: #b08a3a;
    --gold-glow: rgba(212, 168, 83, 0.15);

    --green: #4caf7c;
    --green-dim: rgba(76, 175, 124, 0.15);

    --red: #e85454;
    --red-dim: rgba(232, 84, 84, 0.12);

    --blue: #5b8ae8;
    --blue-dim: rgba(91, 138, 232, 0.12);

    --orange: #e89e3c;
    --orange-dim: rgba(232, 158, 60, 0.12);

    --purple: #9b72e8;

    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;

    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);

    --transition: all 0.2s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    cursor: url('/static/icon-wand-cursor.png') 4 4, auto;
}

a, button, .btn, .nav-icon-btn, .nav-productie-btn, select, .upload-zone, tr {
    cursor: url('/static/icon-wand-hover-cursor.png') 4 4, pointer !important;
}

a {
    color: var(--gold);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--gold-dim);
}

/* ── Layout ────────────────────────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ── Header / Nav ──────────────────────────────────────────── */
.nav {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.nav-brand .icon {
    font-size: 24px;
}

.nav-brand span {
    background: linear-gradient(135deg, var(--gold), #f0d080);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links a {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-links a:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.nav-links a.active {
    color: var(--gold);
    background: var(--gold-glow);
}

/* ── Page Header ───────────────────────────────────────────── */
.page-header {
    padding: 32px 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.page-header .subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold), var(--gold-dim));
    color: #0a0a0f;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(212, 168, 83, 0.3);
    color: #0a0a0f;
}

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

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

.btn-danger {
    background: var(--red-dim);
    color: var(--red);
    border: 1px solid rgba(232, 84, 84, 0.2);
}

.btn-danger:hover {
    background: rgba(232, 84, 84, 0.2);
}

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

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

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

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

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

.card-body {
    padding: 20px;
}

/* ── Flash Messages ────────────────────────────────────────── */
.flash-messages {
    padding: 16px 0 0;
}

.flash {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: flashIn 0.3s ease;
}

@keyframes flashIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.flash-success {
    background: var(--green-dim);
    color: var(--green);
    border: 1px solid rgba(76, 175, 124, 0.2);
}

.flash-error {
    background: var(--red-dim);
    color: var(--red);
    border: 1px solid rgba(232, 84, 84, 0.2);
}

.flash-warning {
    background: var(--orange-dim);
    color: var(--orange);
    border: 1px solid rgba(232, 158, 60, 0.2);
}

/* ── Job Table ─────────────────────────────────────────────── */
.job-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.job-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.job-table td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.job-table tbody tr {
    transition: var(--transition);
}

.job-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.job-table tbody tr:last-child td {
    border-bottom: none;
}

/* ── Status Badge ──────────────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-queued { background: var(--blue-dim); color: var(--blue); }
.status-processing { background: var(--gold-glow); color: var(--gold); }
.status-completed { background: var(--green-dim); color: var(--green); }
.status-failed { background: var(--red-dim); color: var(--red); }
.status-paused { background: var(--orange-dim); color: var(--orange); }
.status-pending { background: var(--bg-input); color: var(--text-muted); }

/* Processing animation */
.status-processing .spinner {
    width: 12px;
    height: 12px;
    border: 2px solid var(--gold-dim);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ── Progress Bar ──────────────────────────────────────────── */
.progress-bar {
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
    min-width: 80px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-dim), var(--gold));
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-bar-fill.complete {
    background: linear-gradient(90deg, #3a9464, var(--green));
}

.progress-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-family: 'JetBrains Mono', monospace;
}

/* ── Form Styling ──────────────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-glow);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    cursor: pointer;
}

/* ── File Upload Zone ──────────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--gold);
    background: var(--gold-glow);
}

.upload-zone .icon {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
}

.upload-zone .label {
    font-size: 14px;
    color: var(--text-secondary);
}

.upload-zone .label strong {
    color: var(--gold);
}

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

.upload-zone .file-name {
    margin-top: 8px;
    font-size: 13px;
    color: var(--green);
    font-family: 'JetBrains Mono', monospace;
}

/* ── Pipeline Steps ────────────────────────────────────────── */
.pipeline-steps {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pipeline-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
}

.pipeline-step:hover {
    background: var(--bg-card-hover);
}

.pipeline-step .step-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.pipeline-step.completed .step-icon {
    background: var(--green-dim);
    color: var(--green);
}

.pipeline-step.processing .step-icon {
    background: var(--gold-glow);
    color: var(--gold);
    animation: pulse 2s ease-in-out infinite;
}

.pipeline-step.pending .step-icon {
    background: var(--bg-input);
    color: var(--text-muted);
}

.pipeline-step.failed .step-icon {
    background: var(--red-dim);
    color: var(--red);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pipeline-step .step-name {
    flex: 1;
}

.pipeline-step .step-progress {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-muted);
}

.pipeline-step .step-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-muted);
    min-width: 80px;
    text-align: right;
}

/* ── Scene Table ───────────────────────────────────────────── */
.scene-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.scene-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 64px;
    background: var(--bg-card);
    z-index: 10;
}

.scene-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.scene-table tbody tr {
    transition: var(--transition);
    cursor: pointer;
}

.scene-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.scene-text {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scene-duration {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-secondary);
}

.scene-preview {
    display: none;
    padding: 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.scene-preview.active {
    display: block;
}

.scene-preview img {
    max-width: 400px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.scene-preview video {
    max-width: 400px;
    border-radius: var(--radius-sm);
}

/* ── Credits Info ──────────────────────────────────────────── */
.credits-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--gold-glow);
    border: 1px solid rgba(212, 168, 83, 0.2);
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.credits-value {
    font-size: 24px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--gold);
}

.credits-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ── Job Detail Stats ──────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Error Box ─────────────────────────────────────────────── */
.error-box {
    background: var(--red-dim);
    border: 1px solid rgba(232, 84, 84, 0.2);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--red);
}

.error-box code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    max-width: 400px;
    margin: 0 auto 20px;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
    .nav-inner {
        height: auto;
        padding: 12px 0;
        flex-direction: column;
        gap: 8px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header h1 {
        font-size: 22px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .scene-text {
        max-width: 160px;
    }

    .job-table {
        font-size: 13px;
    }

    .job-table th:nth-child(5),
    .job-table td:nth-child(5) {
        display: none;
    }
}

/* ── Utilities ─────────────────────────────────────────────── */
.mono { font-family: 'JetBrains Mono', monospace; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-gold { color: var(--gold); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
