/* ============================================================
   style.css — Little Stars
   Full design system: variables, reset, layout, components
   ============================================================ */


/* ============================================================
   CSS VARIABLES — Design tokens
   All colors, fonts, radii, and spacing defined here.
   Never hardcode these values elsewhere — always use variables.
   ============================================================ */
:root {
  /* Background colors */
  --color-bg:               #FEFAF4;  /* Warm cream — app background */
  --color-evan-bg:          #EBF4FC;  /* Soft blue — Evan's side */
  --color-jonah-bg:         #EBF7EE;  /* Soft green — Jonah's side */

  /* Accent colors */
  --color-evan-accent:      #4A90C4;  /* Medium blue — Evan */
  --color-jonah-accent:     #5BAD6F;  /* Medium green — Jonah */
  --color-amber:            #F0A500;  /* Warm amber — primary accent */
  --color-coral:            #E8734A;  /* Soft coral — secondary accent */
  --color-completion:       #5BAD6F;  /* Sage green — completion states */

  /* Text colors */
  --color-text-primary:     #2C1A0E;  /* Warm dark brown */
  --color-text-secondary:   #C4A882;  /* Light brown */

  /* UI colors */
  --color-divider:          #D6C9B8;  /* Warm taupe — dividers */
  --color-tile-bg:          #FFFFFF;  /* White — task tiles */
  --color-soft-bg:          #F5F0EA;  /* Off-white taupe — soft backgrounds */
  --color-settings-bg:      #F8F5F0;  /* Light clean — parent settings */

  /* Typography */
  --font-display:           'Fredoka One', cursive;       /* Titles, kid names, large headings */
  --font-body:              'Baloo 2', sans-serif;        /* All body text, task labels */

  /* Border radius */
  --radius-card:            16px;   /* Cards and large tiles */
  --radius-tile:            14px;   /* Task tiles */
  --radius-pill:            50px;   /* Pill buttons */
  --radius-modal:           20px;   /* Modals and overlays */

  /* Spacing */
  --top-bar-height:         52px;
  --side-divider-width:     2px;
}


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

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden; /* Kiosk — no scrolling at the top level */
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  display: flex;
  flex-direction: column;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font-body);
}

.hidden {
  display: none !important;
}


/* ============================================================
   TOP BAR
   Shared neutral strip at the top — spans full width
   App title centered, gear icon top right
   ============================================================ */
#top-bar {
  height: var(--top-bar-height);
  background-color: var(--color-bg);
  border-bottom: 1px solid var(--color-divider);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  z-index: 10;
}

#app-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--color-text-primary);
  letter-spacing: 0.02em;
}

#parent-gear-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  opacity: 0.4; /* Subtle — not meant to attract kids' attention */
  padding: 6px;
  border-radius: 50%;
  transition: opacity 0.2s;
}

#parent-gear-btn:hover {
  opacity: 0.7;
}


/* ============================================================
   MAIN APP AREA
   Fills remaining height below top bar
   Split vertically: Evan left, Jonah right
   ============================================================ */
#app {
  display: flex;
  flex-direction: row;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - var(--top-bar-height));
}

/* Each kid's side takes exactly half the width */
.kid-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

#side-evan {
  background-color: var(--color-evan-bg);
}

#side-jonah {
  background-color: var(--color-jonah-bg);
}

/* Vertical divider between the two sides */
#side-divider {
  width: var(--side-divider-width);
  background-color: var(--color-divider);
  flex-shrink: 0;
}


/* ============================================================
   HOME SCREEN
   Kid name header + list buttons stacked vertically
   ============================================================ */
.home-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
  gap: 16px;
  height: 100%;
}

.kid-name-header {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--color-text-primary);
  margin-bottom: 8px;
}

/* List button — large rounded card with icon + name */
.list-btn {
  width: 100%;
  max-width: 280px;
  background-color: var(--color-tile-bg);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}

.list-btn:active {
  transform: scale(0.97);
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

.list-btn-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.list-btn-name {
  flex: 1;
  text-align: left;
}

/* Completed state — green border + green background + corner check */
.list-btn.completed {
  border: 2px solid var(--color-completion);
  background-color: #EBF7EE;
}

.list-btn.completed .list-btn-check {
  display: flex;
}

.list-btn-check {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  background-color: var(--color-completion);
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: white;
}


/* ============================================================
   CHECKLIST SCREEN
   Reveal image underneath, tile grid on top with zero gap
   ============================================================ */
.checklist-screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Checklist header — list icon top right, back button top left */
.checklist-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 20;
  background: transparent;
}

.checklist-back-btn {
  font-size: 1.5rem;
  padding: 6px;
  opacity: 0.6;
}

.checklist-list-icon {
  font-size: 1.5rem;
  opacity: 0.6;
}

/* Reveal image — fills entire kid side, sits behind tiles */
.reveal-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

