/* Self-hosted fonts (SIL Open Font License, see fonts/OFL-*.txt). No third-party font requests. */
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter-Variable.woff2') format('woff2-variations'), url('fonts/Inter-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: #f5f6fa;
  color: #1f2430;
  min-height: 100vh;
}

.login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-view[hidden] { display: none; }

.login-box {
  background: white;
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  text-align: center;
  max-width: 320px;
  width: 100%;
}

.login-box h1 { margin: 0 0 6px; font-size: 20px; }
.login-box p { color: #6b7280; margin: 0 0 16px; font-size: 14px; }

.login-box input {
  width: 100%;
  padding: 12px;
  font-size: 20px;
  text-align: center;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  margin-bottom: 12px;
}

.login-box button {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: #4f46e5;
  color: white;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

.login-error { color: #dc2626; margin-top: 10px; font-size: 13px; }

.oauth-buttons { display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; }

/* Extra ".login-box" prefix on the next two rules is deliberate: ".login-box
   button" (one class + one element = higher specificity than ".oauth-btn"
   alone) was silently winning and painting these as generic purple buttons -
   same family of bug as the [hidden]-vs-class-display issue elsewhere in this
   codebase, just via specificity instead of the cascade this time. */
.login-box .oauth-btn {
  display: block;
  text-decoration: none;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 11px;
  font-weight: 600;
  font-size: 14px;
  color: #1f2430;
  background: white;
}
.oauth-btn.oauth-google:before { content: "🇬 "; }
.oauth-btn.oauth-microsoft:before { content: "🪟 "; }
.oauth-btn.oauth-apple:before { content: "🍎 "; }

.oauth-divider[hidden] { display: none; }

.oauth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #9ca3af;
  font-size: 12px;
  margin: 14px 0;
}
.oauth-divider::before, .oauth-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid #e5e7eb;
}

.admin-lang-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 18px;
}

.login-box .lang-choice {
  border: 1px solid #d1d5db;
  background: #f9fafb;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
  color: #374151;
}

