/* ============= Reset / Base ============= */
* { box-sizing: border-box; }
:root{
  --bg:#f5f5f5; --fg:#111; --card:#fff; --muted:#666;
  --brand:#0066ff; --brand-600:#0050cc;
  --ring:#e5e5e5;
  --green:#2e7d32; --amber:#b26a00; --purple:#5e35b1;
}
body { margin:0; font-family: Arial, sans-serif; background: var(--bg); color: var(--fg); padding:20px; display:flex; justify-content:center; }
h1 { font-size:1.5rem; margin:0 0 12px; }
button { border:none; border-radius:8px; background:var(--brand); color:#fff; cursor:pointer; transition:background .2s, transform .2s; }
button:hover { background:var(--brand-600); transform: translateY(-1px); }

/* ============= Layout ============= */
.content-container{
  display:grid;
  grid-template-columns: minmax(0, 1fr) 340px; /* ens bredder for begge sider */
  gap:24px;
  max-width: 1200px;
  width:100%;
}
.chat-panel{
  min-width:0;
  background:var(--card);
  padding:24px;
  border-radius:12px;
  box-shadow:0 3px 12px rgba(0,0,0,.08);
}
.right-panel{
  background:var(--card);
  padding:20px;
  border-radius:12px;
  box-shadow:0 3px 12px rgba(0,0,0,.08);
  height: fit-content;
}
.header-bar{ display:flex; justify-content:space-between; align-items:center; gap:12px; }
.header-right{ display:flex; align-items:center; gap:.5rem; }
.status-chip{ opacity:.8; }

/* ============= Mode-banner (vises nu i højrepanelet) ============= */
.mode-banner {
  display:flex; align-items:center; gap:10px;
  padding:12px 16px; border-radius:10px; margin-bottom:16px;
  font-size:1rem;
}
.mode-banner.kids  { background:#b9f6ca; color:#1b5e20; }
.mode-banner.adult { background:#bbdefb; color:#0d47a1; }
.mode-icon { font-size:1.4rem; }
.mode-desc { font-size:.9rem; opacity:.9; }
.mode-banner button {
  margin-left:auto; font-size:.85rem; padding:6px 10px;
  background:#fff; border:1px solid currentColor; border-radius:6px;
}

/* ============= Chat ============= */
.ai-message{ margin:8px 0 6px; color:var(--muted); }
.chatbox{
  min-height: 380px;
  max-height: 560px;
  overflow-y: auto;
  padding: 1rem;
  background: #f9f9f9;
  border-radius: 8px;
  margin-top: .5rem;
  font-size: 1.02rem;
}
.msg{ margin:10px 0; padding:10px 16px; border-radius:12px; max-width:90%; line-height:1.4; word-wrap:break-word; color: inherit; }
.user{ background:#e3f2fd; margin-left:auto; text-align:right; }
.ai{ background:#e8f5e9; margin-right:auto; text-align:left; }
.correct{ font-weight:bold; animation:pop .5s ease; }
@keyframes pop { 0%{transform:scale(.98);opacity:.2} 100%{transform:scale(1);opacity:1} }

.input-row{ display:flex; gap:10px; margin-top:16px; flex-wrap:wrap; }
.input-row input[type="text"]{
  flex:1; min-width:300px; font-size:1.05rem;
  padding:.95em 1em; height:58px;
  border:1px solid var(--ring); border-radius:8px; background:#fff;
}
.input-row button{ padding:.85em 1.25em; height:58px; }

/* ============= Quick replies ============= */
.quick-replies{ display:flex; gap:10px; flex-wrap:wrap; margin-top:12px; }
.quick-reply{
  padding:10px 14px; border-radius:18px; border:1px solid #ddd;
  background:#f7f7f7; cursor:pointer; font-size:1rem;
}
.quick-reply:hover{ background:#eee; }

/* ============= Highscore ============= */
.tabs{ display:flex; gap:8px; margin-bottom:10px; }
.tab{ background:#f1f1f1; color:#111; padding:.5rem .8rem; border-radius:8px; cursor:pointer; border:1px solid #e6e6e6; }
.tab[aria-selected="true"]{ background:#111; color:#fff; border-color:#111; }
.highscore{ margin-top:10px; }
.highscore-item{ display:flex; justify-content:space-between; padding:6px 0; border-bottom:1px solid #eee; }
.highscore-item:last-child{ border-bottom:none; }

/* ============= Kategori switcher ============= */
.category-switch{ margin-top:1rem; }
#categoryList{ display:grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap:10px; margin-bottom:14px; }
.suggestion{
  padding:10px; font-size:.95rem; border-radius:8px; border:1px solid #ccc; background:#f0f0f0; cursor:pointer; text-align:center; transition:background .2s;
}
.suggestion:hover{ background:#dceefc; }

/* ============= Login prompt ============= */
#loginPrompt a.btn, #loginReminder a.btn{
  display:inline-block; font-size:.95rem; text-align:center; margin-top:1rem; color:#000; background:#f0f0f0; padding:8px 16px; border-radius:6px; text-decoration:none;
}
#loginPrompt a.btn:hover, #loginReminder a.btn:hover{ background:#e0e0e0; }

/* ============= Dark Mode ============= */
.theme-toggle{ cursor:pointer; font-size:1.2rem; user-select:none; display:flex; align-items:center; gap:.35rem; }
body.dark{ background:#121212; color:#eee; }
body.dark .chat-panel, body.dark .right-panel, body.dark .chatbox{ background:#1e1e1e; color:#eee; }
body.dark .msg.ai{ background:#263238; }
body.dark .msg.user{ background:#37474f; }
body.dark input[type="text"], body.dark input[type="email"]{ background:#2a2a2a; border:1px solid #444; color:#eee; }
body.dark button{ background:#3399ff; }
body.dark button:hover{ background:#1976d2; }
body.dark .quick-reply{ background:#2a2a2a; border-color:#444; color:#eee; }
body.dark .quick-reply:hover{ background:#3a3a3a; }
body.dark .tab{ background:#2a2a2a; color:#eee; border-color:#444; }
body.dark .tab[aria-selected="true"]{ background:#fff; color:#111; border-color:#fff; }
body.dark .suggestion{ background:#2c2c2c; border-color:#444; color:#eee; }
body.dark .suggestion:hover{ background:#3949ab; color:#fff; }
body.dark #loginPrompt a.btn, body.dark #loginReminder a.btn{ background:#333; color:#eee; }
body.dark #loginPrompt a.btn:hover, body.dark #loginReminder a.btn:hover{ background:#444; }

/* ============= Responsive ============= */
@media (max-width: 900px){
  .content-container{ grid-template-columns: 1fr; }
  .chat-panel, .right-panel{ min-width:0; }
}

/* === Kontrast-fix for "korrekt" besked === */
.msg.correct {
  background: #d1ffd6 !important;       /* lys grøn i lyst tema */
  color: #0f3a1f !important;
  border: 1px solid #b9efc0 !important;
}
body.dark .msg.correct {
  background: #183826 !important;        /* mørk grøn */
  color: #d8f7e5 !important;             /* mint-tekst */
  border: 1px solid #245d3e !important;
}
/* Gør almindelige AI-bobler lidt lysere i dark som reference */
body.dark .msg.ai {
  background: #2a3440 !important;
  color: #e9eef5 !important;
}
/* Chips i dark mode – tydeligere kontrast */
body.dark .quick-prompts .chip {
  background: #2f3946;
  color: #e9eef5;
  border: 1px solid #3b4757;
}