/* Tile grid — sits on top of reveal image, zero gap */
.tile-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: grid;
  gap: 0; /* Zero gap — tiles must fully cover reveal image */
  z-index: 10;
}

/* Individual task tile */
.tile {
  background-color: var(--color-tile-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border: 0.5px solid rgba(0,0,0,0.06);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  overflow: hidden;
}

.tile-done {
  background: transparent !important;
  border: none !important;
  pointer-events: none;
}

.tile-emoji {
  font-size: 1.8rem;
  line-height: 1;
}

.tile-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-primary);
  text-align: center;
  line-height: 1.2;
}

/* Tile disappear animations — randomly assigned on tap */
@keyframes tile-fade {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes tile-scale-up-fade {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(1.3); }
}

@keyframes tile-scale-down-fade {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.5); }
}

@keyframes tile-bounce-fade {
  0%   { opacity: 1; transform: scale(1); }
  40%  { transform: scale(1.15); }
  70%  { transform: scale(0.95); }
  100% { opacity: 0; transform: scale(1); }
}

.tile.anim-fade          { animation: tile-fade 0.35s ease forwards; }
.tile.anim-scale-up-fade { animation: tile-scale-up-fade 0.35s ease forwards; }
.tile.anim-scale-down-fade { animation: tile-scale-down-fade 0.35s ease forwards; }
.tile.anim-bounce-fade   { animation: tile-bounce-fade 0.4s ease forwards; }


/* ============================================================
   COMPLETION STATE
   Star overlay with message, fades after ~3 seconds
   ============================================================ */
.completion-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  pointer-events: none;
}

.completion-message {
  background: rgba(0,0,0,0.45);
  border-radius: var(--radius-modal);
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: completion-fade 3s ease forwards;
}

.completion-star {
  font-size: 3rem;
}

.completion-text {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: #FFFFFF;
  text-align: center;
}

@keyframes completion-fade {
  0%   { opacity: 0; transform: scale(0.85); }
  15%  { opacity: 1; transform: scale(1); }
  75%  { opacity: 1; }
  100% { opacity: 0; }
}


/* ============================================================
   COMPLETED IMAGE VIEW
   Full reveal image with back button — shown when tapping a completed list
   ============================================================ */
.completed-image-screen {
  position: relative;
  width: 100%;
  height: 100%;
}

.completed-image-screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.completed-image-back-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255,255,255,0.85);
  color: var(--color-text-primary);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}


/* ============================================================
   PIN OVERLAY
   Full-screen overlay shown when gear is tapped
   ============================================================ */
#pin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#pin-modal {
  background: var(--color-settings-bg);
  border-radius: var(--radius-modal);
  padding: 32px 28px;
  width: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

#pin-modal h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--color-text-primary);
}

#pin-modal p {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

#pin-display {
  display: flex;
  gap: 10px;
  margin: 4px 0;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--color-divider);
  background: transparent;
  transition: background 0.15s;
}

.pin-dot.filled {
  background: var(--color-amber);
  border-color: var(--color-amber);
}

#pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}

.pin-key {
  background: var(--color-tile-bg);
  border-radius: var(--radius-tile);
  padding: 14px;
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--color-text-primary);
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.07);
  transition: transform 0.1s;
}

.pin-key:active {
  transform: scale(0.94);
}

#pin-cancel-btn {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  padding: 6px 12px;
}


/* ============================================================
   PARENT SETTINGS PANEL
   Full-screen, light clean background, two-column per-kid layout
   ============================================================ */
#settings-panel {
  position: fixed;
  inset: 0;
  background: var(--color-settings-bg);
  z-index: 90;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-divider);
  flex-shrink: 0;
}

.settings-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--color-text-primary);
}

.settings-close-btn {
  font-size: 1.4rem;
  opacity: 0.5;
  padding: 6px;
}

.settings-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Two-column per-kid layout */
.settings-kids-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.settings-kid-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-kid-col-header {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--color-text-primary);
  padding-bottom: 4px;
  border-bottom: 2px solid var(--color-divider);
}

#settings-evan-col .settings-kid-col-header {
  border-color: var(--color-evan-accent);
  color: var(--color-evan-accent);
}

#settings-jonah-col .settings-kid-col-header {
  border-color: var(--color-jonah-accent);
  color: var(--color-jonah-accent);
}

/* Settings section label */
.settings-section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
  margin-top: 8px;
}

/* Settings row */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-tile-bg);
  border-radius: var(--radius-tile);
  padding: 12px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

/* Settings action button (e.g. Reset, Manage Images) */
.settings-action-btn {
  background: var(--color-soft-bg);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-primary);
  border: 1px solid var(--color-divider);
}

/* Global settings section (spans full width) */
.settings-global-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-global-section-header {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--color-text-primary);
  padding-bottom: 4px;
  border-bottom: 2px solid var(--color-divider);
}
