/* ============================================================================
   AI-Docent — UI v3  ·  Presentation Theater
   ============================================================================ */

:root {
  --bg:           #f0f0f5;
  --panel:        #ffffff;
  --ink:          #18181b;
  --ink-soft:     #3f3f46;
  --ink-mute:     #71717a;
  --ink-faint:    #a1a1aa;
  --line:         #e4e4e7;
  --line-soft:    #f4f4f5;

  /* Accent */
  --accent:       #4338ca;
  --accent-hover: #3730a3;
  --accent-soft:  #eef2ff;
  --accent-text:  #ffffff;

  /* Slide theater */
  --theater:      #0c0c14;
  --theater-mid:  #141420;
  --glass-bg:     rgba(255,255,255,0.08);
  --glass-border: rgba(255,255,255,0.13);
  --glass-text:   rgba(255,255,255,0.90);
  --glass-mute:   rgba(255,255,255,0.45);

  /* Chat */
  --user-bubble:  #eef2ff;
  --user-text:    #1e1b4b;
  --ai-bubble:    #f9f9fc;
  --ai-text:      #18181b;

  /* Schaduwen */
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.07);
  --shadow-md:    0 8px 24px rgba(0,0,0,0.10);
  --slide-glow:   0 16px 64px rgba(0,0,0,0.65);

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

  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.55;
}

/* ── TOPBAR ──────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  height: 54px;
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  background: linear-gradient(135deg, #4338ca, #6366f1);
  color: white;
  border-radius: 8px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: -0.02em;
  box-shadow: 0 2px 8px rgba(67,56,202,0.35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small {
  color: var(--ink-mute);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.02em;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.slide-indicator {
  color: var(--ink-mute);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  padding: 5px 10px;
  background: var(--line-soft);
  border-radius: 6px;
  border: 1px solid var(--line);
}
.progress-track {
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 2px;
  background: transparent;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #818cf8);
  transition: width 0.4s cubic-bezier(0.4,0,0.2,1);
}

/* ── LAYOUT ──────────────────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  flex: 1;
  min-height: 0;
}

/* ── SLIDE THEATER ───────────────────────────────────────────────────────── */
.slides-panel {
  display: flex;
  flex-direction: column;
  background: var(--theater);
  overflow: hidden;
  min-height: 0;
  position: relative;
}

/* Subtiele gradient-vignette boven in theater */
.slides-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(67,56,202,0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.slide-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 36px 16px;
  overflow: hidden;
  position: relative;
  z-index: 1;
  min-height: 0;
}

/* Titel is ingebakken in de slide-afbeelding — verbergen */
#slide-title { display: none; }

.slide-content {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Slide afbeelding — vult de stage */
.slide-figure {
  margin: 0;
  width: 100%;
  text-align: center;
}
.slide-figure img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 54px - 110px);
  object-fit: contain;
  border-radius: 10px;
  box-shadow: var(--slide-glow);
  border: none;
}
.slide-figure figcaption { display: none; }
.img-row { display: none; }

/* ── SLIDE CONTROLS (theater) ────────────────────────────────────────────── */
.slide-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 12px 20px 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.narration-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 14px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
.narration-status {
  font-size: 11.5px;
  color: var(--glass-mute);
  min-height: 16px;
}
.voice-label {
  font-size: 10.5px;
  color: rgba(255,255,255,0.25);
  margin-top: 2px;
}

/* ── BUTTONS (theater variant — glass) ────────────────────────────────────── */
.btn-primary, .btn-secondary {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.01em;
}

/* In theater — primary = accent glow */
.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 0 0 0 rgba(67,56,202,0);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 0 16px rgba(99,102,241,0.4);
}
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled {
  background: rgba(255,255,255,0.1);
  border-color: transparent;
  color: rgba(255,255,255,0.25);
  cursor: not-allowed;
}

/* In theater — secondary = glass */
.btn-secondary {
  background: var(--glass-bg);
  color: var(--glass-text);
  border-color: var(--glass-border);
  backdrop-filter: blur(8px);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.22);
}
.btn-secondary:active:not(:disabled) { transform: translateY(1px); }
.btn-secondary:disabled {
  color: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.03);
  cursor: not-allowed;
}

