/* ── Variabelen ───────────────────────────────────────────── */
:root {
  --bg:          #0d0f0e;
  --surface:     #161a18;
  --surface2:    #1e2420;
  --border:      #2c332f;
  --text:        #eef2ee;
  --muted:       #7a8c7e;
  --accent:      #6fcf97;
  --accent-dim:  #2a4a36;
  --accent-text: #b8f0cc;
  --blue:        #7eb8f0;
  --blue-dim:    #1a2e42;
  --red:         #e26a6a;
  --red-dim:     #4a1010;
  --warn:        #f5c842;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

/* ── App shell ────────────────────────────────────────────── */
.app-shell {
  width: 100%;
  max-width: 540px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ───────────────────────────────────────────────── */
.app-header {
  padding: 1.1rem 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo-circle {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1.5px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-circle svg { width: 20px; height: 20px; }

.header-text { flex: 1; }
.header-text h1 {
  font-family: 'Lora', serif;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.1;
}
.header-text p { font-size: 12px; color: var(--muted); }

.header-nav { display: flex; gap: 6px; }
.nav-link {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover, .nav-link.active {
  background: var(--surface2);
  color: var(--text);
}

/* ── Main ─────────────────────────────────────────────────── */
.app-main {
  flex: 1;
  overflow-y: auto;
}

/* ── Loading screen ───────────────────────────────────────── */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 1.5rem;
  color: var(--muted);
  font-size: 16px;
}

/* ── Page container ───────────────────────────────────────── */
.page-container {
  padding: 1.5rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.page-title {
  font-family: 'Lora', serif;
  font-size: 24px;
  font-weight: 500;
}

/* ── Permission screen ────────────────────────────────────── */
.permission-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  padding: 2rem;
  text-align: center;
  gap: 1.5rem;
}
.permission-screen h2 { font-size: 26px; font-weight: 500; }
.permission-screen p  { font-size: 18px; color: var(--muted); line-height: 1.6; max-width: 300px; }

.big-icon {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.big-icon svg { width: 44px; height: 44px; }

/* ── Camera screen ────────────────────────────────────────── */
.camera-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1rem 2rem;
}

.viewfinder {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--surface);
  border-radius: 20px;
  overflow: hidden;
  border: 1.5px solid var(--border);
}
.viewfinder video { width: 100%; height: 100%; object-fit: cover; display: block; }

.status-bar {
  font-size: 16px;
  color: var(--muted);
  text-align: center;
  min-height: 24px;
}
.status-bar.go   { color: var(--accent); }
.status-bar.busy { color: var(--warn); }
.status-bar.err  { color: var(--red); }

.shutter-row {
  display: flex;
  justify-content: center;
  padding: 0.5rem 0 1rem;
}
.shutter-btn {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: var(--text);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 7px var(--surface2);
  transition: transform 0.12s, background 0.12s;
}
.shutter-btn:active { transform: scale(0.91); background: #c8d0c8; }
.shutter-btn:disabled { background: #333; cursor: not-allowed; }
.shutter-btn svg { width: 34px; height: 34px; }

/* ── Choice screen ────────────────────────────────────────── */
.choice-screen {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem 1rem 2rem;
}

.choice-photo-preview {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 20px;
  overflow: hidden;
  border: 1.5px solid var(--border);
}
.choice-photo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }

.choice-label {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.choice-grid { display: flex; flex-direction: column; gap: 12px; }

.choice-btn {
  width: 100%;
  padding: 20px 18px;
  border-radius: 16px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 20px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: background 0.15s, transform 0.1s;
}
.choice-btn:active { transform: scale(0.98); }
.choice-btn.primary   { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-text); }
.choice-btn.secondary { background: var(--blue-dim);   border-color: var(--blue);   color: #c0dcf8; }

.btn-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.btn-icon svg { width: 22px; height: 22px; }

.btn-text { display: flex; flex-direction: column; gap: 2px; }
.btn-label { font-size: 20px; font-weight: 500; }
.btn-desc  { font-size: 13px; opacity: 0.65; font-weight: 400; }

/* ── Result screen ────────────────────────────────────────── */
.result-screen {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem 1rem 2rem;
}

.result-photo {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 20px;
  overflow: hidden;
  border: 1.5px solid var(--border);
}
.result-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.result-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 1.5rem;
}
.result-card-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 10px;
}
.result-text {
  font-size: 22px;
  line-height: 1.7;
  color: var(--text);
}

/* ── Thinking indicator ───────────────────────────────────── */
.thinking {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.dot-row { display: flex; gap: 6px; }
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--warn);
  animation: bounce 1.2s ease-in-out infinite;
}
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }
.thinking span { font-size: 15px; color: var(--warn); }

/* ── Result actions ───────────────────────────────────────── */
.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Chat ─────────────────────────────────────────────────── */
.chat-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-messages {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
}
.msg {
  font-size: 19px;
  line-height: 1.65;
  padding: 12px 16px;
  border-radius: 14px;
  max-width: 90%;
}
.msg.user      { background: var(--accent-dim); color: var(--accent-text); align-self: flex-end;  border-bottom-right-radius: 4px; }
.msg.assistant { background: var(--surface2);   color: var(--text);        align-self: flex-start; border-bottom-left-radius: 4px; }

.chat-input-row { display: flex; gap: 10px; }
.chat-input {
  flex: 1;
  padding: 18px 16px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 19px;
  outline: none;
}
.chat-input:focus { border-color: var(--accent); }
.chat-input::placeholder { color: var(--muted); }

.mic-btn, .send-btn {
  width: 58px; height: 58px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.mic-btn.listening { background: var(--red-dim); border-color: var(--red); animation: pulse 1s ease-in-out infinite; }
.mic-btn svg, .send-btn svg { width: 22px; height: 22px; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.55} }

/* ── Buttons ──────────────────────────────────────────────── */
.pill-btn {
  padding: 20px 48px;
  font-size: 20px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.12s;
}
.pill-btn:active { transform: scale(0.96); }

.btn-large {
  flex: 1;
  min-width: 130px;
  padding: 18px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 18px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
}
.btn-large.primary { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-text); }
.btn-large.blue    { background: var(--blue-dim);   border-color: var(--blue);   color: #c0dcf8; }
.btn-large.danger  { background: var(--red-dim);    border-color: var(--red);    color: #f0b0b0; }

.btn-small {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-small.primary { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-text); }
.btn-small.danger  { background: var(--red-dim);    border-color: var(--red);    color: #f0b0b0; }

.btn-back {
  width: 100%;
  padding: 18px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 17px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
}
.btn-back:hover { background: var(--surface2); }

/* ── Settings ─────────────────────────────────────────────── */
.settings-section {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.section-title    { font-size: 18px; font-weight: 500; }
.section-sub      { font-size: 14px; color: var(--muted); line-height: 1.5; }
.subsection-title { font-size: 15px; font-weight: 500; color: var(--muted); margin-top: 0.5rem; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.setting-label { font-size: 16px; }

.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}
.slider-hint { font-size: 12px; color: var(--muted); white-space: nowrap; }
input[type=range] { flex: 1; accent-color: var(--accent); }

/* Toggle */
.toggle { position: relative; display: inline-flex; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  width: 48px; height: 26px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 13px;
  transition: background 0.2s;
  position: relative;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.toggle input:checked + .toggle-track { background: var(--accent-dim); border-color: var(--accent); }
.toggle input:checked + .toggle-track::after { transform: translateX(22px); background: var(--accent); }

.save-confirm { font-size: 14px; color: var(--accent); }

/* ── Prompt cards ─────────────────────────────────────────── */
.prompt-card {
  border-radius: 14px;
  border: 1.5px solid var(--border);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.prompt-card.builtin { opacity: 0.7; }
.prompt-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.prompt-name  { font-size: 16px; font-weight: 500; }
.prompt-text  { font-size: 13px; color: var(--muted); line-height: 1.5; font-family: monospace; }
.prompt-card-actions { display: flex; gap: 6px; }
.badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
}

/* ── Prompt editor ────────────────────────────────────────── */
.prompt-editor {
  border: 1.5px solid var(--accent);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--accent-dim);
}
.editor-field { display: flex; flex-direction: column; gap: 6px; }
.editor-field label { font-size: 13px; color: var(--accent-text); }
.editor-field input,
.editor-field textarea,
.editor-field select {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  outline: none;
  resize: vertical;
}
.editor-field input:focus,
.editor-field textarea:focus { border-color: var(--accent); }
.editor-actions { display: flex; gap: 10px; }

/* ── Geschiedenis ─────────────────────────────────────────── */
.history-list  { display: flex; flex-direction: column; gap: 12px; }
.history-card  {
  display: flex;
  gap: 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
}
.history-thumb {
  width: 72px; height: 72px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
}
.history-body  { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.history-label { font-size: 14px; font-weight: 500; color: var(--accent-text); }
.history-date  { font-size: 12px; color: var(--muted); }
.history-summary { font-size: 15px; line-height: 1.5; color: var(--text); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.history-actions { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 100;
}
.modal-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 1.5rem;
  max-width: 480px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.modal-text  { font-size: 20px; line-height: 1.7; }

/* ── Empty / loading states ───────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
  font-size: 17px;
}
.loading-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2rem;
  color: var(--warn);
  font-size: 16px;
}
.spinner {
  width: 28px; height: 28px;
  border: 2.5px solid var(--border);
  border-top-color: var(--warn);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

code {
  font-size: 13px;
  background: var(--surface2);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

/* ── Blazor error UI ──────────────────────────────────────── */
#blazor-error-ui {
  background: var(--red-dim);
  border-top: 1px solid var(--red);
  color: #f0b0b0;
  display: none;
  bottom: 0;
  left: 0;
  padding: 0.75rem 1.25rem;
  position: fixed;
  right: 0;
  font-size: 14px;
  z-index: 1000;
}
#blazor-error-ui .reload { color: var(--red); margin-left: 0.5rem; }
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* ── Eigen vraag in PromptChooser ─────────────────────────── */
.choice-btn.custom-prompt-btn {
  background: #2a2a3a;
  border-color: #5a5a8a;
  color: #d0d0f8;
}

.custom-input-card {
  background: var(--surface);
  border: 1.5px solid var(--accent);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.custom-input-label {
  font-size: 15px;
  color: var(--accent-text);
  font-weight: 500;
}

.custom-input-row {
  display: flex;
  gap: 10px;
}

.custom-text-input {
  flex: 1;
  padding: 16px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 20px;
  outline: none;
}
.custom-text-input:focus { border-color: var(--accent); }
.custom-text-input::placeholder { color: var(--muted); }

.custom-actions {
  display: flex;
  gap: 10px;
}

.listening-hint {
  font-size: 14px;
  color: var(--red);
  animation: pulse 1s ease-in-out infinite;
}