.login-box .lang-choice.selected { border-color: #4f46e5; background: #eef2ff; color: #4f46e5; }

.locale-select { background: #f3f4f6; border: 1px solid #d1d5db; }

.admin-view[hidden] { display: none; }

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1f2430;
  color: white;
  padding: 16px 20px;
}

.admin-title { font-weight: 700; font-size: 17px; }

/* The "Opprett en her →" / "Creane una qui →" link is short on purpose - it
   must never break mid-phrase across two lines (looked broken in Italian,
   the longest of the four translations at this font-size). The sentence
   before it can still wrap normally. */
#no-household-hint a { white-space: nowrap; display: inline-block; }

.staging-badge {
  background: #f59e0b;
  color: #1a1200;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 2px solid #1a1200;
}
.child-link { color: #a5b4fc; text-decoration: none; font-size: 14px; }

.admin-tabs {
  display: flex;
  gap: 6px;
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  overflow-x: auto;
}

.admin-tab-btn {
  border: none;
  background: #f3f4f6;
  color: #374151;
  font-weight: 600;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}

.admin-tab-btn.active { background: #4f46e5; color: white; }

main { padding: 16px; max-width: 720px; margin: 0 auto; }

.admin-section[hidden] { display: none; }

.admin-form {
  background: white;
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-form h2 { margin: 0 0 4px; font-size: 16px; }

.admin-form input, .admin-form textarea, .admin-form select {
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}

.form-row { display: flex; gap: 10px; }
.form-row input, .form-row select { flex: 1; }

.admin-form button {
  border: none;
  background: #4f46e5;
  color: white;
  font-weight: 600;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
}

.admin-list { display: flex; flex-direction: column; gap: 12px; }

.admin-card {
  background: white;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.admin-card.inactive { opacity: 0.5; }

.admin-card-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.admin-card-sub { font-size: 13px; color: #6b7280; margin-bottom: 8px; }
.admin-card-desc { font-size: 13px; color: #4b5563; margin-bottom: 8px; }

.proof-media {
  max-width: 100%;
  max-height: 280px;
  border-radius: 10px;
  margin-bottom: 10px;
  display: block;
}

.no-proof {
  font-size: 13px;
  color: #9ca3af;
  font-style: italic;
  margin-bottom: 10px;
}

.admin-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.admin-card-actions button, .admin-card-actions select {
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.approve-btn { background: #10b981; color: white; }
.reject-btn { background: #ef4444; color: white; }
.toggle-btn { background: #e5e7eb; color: #374151; }
.export-btn { background: #dbeafe; color: #1e40af; }
.delete-btn { background: #fee2e2; color: #b91c1c; }
.status-select { background: #f3f4f6; border: 1px solid #d1d5db; }

.empty {
  text-align: center;
  color: #9ca3af;
  padding: 30px;
}

.admin-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2430;
  color: white;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  z-index: 200;
}

.admin-toast[hidden] { display: none; }

.learning-topic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid #f3f4f6;
  font-size: 13px;
}

.learning-topic-name { font-weight: 600; flex: 1; }
.learning-topic-stars { letter-spacing: 1px; }
.learning-topic-acc { color: #6b7280; font-size: 12px; white-space: nowrap; }

.learning-child-header {
  font-weight: 800;
  font-size: 16px;
  margin: 18px 0 4px;
  color: #1f2430;
}

.learning-child-header:first-child { margin-top: 0; }

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.confirm-modal[hidden] { display: none; }
.confirm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.confirm-modal-panel {
  position: relative;
  background: white;
  border-radius: 16px;
  padding: 24px;
  max-width: 440px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.confirm-modal-close-x {
  position: sticky;
  top: 0;
  float: right;
  margin: -8px -8px 0 0;
  background: #f3f4f6;
  border: none;
  border-radius: 999px;
  width: 32px;
  height: 32px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: #374151;
}
.confirm-modal-panel h3 { margin: 0 0 12px; color: #1f2430; }
.confirm-modal-panel .gdpr-disclaimer {
  font-size: 13px;
  line-height: 1.5;
  color: #4b5563;
  background: #f9f5ff;
  border-left: 3px solid #7c3aed;
  padding: 10px 12px;
  border-radius: 4px;
  margin: 0 0 16px;
}
.confirm-modal-panel label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.confirm-modal-panel input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}
.confirm-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.confirm-modal-actions button { padding: 8px 16px; border-radius: 8px; border: none; font-weight: 600; cursor: pointer; }
#delete-child-cancel-btn { background: #f3f4f6; color: #1f2430; }
#delete-child-confirm-btn { background: #dc2626; color: white; }
#delete-child-confirm-btn:disabled { background: #f3a8a8; cursor: not-allowed; }

/* ---------- First-run onboarding wizard ---------- */
.onboarding-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(160deg, #fff4e0 0%, #ffe0ec 45%, #e0f0ff 100%);
}
.onboarding-view[hidden] { display: none; }

.onboarding-box {
  background: white;
  border-radius: 24px;
  padding: 28px 24px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.onboarding-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
}
.onboarding-progress span {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: #ede9fe;
}
.onboarding-progress span.done { background: linear-gradient(135deg, #7c3aed, #ec4899); }

.onboarding-step[hidden] { display: none; }

.onboarding-step h1 { font-size: 20px; margin: 0 0 10px; text-align: center; color: #3a2a4a; }

.onboarding-text { font-size: 14px; color: #6b6178; line-height: 1.5; margin: 0 0 16px; }

.onboarding-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #3a2a4a;
  margin-bottom: 6px;
}

.onboarding-step input[type="text"],
.onboarding-step select {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  border: 2px solid #ddd6fe;
  border-radius: 12px;
  margin-bottom: 12px;
  font-family: inherit;
  background: #faf5ff;
}

.onboarding-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: #3a2a4a;
  line-height: 1.4;
  margin-bottom: 14px;
  cursor: pointer;
}
.onboarding-checkbox input { width: 18px; height: 18px; margin-top: 2px; flex-shrink: 0; }

.onboarding-step button {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-weight: 700;
  font-size: 15px;
  color: white;
  cursor: pointer;
  background: linear-gradient(135deg, #7c3aed, #ec4899);
}
.onboarding-step button:active { transform: scale(0.97); }

.onboarding-avatar-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}
.avatar-choice {
  border: 2px solid #e5e7eb;
  background: #faf5ff;
  border-radius: 10px;
  font-size: 22px;
  width: 44px;
  height: 44px;
  cursor: pointer;
}
.avatar-choice.selected { border-color: #7c3aed; background: #ede9fe; }

.onboarding-quest-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.quest-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid #ddd6fe;
  background: #faf5ff;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  color: #3a2a4a;
  cursor: pointer;
}
.quest-choice input { width: 18px; height: 18px; flex-shrink: 0; }
.quest-choice.selected { border-color: #7c3aed; background: #ede9fe; }
.quest-choice-emoji { font-size: 18px; }
.quest-choice-label { flex: 1; font-weight: 600; }
.quest-choice-tokens { font-size: 12px; color: #7c3aed; font-weight: 700; white-space: nowrap; }
