/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:    #C4622D;
  --primary-dark: #A8501F;
  --navy:       #1B2A3B;
  --bg:         #FAF8F5;
  --surface:    #FFFFFF;
  --text:       #1B2A3B;
  --text-muted: #5C6B7A;
  --success:    #2D7A4F;
  --border:     #E8E0D5;
  --r-card:     12px;
  --r-input:    8px;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }

.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ===== Disclaimer Banner ===== */
.disclaimer-banner {
  background: #FFF8F0;
  border-bottom: 1px solid #F0D9C0;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--navy);
  text-align: center;
}
.disclaimer-inner { max-width: 720px; margin: 0 auto; }

/* ===== Header ===== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  padding-bottom: 12px;
}
.logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.logo-img { flex-shrink: 0; }
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-name { font-weight: 700; font-size: 18px; color: var(--primary); }
.logo-tagline { font-size: 11px; color: var(--text-muted); }
.site-nav { display: flex; gap: 4px; }
.nav-link {
  padding: 6px 12px;
  border-radius: var(--r-input);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav-link.active { background: #F3EDE5; color: var(--primary); }

/* ===== Main ===== */
.main-content { flex: 1; }

/* ===== Chat Page ===== */
.chat-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 92px); /* minus header + disclaimer */
}

/* Starters */
.starters {
  flex: 1;
  overflow-y: auto;
  padding: 32px 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.starters-header { text-align: center; margin-bottom: 28px; }
.hero-shield {
  width: 72px; height: 72px;
  background: #FFF0E8;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.hero-title { font-size: 22px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.hero-sub { color: var(--text-muted); font-size: 15px; }

.starter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 600px;
}
.starter-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.starter-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(196,98,45,0.12); }
.starter-icon { font-size: 18px; flex-shrink: 0; }

/* Chat Window */
.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* Message bubbles */
.message { display: flex; gap: 10px; align-items: flex-start; }
.message.user { flex-direction: row-reverse; }

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  color: white;
}
.avatar.user-avatar { background: var(--navy); }

.bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: var(--r-card);
  font-size: 15px;
  line-height: 1.6;
}
.bubble.assistant {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top-left-radius: 2px;
}
.bubble.user {
  background: var(--primary);
  color: white;
  border-top-right-radius: 2px;
}
.bubble p { margin-bottom: 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble strong { font-weight: 600; }

/* Typing indicator */
.typing-dots { display: flex; gap: 4px; padding: 4px 0; }
.typing-dots span {
  width: 7px; height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* Disclaimer above first message */
.chat-disclaimer {
  background: #FFF8F0;
  border: 1px solid #F0D9C0;
  border-radius: var(--r-input);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* Chat Input */
.chat-input-wrap {
  padding: 12px 16px 8px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.chat-input-box {
  max-width: 720px;
  margin: 0 auto;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-card);
  overflow: hidden;
  transition: border-color 0.15s;
}
.chat-input-box:focus-within { border-color: var(--primary); }

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 0;
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
}
.chip-remove {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 18px; line-height: 1;
  padding: 0 2px;
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 8px;
}
.upload-btn {
  padding: 8px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--r-input);
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.upload-btn:hover { color: var(--primary); background: #F3EDE5; }

.chat-textarea {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  font-size: 15px;
  color: var(--text);
  font-family: inherit;
  padding: 6px 4px;
  outline: none;
  max-height: 160px;
  overflow-y: auto;
  line-height: 1.5;
}
.chat-textarea::placeholder { color: var(--text-muted); }

.send-btn {
  padding: 8px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--r-input);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.send-btn:hover { background: var(--primary-dark); }
.send-btn:disabled { background: #D4C5B8; cursor: not-allowed; }

.input-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Generic Page Layout ===== */
.page-container { padding-top: 40px; padding-bottom: 60px; }
.page-header { margin-bottom: 32px; }
.page-header h1 { font-size: 28px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.page-sub { color: var(--text-muted); font-size: 16px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 24px; }
.form-label {
  display: block;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 8px;
  color: var(--navy);
}
.form-optional { font-weight: 400; color: var(--text-muted); font-size: 13px; }
.required { color: var(--primary); }

.form-input, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-input);
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
  outline: none;
}
.form-input:focus, .form-textarea:focus { border-color: var(--primary); }
.form-textarea { resize: vertical; line-height: 1.5; }

/* ===== Buttons ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--r-input);
  padding: 11px 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: #D4C5B8; cursor: not-allowed; }
.btn-primary.btn-lg { width: 100%; justify-content: center; padding: 14px; font-size: 16px; margin-top: 8px; }

.btn-secondary {
  background: var(--bg);
  color: var(--navy);
  border: 1.5px solid var(--border);
  border-radius: var(--r-input);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
}
.btn-secondary:hover { border-color: var(--primary); background: #FFF0E8; }

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: var(--r-input);
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s;
}
.btn-outline:hover { border-color: var(--text-muted); }

/* ===== Quiz ===== */
.quiz-form { max-width: 600px; }
.quiz-step { margin-bottom: 32px; }
.step-title { font-size: 17px; font-weight: 600; color: var(--navy); margin-bottom: 14px; }
.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.option-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-card);
  cursor: pointer;
  font-size: 15px;
  transition: border-color 0.15s, background 0.15s;
}
.option-card:hover { border-color: var(--primary); }
.option-card input[type="radio"],
.option-card input[type="checkbox"] { accent-color: var(--primary); }
.option-card:has(input:checked) { border-color: var(--primary); background: #FFF0E8; }

/* ===== File Drop ===== */
.file-drop {
  border: 2px dashed var(--border);
  border-radius: var(--r-card);
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.file-drop:hover { border-color: var(--primary); background: #FFF8F5; }
.file-drop p { margin-top: 10px; font-size: 14px; }
.file-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px !important; }
.file-label-link { color: var(--primary); cursor: pointer; font-weight: 500; }

/* ===== Loading ===== */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px;
  color: var(--text-muted);
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Result Card ===== */
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 28px;
  margin-top: 32px;
}
.result-title { font-size: 20px; font-weight: 700; color: var(--navy); margin-bottom: 16px; }
.result-body {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
}
.result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.action-btns { display: flex; gap: 8px; }

/* Letter */
.letter-body {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  padding: 20px;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
  font-family: "Georgia", serif;
  color: var(--text);
  margin-bottom: 20px;
}

.finkn-note {
  background: #EDF7F2;
  border: 1px solid #B8DFC8;
  border-radius: var(--r-input);
  padding: 14px 16px;
  font-size: 14px;
  color: var(--navy);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ===== Email Capture ===== */
.email-capture {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.email-capture h3 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.email-capture > p { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; }
.email-form { display: flex; flex-direction: column; gap: 10px; max-width: 400px; }
.email-sent { color: var(--success); font-weight: 600; margin-top: 8px; }

/* ===== Appeal Form ===== */
.appeal-form { max-width: 600px; }

/* ===== Footer ===== */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 20px 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.site-footer .container { display: flex; flex-direction: column; gap: 4px; }
.footer-note { font-size: 12px; }

/* ===== Klagehjelp CTA button ===== */
.cta-klagehjelp {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 16px;
  background: #FFF0E8;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  border-radius: var(--r-input);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.cta-klagehjelp:hover { background: #FFE4D0; text-decoration: none; }

/* ===== Markdown-ish in bubbles ===== */
.bubble h1, .bubble h2, .bubble h3 {
  font-size: 15px; font-weight: 700; margin: 10px 0 4px;
}
.bubble ul, .bubble ol { padding-left: 20px; margin: 6px 0; }
.bubble li { margin-bottom: 4px; }
.bubble code {
  background: #F0EDE8;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 13px;
  font-family: monospace;
}

/* ===== Responsive ===== */
@media (max-width: 500px) {
  .starter-grid { grid-template-columns: 1fr; }
  .option-grid { grid-template-columns: 1fr; }
  .bubble { max-width: 88%; }
  .result-actions { flex-direction: column; align-items: flex-start; }
}