/* Download log knop in topbar — lichte variant */
#download-log {
  background: var(--panel);
  color: var(--ink-soft);
  border-color: var(--line);
  backdrop-filter: none;
}
#download-log:hover:not(:disabled) {
  background: var(--line-soft);
  color: var(--ink);
}

/* ── CHAT PANEEL ─────────────────────────────────────────────────────────── */
.chat-panel {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line);
  min-height: 0;
}
.chat-header {
  padding: 15px 20px 13px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
}
.chat-header-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #4338ca, #6366f1);
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(67,56,202,0.3);
}
.chat-header-text {
  display: flex; flex-direction: column;
  line-height: 1.25; min-width: 0;
}
.chat-header-text strong { font-size: 14px; color: var(--ink); }
.chat-sub { font-size: 11.5px; color: var(--ink-mute); margin-top: 1px; }

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  background: #fbfbfe;
}

.msg-wrap {
  display: flex; gap: 9px;
  align-items: flex-start; max-width: 100%;
}
.msg-wrap.user { flex-direction: row-reverse; }
.msg-wrap.ai   { flex-direction: row; }

.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}
.avatar.ai {
  background: linear-gradient(135deg, #4338ca, #6366f1);
  color: white;
}
.avatar.user { background: var(--line); color: var(--ink-soft); }

.msg {
  padding: 9px 13px;
  border-radius: 13px;
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-width: calc(100% - 36px);
}
.msg.user {
  background: var(--user-bubble);
  color: var(--user-text);
  border-bottom-right-radius: 4px;
}
.msg.ai {
  background: var(--ai-bubble);
  color: var(--ai-text);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.msg.system {
  align-self: center;
  background: transparent;
  color: var(--ink-mute);
  font-size: 11.5px;
  font-style: italic;
  text-align: center;
  max-width: 90%;
  padding: 4px 12px;
}
.msg-meta {
  font-size: 10px;
  color: var(--ink-faint);
  margin-top: 5px;
}

.chat-form {
  display: flex; gap: 8px;
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  align-items: flex-end;
  background: var(--panel);
}
#chat-input {
  flex: 1;
  font-family: inherit;
  font-size: 13.5px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  resize: none; outline: none;
  min-height: 40px; max-height: 130px;
  background: #f9f9fc;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
#chat-input:focus {
  border-color: var(--accent);
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
#chat-input::placeholder { color: var(--ink-faint); }

/* Chat send button — color variant voor buiten theater */
.chat-form .btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.chat-form .btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(67,56,202,0.3);
}

.chat-status {
  padding: 0 14px 9px;
  font-size: 11px;
  color: var(--ink-mute);
  min-height: 14px;
}

/* ── SCROLLBARS ──────────────────────────────────────────────────────────── */
.chat-log::-webkit-scrollbar { width: 6px; }
.chat-log::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.chat-log::-webkit-scrollbar-thumb:hover { background: #d4d4d8; }
.chat-log::-webkit-scrollbar-track { background: transparent; }

/* ── SLIDE FADE ANIMATIE ─────────────────────────────────────────────────── */
@keyframes slideFadeIn {
  from { opacity: 0; transform: scale(0.985); }
  to   { opacity: 1; transform: scale(1); }
}
.slide-fade-in .slide-content { animation: slideFadeIn 0.3s cubic-bezier(0.4,0,0.2,1); }

/* ── RESPONSIVE ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: 60% 40%; }
  .chat-panel { border-left: none; border-top: 1px solid var(--line); }
  .slide-stage { padding: 16px 16px 8px; }
  .slide-figure img { max-height: 45vh; }
  .topbar { padding: 0 16px; }
  .brand-text small { display: none; }
}
@media (max-width: 600px) {
  .topbar { height: 48px; }
  .slide-indicator { font-size: 12px; padding: 4px 8px; }
  .slide-figure img { border-radius: 6px; }
}
