/* ============================================================
   Cinematica — Stylesheet
   ============================================================ */

:root {
  --bg: #0a0a0c;
  --bg2: #111114;
  --bg3: #1a1a1f;
  --fg: #e4e4ea;
  --muted: #7a7a88;
  --accent: #a78bfa;
  --accent2: #7c3aed;
  --teal: #5eead4;
  --amber: #fbbf24;
  --green: #4ade80;
  --red: #f87171;
  --border: #27272f;
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--fg); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif; font-size: 14px; line-height: 1.5; }

/* --- AUTH PAGE --- */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-box { width: 100%; max-width: 380px; padding: 40px 32px; text-align: center; }
.auth-logo { font-size: 32px; font-weight: 700; margin-bottom: 4px; }
.auth-subtitle { color: var(--muted); font-size: 13px; margin-bottom: 28px; }
.auth-error { background: rgba(248,113,113,0.1); border: 1px solid var(--red); color: var(--red); padding: 8px 12px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-switch { margin-top: 20px; font-size: 13px; color: var(--muted); }
.auth-switch a { color: var(--accent); text-decoration: none; }

/* --- INPUTS --- */
.input, select, textarea { width: 100%; background: var(--bg2); border: 1px solid var(--border); color: var(--fg); padding: 8px 12px; border-radius: var(--radius); font-size: 13px; font-family: inherit; outline: none; transition: border-color 0.15s; }
.input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; }
select { cursor: pointer; }

/* --- BUTTONS --- */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg3); color: var(--fg); font-size: 13px; cursor: pointer; transition: all 0.15s; font-family: inherit; }
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent2); border-color: var(--accent2); color: #fff; }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #111; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; }
.btn-danger { color: var(--red); }
.btn-danger:hover { border-color: var(--red); }

/* --- APP LAYOUT --- */
.app-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; border-bottom: 1px solid var(--border); }
.app-header h1 { font-size: 16px; font-weight: 600; }
.app-header .back { color: var(--muted); font-size: 13px; text-decoration: none; margin-right: 16px; }
.app-header .back:hover { color: var(--fg); }

/* --- TABS --- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 24px; }
.tab { background: none; border: none; padding: 10px 16px; color: var(--muted); cursor: pointer; font-size: 13px; border-bottom: 2px solid transparent; font-family: inherit; }
.tab.active { color: var(--fg); border-color: var(--accent); }
.tab:hover { color: var(--fg); }

/* --- CONTENT --- */
.content { padding: 24px; max-width: 1100px; margin: 0 auto; }

/* --- SECTION --- */
.section { margin-bottom: 28px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-header h2 { font-size: 16px; font-weight: 600; }
.section-header .add-btn { color: var(--accent); font-size: 13px; cursor: pointer; background: none; border: none; font-family: inherit; }
.section-header .add-btn:hover { text-decoration: underline; }

/* --- CARD --- */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.card-title.purple { color: var(--accent); }
.card-title.teal { color: var(--teal); }
.card-title.amber { color: var(--amber); }

/* --- GRID --- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.col-span-2 { grid-column: span 2; }

/* --- FIELD --- */
.field { margin-bottom: 0; }
.field label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }

/* --- LOCK PREVIEW --- */
.lock-preview { margin-top: 12px; padding: 10px 12px; background: var(--bg3); border-radius: 6px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.lock-preview.purple { border-left: 3px solid var(--accent); }
.lock-preview.teal { border-left: 3px solid var(--teal); }
.lock-preview.amber { border-left: 3px solid var(--amber); }
.lock-preview b { color: var(--accent); }
.lock-preview.teal b { color: var(--teal); }
.lock-preview.amber b { color: var(--amber); }

/* --- PRESETS --- */
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.preset-btn { padding: 4px 12px; font-size: 12px; border-radius: 999px; background: var(--bg3); border: 1px solid var(--border); color: var(--muted); cursor: pointer; font-family: inherit; transition: all 0.15s; }
.preset-btn:hover { border-color: var(--amber); color: var(--amber); }

/* --- SCENE/SHOT LIST --- */
.scene-block { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.scene-header { background: var(--bg2); padding: 8px 16px; display: flex; align-items: center; justify-content: space-between; }
.scene-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); }
.shot-row { padding: 12px 16px; border-top: 1px solid var(--border); cursor: pointer; transition: background 0.1s; }
.shot-row:hover { background: rgba(255,255,255,0.02); }
.shot-row.active { background: var(--bg3); }
.shot-meta { display: flex; align-items: center; gap: 8px; }
.shot-title { font-size: 13px; font-weight: 500; }
.shot-badge { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--bg3); color: var(--muted); }
.shot-badge.reel { color: var(--amber); }
.shot-badge.offsite { color: var(--teal); }
.shot-dur { font-size: 11px; color: var(--muted); margin-left: auto; }

