/* ══════════════════════════════════════════════════════════════
   Familiens Beløningssystem — Global CSS
   Optimeret til touch-skærme (tablets)
   ══════════════════════════════════════════════════════════════ */

:root {
  --bg:          #0f172a;
  --surface:     #1e293b;
  --surface2:    #273449;
  --border:      #334155;
  --text:        #f1f5f9;
  --text-muted:  #94a3b8;
  --primary:     #6366f1;
  --primary-h:   #818cf8;
  --success:     #22c55e;
  --warning:     #f59e0b;
  --danger:      #ef4444;
  --zaid:        #38bdf8;   /* sky blue */
  --rayhana:     #f472b6;   /* rose */
  --radius:      12px;
  --radius-lg:   20px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* ── Typografi ─────────────────────────────────────────────── */
h1 { font-size: 1.8rem; font-weight: 700; }
h2 { font-size: 1.4rem; font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 600; }
p  { line-height: 1.6; }

/* ── Layout-hjælpere ───────────────────────────────────────── */
.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.items-center{ align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1       { gap: 0.5rem; }
.gap-2       { gap: 1rem; }
.gap-3       { gap: 1.5rem; }
.mt-1        { margin-top: 0.5rem; }
.mt-2        { margin-top: 1rem; }
.mt-3        { margin-top: 1.5rem; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); font-size: 0.9rem; }
.full-height { height: 100%; }
.w-full      { width: 100%; }

/* ── Kort / flader ─────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.card-lg {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}

/* ── Knapper ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.4rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.btn-primary  { background: var(--primary);  color: #fff; }
.btn-success  { background: var(--success);  color: #fff; }
.btn-danger   { background: var(--danger);   color: #fff; }
.btn-warning  { background: var(--warning);  color: #000; }
.btn-ghost    { background: var(--surface2); color: var(--text); }
.btn-lg       { padding: 1rem 2rem; font-size: 1.15rem; border-radius: var(--radius-lg); }
.btn-full     { width: 100%; }

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs {
  display: flex;
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 0.25rem;
  gap: 0.25rem;
}
.tab-btn {
  flex: 1;
  padding: 0.6rem 0.5rem;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab-btn.active {
  background: var(--primary);
  color: #fff;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Fremgangsbjælke ────────────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 14px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--primary);
  transition: width 0.4s ease;
}

/* ── Opgave-liste ────────────────────────────────────────────── */
.task-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--surface2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}
.task-item:hover  { background: #2d3d55; }
.task-item.done   { opacity: 0.55; }
.task-item .pts   {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
}

/* ── Belønningskort ──────────────────────────────────────────── */
.reward-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
.reward-card {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 1.2rem;
  text-align: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.15s;
}
.reward-card:hover  { border-color: var(--primary); transform: translateY(-2px); }
.reward-card.locked { opacity: 0.45; cursor: not-allowed; }
.reward-card .icon  { font-size: 2.5rem; }
.reward-card .name  { font-weight: 600; margin-top: 0.4rem; }
.reward-card .cost  { color: var(--warning); font-size: 0.9rem; margin-top: 0.2rem; }

/* ── Logfeed ─────────────────────────────────────────────────── */
.log-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.log-item:last-child { border-bottom: none; }
.log-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
  white-space: nowrap;
}
.badge-salah   { background: #1e3a8a33; color: #93c5fd; }
.badge-quran   { background: #14532d33; color: #86efac; }
.badge-chore   { background: #78350f33; color: #fcd34d; }
.badge-manners { background: #4c1d9533; color: #c4b5fd; }

/* ── PIN-skærm ───────────────────────────────────────────────── */
.pin-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}
.pin-dots {
  display: flex;
  gap: 1rem;
}
.pin-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: background 0.15s;
}
.pin-dot.filled { background: var(--primary); border-color: var(--primary); }
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  width: min(280px, 80vw);
}
.pin-key {
  aspect-ratio: 1;
  border: none;
  background: var(--surface2);
  border-radius: var(--radius);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s, transform 0.1s;
}
.pin-key:active { background: var(--primary); transform: scale(0.93); }

/* ── Skærmtid-timer ─────────────────────────────────────────── */
.timer-circle {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 6px solid var(--surface2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 0 auto;
}
.timer-circle svg {
  position: absolute;
  inset: -6px;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  transform: rotate(-90deg);
}
.timer-circle .time-text { font-size: 2rem; font-weight: 700; }
.timer-circle .time-label { font-size: 0.8rem; color: var(--text-muted); }

/* ── Toast-notifikationer ────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 200;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1.2rem;
  font-size: 0.95rem;
  min-width: 220px;
  box-shadow: 0 4px 24px #0008;
  animation: slide-in 0.25s ease;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error   { border-left: 4px solid var(--danger); }
.toast.info    { border-left: 4px solid var(--primary); }
@keyframes slide-in {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Rollevælger (index) ─────────────────────────────────────── */
.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  max-width: 700px;
  width: 100%;
  margin: 2rem auto 0;
}
.role-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem 1.5rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}
.role-card:hover  { border-color: var(--primary); transform: translateY(-3px); }
.role-card .emoji { font-size: 3.5rem; }
.role-card .label { font-size: 1.3rem; font-weight: 700; }
.role-card.zaid    { border-color: var(--zaid); }
.role-card.rayhana { border-color: var(--rayhana); }

/* ── Scroll ─────────────────────────────────────────────────── */
.scroll-y {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: #000a;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: min(420px, 100%);
  border: 1px solid var(--border);
}

/* ── Responsiv ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  h1 { font-size: 1.5rem; }
  .card-lg { padding: 1.2rem; }
  .reward-grid { grid-template-columns: repeat(2, 1fr); }
}
