/* ============================================================
   PA Brainfog Assistent — Warm Notebook Design
   Fonts: Fraunces (headings) + Atkinson Hyperlegible (body)
   ============================================================ */

/* ===== Custom Properties ===== */
:root {
  --bg:            #EDE8DC;
  --surface:       #F7F3EA;
  --surface-high:  #FDFBF6;
  --primary:       #4D7B62;
  --primary-dark:  #3A5E4A;
  --primary-pale:  #E4EFE9;
  --accent:        #B8693A;
  --accent-pale:   #F5E8DF;
  --text:          #27201A;
  --text-muted:    #8A7D72;
  --border:        #D4CBBA;
  --error-bg:      #FDF0EE;
  --error-border:  #E5C4BF;
  --error-text:    #8B3D35;
  --shadow-sm:     0 2px 8px rgba(39,32,26,.07);
  --shadow-md:     0 5px 20px rgba(39,32,26,.11);
  --radius:        14px;
  --radius-sm:     9px;
  --font-display:  'Fraunces', Georgia, serif;
  --font-body:     'Atkinson Hyperlegible', 'Trebuchet MS', sans-serif;
  --max-w:         640px;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
ul { list-style: none; }
button { cursor: pointer; font-family: var(--font-body); }
input, textarea { font-family: var(--font-body); }

/* ===== Base ===== */
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: var(--max-w);
  margin: 0 auto;
  /* subtle paper grain */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
}

/* ===== Header ===== */
header {
  background-color: var(--primary);
  color: #fff;
  padding: 18px 22px 14px;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow-md);
}
.header-inner { display: flex; flex-direction: column; gap: 1px; }

.greeting {
  font-size: .82rem;
  letter-spacing: .04em;
  opacity: .8;
  font-weight: 400;
}
header h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 300;
  letter-spacing: -.01em;
  line-height: 1.1;
}
.datum {
  font-size: .78rem;
  opacity: .65;
  margin-top: 2px;
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1.5px solid var(--border);
  position: sticky;
  top: 84px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 11px 6px 10px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  transition: background .18s, color .18s, border-color .18s;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.tab:hover { background: var(--primary-pale); color: var(--primary); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--primary-pale);
}
.tab-icon { font-size: 1.25rem; line-height: 1; }
.tab-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.badge {
  position: absolute;
  top: 7px;
  right: calc(50% - 20px);
  background: var(--accent);
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ===== Main / Panels ===== */
main { flex: 1; }

.tab-content {
  display: none;
  padding: 24px 20px 110px;
  animation: slideIn .25s ease;
}
.tab-content.active { display: block; }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Section header ===== */
.section-header { margin-bottom: 20px; }
.section-header h2 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 300;
  letter-spacing: -.01em;
  margin-bottom: 3px;
}
.hint { font-size: .9rem; color: var(--text-muted); line-height: 1.55; }

/* ===== Card ===== */
.card {
  background: var(--surface-high);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

/* ===== Field Label ===== */
.field-label {
  display: block;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 12px;
}
.optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: .8rem;
}

/* ===== Energy Buttons ===== */
.energy-buttons {
  display: flex;
  gap: 7px;
}
.energy-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 11px 4px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .18s, background .18s, transform .12s;
  -webkit-tap-highlight-color: transparent;
}
.energy-btn:hover {
  border-color: var(--primary);
  background: var(--primary-pale);
}
.energy-btn.selected {
  border-color: var(--primary);
  background: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(77,123,98,.3);
}
.energy-emoji {
  font-size: 1.45rem;
  line-height: 1;
  display: block;
}
.energy-label {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  text-align: center;
}
.energy-btn.selected .energy-label { color: rgba(255,255,255,.85); }

/* ===== Text Inputs ===== */
.text-input {
  width: 100%;
  padding: 13px 15px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--text);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.text-input::placeholder { color: var(--text-muted); opacity: .65; }
.text-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(77,123,98,.12);
}

.priorities-group { display: flex; flex-direction: column; gap: 9px; }

/* ===== Primary Button ===== */
.btn-primary {
  width: 100%;
  padding: 15px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: .01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .18s, transform .12s, box-shadow .18s;
  box-shadow: var(--shadow-sm);
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }

/* ===== Ghost Button ===== */
.btn-ghost {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: border-color .18s, color .18s;
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost.btn-danger:hover { border-color: #c0392b; color: #c0392b; }

/* ===== Spinner ===== */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Result Card ===== */
.result-card {
  margin-top: 20px;
  background: var(--surface-high);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  animation: slideIn .3s ease;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1.5px solid var(--border);
  background: var(--primary-pale);
}
.result-header h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--primary-dark);
}

/* ===== Plan Content ===== */
.plan-content { padding: 16px 20px; }