/* --- PROMPT OUTPUT (split layout) --- */
.prompt-layout { display: grid; grid-template-columns: 260px 1fr; gap: 24px; min-height: 70vh; }
.prompt-sidebar { overflow-y: auto; max-height: 75vh; }
.prompt-sidebar .sidebar-scene { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); padding: 4px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.prompt-sidebar .sidebar-shot { display: block; width: 100%; text-align: left; padding: 6px 10px; border-radius: 6px; background: none; border: 1px solid transparent; color: var(--fg); font-size: 12px; cursor: pointer; font-family: inherit; }
.prompt-sidebar .sidebar-shot:hover { background: var(--bg2); }
.prompt-sidebar .sidebar-shot.active { background: var(--bg3); border-color: var(--accent); }

/* --- MODEL SELECTOR --- */
.model-pills { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.model-pill { padding: 4px 12px; border-radius: 999px; font-size: 12px; border: 1px solid var(--border); background: var(--bg3); color: var(--muted); cursor: pointer; font-family: inherit; transition: all 0.15s; }
.model-pill.active { background: var(--accent2); border-color: var(--accent2); color: #fff; }

/* --- PROMPT OUTPUT BOX --- */
.prompt-box { position: relative; }
.prompt-box pre { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; max-height: 55vh; overflow: auto; color: #ccc; font-family: 'SF Mono', 'Fira Code', monospace; }
.prompt-box .copy-btn { position: absolute; top: 10px; right: 10px; }

/* --- REF INSTRUCTIONS --- */
.ref-note { margin-top: 10px; padding: 8px 12px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); font-size: 12px; }
.ref-note b { color: var(--amber); }

/* --- TOAST --- */
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--green); color: #082017; padding: 8px 16px; border-radius: var(--radius); font-size: 13px; opacity: 0; transition: opacity 0.2s; pointer-events: none; z-index: 999; }
.toast.show { opacity: 1; }

/* --- PROJECT LIST --- */
.project-list { max-width: 420px; margin: 0 auto; padding: 40px 24px; }
.project-list h1 { text-align: center; font-size: 32px; margin-bottom: 4px; }
.project-list .subtitle { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 32px; }
.project-item { display: block; width: 100%; text-align: left; padding: 12px 16px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; cursor: pointer; color: var(--fg); text-decoration: none; transition: border-color 0.15s; font-family: inherit; }
.project-item:hover { border-color: var(--accent); }
.project-item .name { font-weight: 500; }
.project-item .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* --- CHECKBOX --- */
input[type="checkbox"] { accent-color: var(--accent); }

/* --- AI EDIT BOX --- */
.ai-history { max-height: 200px; overflow-y: auto; margin-bottom: 8px; }
.ai-msg { padding: 6px 10px; border-radius: 6px; margin-bottom: 4px; font-size: 12px; line-height: 1.5; }
.ai-msg b { font-weight: 600; }
.ai-user { background: rgba(167,139,250,0.1); border-left: 3px solid var(--accent); color: var(--fg); }
.ai-assistant { background: rgba(94,234,212,0.1); border-left: 3px solid var(--teal); color: var(--teal); }
.ai-error { background: rgba(248,113,113,0.1); border-left: 3px solid var(--red); color: var(--red); }
.ai-loading { color: var(--muted); font-style: italic; }
.ai-dots::after { content: '...'; animation: dots 1.5s infinite; }
@keyframes dots { 0%,20% { content: '.'; } 40% { content: '..'; } 60%,100% { content: '...'; } }

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: span 1; }
  .prompt-layout { grid-template-columns: 1fr; }
}
