/* IUIC Video Studio — core styles. IUIC palette: #7b4fb0 / #c9a84c / #050505 */
:root {
  --bg:        #050505;
  --panel:     #111111;
  --text:      #f5f1e6;
  --muted:     #8b8378;
  --primary:   #7b4fb0;
  --accent:    #c9a84c;
  --danger:    #b54040;
  --ok:        #4b9a6a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
             font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
             min-height: 100vh; }

.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 28px; border-bottom: 1px solid #1a1a1a;
  background: #080808;
}
.brand { font-family: 'Cinzel', serif; font-size: 20px; letter-spacing: 0.06em; color: var(--accent); }
.top nav { display: flex; gap: 18px; align-items: center; }
.top .who { color: var(--muted); font-size: 14px; }
.top a { color: var(--text); text-decoration: none; font-size: 14px; }
.top a:hover { color: var(--accent); }
.top a.brand:hover { color: var(--accent); }
.top nav a.nav-cta { padding: 5px 12px; background: var(--primary); color: var(--text) !important; border-radius: 2px; }
.top nav a.nav-cta:hover { background: #8b5dc2; }

main { max-width: 980px; margin: 40px auto; padding: 0 28px; }

h1 { font-family: 'Cinzel', serif; font-weight: 500; letter-spacing: 0.04em; margin-top: 0; }
h2 { font-weight: 500; color: var(--accent); margin-top: 40px; }

/* Login */
.login { max-width: 380px; margin: 60px auto; background: var(--panel); padding: 32px 28px; border: 1px solid #1e1e1e; }
.login h1 { margin-top: 0; font-size: 24px; }
.login label { display: block; margin-bottom: 16px; }
.login label span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 6px; }
.login input { width: 100%; padding: 10px 12px; background: #080808; border: 1px solid #222; color: var(--text); font-size: 15px; border-radius: 2px; }
.login input:focus { outline: 1px solid var(--primary); border-color: var(--primary); }
.login button { width: 100%; padding: 11px 14px; background: var(--primary); color: var(--text); border: none; font-size: 15px; cursor: pointer; letter-spacing: 0.04em; border-radius: 2px; }
.login button:hover { background: #8b5dc2; }
.login .note { color: var(--muted); font-size: 12px; margin-top: 20px; text-align: center; }
.error { background: #2a1616; color: #e8a0a0; padding: 10px 14px; border-left: 3px solid var(--danger); font-size: 14px; margin-bottom: 18px; }

/* Home */
.home .actions { display: flex; gap: 12px; margin-bottom: 40px; flex-wrap: wrap; }
.btn { display: inline-block; padding: 10px 18px; background: #1a1a1a; color: var(--text); text-decoration: none; border: 1px solid #2a2a2a; font-size: 14px; letter-spacing: 0.04em; border-radius: 2px; }
.btn:hover { border-color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: #8b5dc2; border-color: #8b5dc2; }
.btn-admin { background: #1a0f2a; border-color: #3a2d50; color: #c9b8e4; }

.publisher-list { list-style: none; padding: 0; }
.publisher-list li { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: var(--panel); border: 1px solid #1e1e1e; margin-bottom: 8px; }
.publisher-list li.disabled { opacity: 0.5; }
.pub-name { font-size: 15px; }
.pub-status { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; }
.pub-status.pub-ok { color: var(--ok); }
.pub-status.pub-pending { color: var(--accent); }
.pub-status.pub-future { color: var(--muted); }
.btn-sm { padding: 6px 12px; font-size: 12px; background: #1a1a1a; color: var(--text); text-decoration: none; border: 1px solid #2a2a2a; }

/* Sessions list */
.sessions-list .topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.sessions-list table.sessions { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid #1e1e1e; }
.sessions-list th, .sessions-list td { padding: 12px 14px; text-align: left; border-bottom: 1px solid #181818; font-size: 14px; }
.sessions-list th { color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: 0.1em; background: #0a0a0a; }
.sessions-list td a { color: var(--accent); text-decoration: none; }
.sessions-list td a:hover { text-decoration: underline; }
.sessions-list .empty { color: var(--muted); padding: 40px; text-align: center; border: 1px dashed #2a2a2a; }

.status { padding: 3px 8px; border-radius: 2px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.status-scaffolded    { background: #222; color: var(--muted); }
.status-transcribing  { background: #1a2a1a; color: #94c98a; }
.status-proposing     { background: #2a1a2a; color: #d9a0d9; }
.status-rendering     { background: #2a2010; color: var(--accent); }
.status-approved      { background: #163016; color: var(--ok); }
.status-published     { background: #163016; color: var(--ok); }

/* New session form */
.new-session { display: grid; grid-template-columns: 2fr 1fr; gap: 40px; }
.new-session h1 { grid-column: 1 / -1; }
.session-form .field { display: block; margin-bottom: 20px; }
.session-form .field > span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; }
.session-form input[type="text"], .session-form select { width: 100%; padding: 10px 12px; background: #080808; border: 1px solid #222; color: var(--text); font-size: 15px; border-radius: 2px; }
.session-form input[type="file"] { padding: 8px 0; color: var(--text); }
.session-form .hint { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.session-form .actions { display: flex; gap: 12px; margin-top: 24px; }
.genre-guide { background: var(--panel); padding: 18px 20px; border: 1px solid #1e1e1e; }
.genre-guide h3 { margin-top: 0; color: var(--accent); font-size: 14px; text-transform: uppercase; letter-spacing: 0.1em; }
.genre-guide ul { list-style: none; padding: 0; margin: 0; }
.genre-guide li { padding: 10px 0; border-bottom: 1px solid #181818; font-size: 13px; }
.genre-guide li:last-child { border-bottom: 0; }
.genre-guide .meta { color: var(--muted); font-size: 11px; }
.genre-guide p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }

/* Session view */
.session-view .session-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; gap: 20px; }
.session-view .session-head .meta { margin-top: 8px; color: var(--muted); font-size: 13px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.session-view .session-head .meta strong { color: var(--accent); }
.session-view form.inline { display: inline-flex; gap: 6px; align-items: center; }
.session-view form.inline select { padding: 4px 8px; background: #080808; border: 1px solid #222; color: var(--text); font-size: 12px; }

.session-grid {
  display: grid;
  grid-template-columns: 220px 1fr 380px;
  gap: 16px;
  min-height: 540px;
}
@media (max-width: 1100px) {
  .session-grid { grid-template-columns: 1fr; }
}
.panel { background: var(--panel); border: 1px solid #1e1e1e; padding: 16px 18px; overflow: auto; }
.panel h3 { margin-top: 0; color: var(--accent); font-size: 13px; text-transform: uppercase; letter-spacing: 0.12em; }
.panel-sources .sources { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.panel-sources .sources li { padding: 6px 0; border-bottom: 1px solid #181818; word-break: break-all; }
.panel-sources .empty { color: var(--muted); font-size: 13px; }

.viewer { position: relative; background: #000; aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; }
.viewer video { width: 100%; height: 100%; object-fit: contain; }
.viewer .placeholder { color: var(--muted); padding: 20px; text-align: center; font-size: 13px; max-width: 320px; }

.panel-chat { display: flex; flex-direction: column; max-height: 640px; }
.chat-thread { flex: 1; overflow-y: auto; padding-right: 4px; margin-bottom: 10px; }
.chat-msg { margin-bottom: 14px; }
.chat-msg .role { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin-bottom: 3px; }
.chat-msg.msg-user .role { color: var(--primary); }
.chat-msg.msg-assistant .role { color: var(--accent); }
.chat-msg .content { white-space: pre-wrap; font-size: 13px; line-height: 1.5; padding: 8px 10px; background: #0a0a0a; border-left: 2px solid #1e1e1e; }
.chat-msg.msg-user .content { border-left-color: var(--primary); }
.chat-msg.msg-assistant .content { border-left-color: var(--accent); }
.chat-form { display: flex; flex-direction: column; gap: 6px; }
.chat-form textarea { background: #080808; border: 1px solid #222; color: var(--text); padding: 8px 10px; font-size: 13px; font-family: inherit; resize: vertical; border-radius: 2px; }
.chat-form textarea:focus { outline: 1px solid var(--primary); border-color: var(--primary); }
.chat-form button { background: var(--primary); color: var(--text); border: none; padding: 8px 14px; font-size: 13px; cursor: pointer; border-radius: 2px; align-self: flex-end; }
.chat-form button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Quick-action buttons on genre-aware session view */
.quick-actions { margin-bottom: 14px; padding: 10px; background: #0a0a0a; border: 1px solid #1a1a1a; }
.qa-label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 6px; }
.qa-btn { display: inline-block; margin: 3px 4px 3px 0; padding: 6px 10px; background: #141022; color: var(--text); border: 1px solid #2a1f44; font-size: 12px; cursor: pointer; border-radius: 2px; }
.qa-btn:hover { background: var(--primary); border-color: var(--primary); }
.qa-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Download chips on the sessions list */
.dl-chip { display: inline-block; padding: 3px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; border-radius: 2px; }
.dl-chip-active { background: #2a2010; color: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
.dl-chip-queued { background: #1a1a2a; color: #9aa; }
.dl-chip-stalled { background: #2a1616; color: var(--danger); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.65; } }

/* Dedup banner (shown at top of session view when same content was used before) */
.dedup-banner { display: flex; gap: 14px; padding: 14px 18px; background: #0f1e14; border: 1px solid #1e3a28; border-left: 3px solid var(--ok); margin-bottom: 20px; border-radius: 2px; }
.dedup-icon { font-size: 22px; line-height: 1; margin-top: 2px; }
.dedup-body { flex: 1; font-size: 13px; line-height: 1.5; }
.dedup-body strong { color: var(--ok); }
.dedup-list { list-style: none; padding: 0; margin: 8px 0 6px; }
.dedup-list li { padding: 4px 0; font-size: 12px; color: var(--text); }
.dedup-list li .status { font-size: 10px; padding: 1px 6px; }
.dedup-list em { color: var(--accent); font-style: normal; }
.dedup-meta { color: var(--muted); font-size: 11px; margin-left: 4px; }
.dedup-hint { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; font-style: italic; }
.pub-badge { font-size: 10px; padding: 1px 6px; margin-left: 4px; text-transform: uppercase; letter-spacing: 0.08em; border-radius: 2px; }
.pub-badge { background: #163016; color: var(--ok); }
.pub-badge.pub-none { background: #2a2010; color: var(--accent); }

/* Download progress bars */
.progress-bar { width: 100%; height: 8px; background: #0a0a0a; border: 1px solid #1a1a1a; overflow: hidden; border-radius: 2px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%); transition: width 0.5s ease; }
.dl-progress { margin: 10px 0; padding: 10px; background: #0a0a0a; border: 1px solid #1a1a1a; border-radius: 2px; }
.dl-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--text); margin-bottom: 6px; }
.dl-pct { color: var(--accent); font-weight: 500; font-family: ui-monospace, monospace; }
.dl-meta { margin-top: 4px; font-size: 10px; color: var(--muted); font-family: ui-monospace, monospace; }
.dl-done { padding: 8px 10px; background: #163016; color: var(--ok); border-left: 3px solid var(--ok); font-size: 12px; margin: 8px 0; }
.dl-done a { color: var(--ok); font-weight: 500; }

/* Inspiration panel (session view, sources sidebar) */
.insp-form { margin-bottom: 12px; }
.insp-list { list-style: none; padding: 0; margin: 0; }
.insp-list li { padding: 8px 0; border-bottom: 1px solid #181818; font-size: 12px; }
.insp-list li:last-child { border-bottom: 0; }
.insp-title { font-weight: 500; color: var(--text); word-break: break-word; }
.insp-src { display: block; font-size: 10px; color: var(--muted); text-decoration: none; word-break: break-all; margin-top: 2px; }
.insp-src:hover { color: var(--accent); }
.insp-notes { color: var(--muted); font-size: 11px; margin-top: 4px; font-style: italic; }
.insp-status { margin-left: 6px; font-size: 9px; text-transform: uppercase; letter-spacing: 0.1em; padding: 1px 5px; border-radius: 2px; }
.insp-status-pending, .insp-status-fetching { background: #2a2010; color: var(--accent); }
.insp-status-ready { background: #163016; color: var(--ok); }
.insp-status-failed { background: #2a1616; color: var(--danger); }
.insp-del { background: none; border: none; color: var(--muted); font-size: 10px; cursor: pointer; text-decoration: underline; padding: 0; }
.insp-del:hover { color: var(--danger); }
.hint-inline { color: var(--muted); font-size: 11px; font-style: italic; }

/* Drive pull failure banner */
.dl-error { padding: 10px 12px; background: #2a1616; color: #e8a0a0; border-left: 3px solid var(--danger); font-size: 12px; line-height: 1.5; margin: 10px 0; }
.dl-error strong { color: #ff9a9a; display: block; margin-bottom: 6px; }
.dl-error code { background: #1a0f0f; padding: 1px 4px; border-radius: 2px; }
.dl-url { display: block; margin-top: 6px; font-family: ui-monospace, monospace; font-size: 10px; color: var(--muted); word-break: break-all; }

/* Publisher placeholder page */
.publisher-placeholder { max-width: 520px; margin: 60px auto; background: var(--panel); padding: 28px; border: 1px solid #1e1e1e; }
.publisher-placeholder h1 { margin-top: 0; color: var(--accent); }
.publisher-placeholder .blurb { color: var(--text); line-height: 1.55; }
.publisher-placeholder .status { margin: 18px 0; padding: 10px 14px; background: #2a2010; color: var(--accent); border-left: 3px solid var(--accent); font-size: 13px; }