.plan-item {
  display: flex;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.plan-item:last-of-type { border-bottom: none; }

.plan-tijd {
  font-size: .72rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-pale);
  border: 1px solid rgba(77,123,98,.2);
  padding: 3px 8px;
  border-radius: 5px;
  white-space: nowrap;
  min-width: 68px;
  text-align: center;
  flex-shrink: 0;
  margin-top: 2px;
  letter-spacing: .03em;
}
.plan-activiteit {
  font-size: .95rem;
  line-height: 1.55;
}

.plan-afsluiting {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  font-style: italic;
  color: var(--text-muted);
  font-size: .88rem;
  line-height: 1.65;
}

/* ===== Notities Textarea ===== */
.notities-textarea {
  width: 100%;
  padding: 16px;
  background: var(--surface-high);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .95rem;
  color: var(--text);
  line-height: 1.75;
  resize: vertical;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
  margin-bottom: 14px;
  min-height: 180px;
}
.notities-textarea::placeholder { color: var(--text-muted); opacity: .55; }
.notities-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(77,123,98,.12);
}

/* ===== Actiepunten List ===== */
.actiepunten-lijst { padding: 8px 20px 16px; }

.actiepunt-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.actiepunt-item:last-child { border-bottom: none; }

.actiepunt-tekst {
  flex: 1;
  font-size: .95rem;
  line-height: 1.5;
}

.btn-toevoegen {
  flex-shrink: 0;
  padding: 6px 11px;
  background: var(--accent-pale);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: .72rem;
  font-weight: 700;
  font-family: var(--font-body);
  letter-spacing: .03em;
  transition: background .18s, color .18s;
  white-space: nowrap;
}
.btn-toevoegen:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}
.btn-toevoegen.toegevoegd {
  background: var(--primary-pale);
  border-color: var(--primary);
  color: var(--primary);
  cursor: default;
}

/* ===== Taken Tab ===== */
.add-taak-row {
  display: flex;
  gap: 9px;
  margin-bottom: 20px;
}

.btn-add {
  width: 50px;
  height: 50px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1.55rem;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .18s, transform .12s;
  -webkit-tap-highlight-color: transparent;
}
.btn-add:hover { background: var(--primary-dark); }
.btn-add:active { transform: scale(.95); }

/* Empty state */
.taken-leeg {
  text-align: center;
  padding: 44px 20px;
  color: var(--text-muted);
}
.taken-leeg-emoji {
  font-size: 2.4rem;
  display: block;
  margin-bottom: 10px;
}
.taken-leeg p { line-height: 1.65; font-size: .95rem; }

/* Task list */
.taken-lijst { margin-bottom: 4px; }

.taak-item {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  animation: slideIn .22s ease;
}
.taak-item:last-child { border-bottom: none; }

/* Checkbox */
.taak-check {
  width: 26px;
  height: 26px;
  border: 2px solid var(--border);
  border-radius: 7px;
  flex-shrink: 0;
  background: var(--surface-high);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  transition: border-color .18s, background .18s;
  -webkit-tap-highlight-color: transparent;
}
.taak-check:hover { border-color: var(--primary); }
.taak-check.gedaan {
  background: var(--primary);
  border-color: var(--primary);
}
.taak-check.gedaan::after {
  content: '✓';
  color: #fff;
  font-size: .85rem;
  font-weight: 700;
}

.taak-tekst {
  flex: 1;
  font-size: .95rem;
  line-height: 1.55;
  padding-top: 3px;
  word-break: break-word;
}
.taak-item.is-gedaan .taak-tekst {
  text-decoration: line-through;
  color: var(--text-muted);
}

.taak-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 4px 2px;
  opacity: 0;
  transition: opacity .18s;
  margin-top: 2px;
  flex-shrink: 0;
}
.taak-item:hover .taak-delete { opacity: 1; }
.taak-delete:hover { color: #c0392b; }

/* Gedaan sectie */
.gedaan-sectie { margin-top: 24px; }

.gedaan-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  background: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  width: 100%;
  text-align: left;
  transition: color .18s;
}
.gedaan-header:hover { color: var(--text); }

.gedaan-count {
  background: var(--border);
  color: var(--text-muted);
  font-size: .65rem;
  padding: 2px 7px;
  border-radius: 20px;
}
.gedaan-arrow {
  margin-left: auto;
  font-size: 1.1rem;
  transition: transform .2s;
  display: inline-block;
}
.gedaan-sectie.open .gedaan-arrow { transform: rotate(90deg); }

.gedaan-lijst { opacity: .65; }

#wis-gedaan { margin-top: 10px; width: 100%; }

/* ===== Error Card ===== */
.error-card {
  margin-top: 16px;
  padding: 16px 18px;
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideIn .25s ease;
}
.error-icon { font-size: 1.3rem; flex-shrink: 0; line-height: 1.4; }
.error-text { font-size: .88rem; color: var(--error-text); margin-bottom: 8px; }
.error-card .btn-ghost {
  border-color: var(--error-border);
  color: var(--error-text);
}
.error-card .btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== Utility ===== */
.hidden { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 380px) {
  .energy-label { display: none; }
  .energy-emoji { font-size: 1.6rem; }
  header h1 { font-size: 1.5rem; }
}
