/* Chassis — clean, dark UI */

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface-hover: #222633;
    --border: #2a2e3a;
    --text: #e4e4e7;
    --text-muted: #71717a;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ── Login ────────────────────────────────────────────────────────────────── */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 380px;
}

.login-card h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.login-card .subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    margin-top: 0.75rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
textarea,
select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
}

button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.25rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}

button:hover, .btn:hover {
    background: var(--accent-hover);
}

.login-card button {
    width: 100%;
    margin-top: 1.25rem;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */

.app {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

header nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

header nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.15s;
}

header nav a:hover { color: var(--text); }

/* ── Cards ────────────────────────────────────────────────────────────────── */

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

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.card:hover {
    border-color: var(--accent);
    background: var(--surface-hover);
}

.card h3 {
    font-size: 1rem;
    margin-bottom: 0.35rem;
}

.card p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.card .meta {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ── Empty state ──────────────────────────────────────────────────────────── */

.empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty p { margin-bottom: 1rem; }

/* ── Status badges ────────────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-draft { background: rgba(113, 113, 122, 0.2); color: var(--text-muted); }
.badge-scheduled { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge-recording { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.badge-recorded { background: rgba(99, 102, 241, 0.2); color: var(--accent); }
.badge-transcribed { background: rgba(99, 102, 241, 0.2); color: var(--accent-hover); }
.badge-editing { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge-published { background: rgba(34, 197, 94, 0.2); color: var(--success); }

/* ── Episode list ─────────────────────────────────────────────────────────── */

.episode-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.episode-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s;
}

.episode-row:hover { border-color: var(--accent); }

.episode-number {
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 2rem;
    text-align: right;
}

.episode-title {
    flex: 1;
    font-weight: 500;
}

.episode-actions {
    display: flex;
    gap: 0.5rem;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

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

.btn-outline:hover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: #dc2626;
}

/* ── Modal ────────────────────────────────────────────────────────────────── */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 440px;
}

.modal h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* ── Section headers ──────────────────────────────────────────────────────── */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

/* ── Back link ────────────────────────────────────────────────────────────── */

.back-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    display: inline-block;
}

.back-link:hover { color: var(--text); }

/* ── Show header ──────────────────────────────────────────────────────────── */

.show-header {
    margin-bottom: 2rem;
}

.show-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.show-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ── Episode detail ──────────────────────────────────────────────────────── */

.episode-detail-header {
    margin-bottom: 1.5rem;
}

.episode-detail-number {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.episode-detail-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.episode-detail-title-row h1 {
    font-size: 1.5rem;
}

/* ── Status workflow bar ─────────────────────────────────────────────────── */

.status-bar {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
}

.status-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.15s;
    flex-shrink: 0;
}

.status-step:hover { background: var(--surface-hover); }

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: transparent;
    transition: all 0.15s;
}

.status-step span {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    white-space: nowrap;
}

.status-complete .status-dot {
    background: var(--accent);
    border-color: var(--accent);
}

.status-complete span { color: var(--accent); }

.status-current .status-dot {
    background: var(--success);
    border-color: var(--success);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.status-current span {
    color: var(--success);
    font-weight: 600;
}

.status-future .status-dot {
    border-color: var(--border);
}

.status-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    min-width: 12px;
}

/* ── Episode fields ──────────────────────────────────────────────────────── */

.episode-fields {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.field-row {
    display: flex;
    gap: 1rem;
}

.field-group textarea {
    resize: vertical;
}

.episode-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.save-status {
    font-size: 0.8rem;
    align-self: center;
}

/* ── Description tabs ────────────────────────────────────────────────────── */

.desc-tabs {
    margin-bottom: 0.5rem;
}

.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.75rem;
}

.tab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.tab:hover { color: var(--text); }

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.field-hint {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: normal;
}

/* ── Clips section ───────────────────────────────────────────────────────── */

.clips-section {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.clips-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.clip-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s;
}

.clip-row:hover { border-color: var(--accent); }

.clip-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.clip-title { font-weight: 500; }

.clip-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
}

.clip-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.clip-link {
    font-size: 0.75rem;
    color: var(--accent);
    text-decoration: none;
}

.clip-link:hover { text-decoration: underline; }

.badge-cut { background: rgba(99, 102, 241, 0.2); color: var(--accent); }
.badge-uploaded { background: rgba(245, 158, 11, 0.2); color: var(--warning); }

@media (max-width: 640px) {
    .field-row { flex-direction: column; }
    .status-bar { padding: 0.75rem; }
}
