@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --primary:    #FF6B35;
  --primary-dk: #e5541e;
  --purple:     #7B2FBE;
  --purple-lt:  #9b59d4;
  --teal:       #2EC4B6;
  --teal-dk:    #22a99d;
  --yellow:     #FFD700;
  --green:      #27AE60;
  --red:        #E74C3C;
  --bg:         #FFF8F0;
  --card-bg:    #ffffff;
  --text:       #2D3748;
  --text-light: #718096;
  --border:     #E8D5C4;
  --shadow:     0 4px 16px rgba(0,0,0,.10);
  --radius:     16px;
  --radius-sm:  10px;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Login page ─────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(135deg, #FF6B35 0%, #7B2FBE 50%, #2EC4B6 100%);
}

.login-box {
  background: white;
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  text-align: center;
}

.login-logo {
  font-size: 4rem;
  margin-bottom: .5rem;
  display: block;
}

.login-box h1 {
  font-size: 2rem;
  font-weight: 900;
  color: var(--primary);
  margin-bottom: .25rem;
}

.login-box p.tagline {
  color: var(--text-light);
  margin-bottom: 2rem;
  font-size: .95rem;
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Navbar ─────────────────────────────────────────────────────────────────── */
.navbar {
  background: linear-gradient(135deg, var(--primary) 0%, #ff8c5a 100%);
  color: white;
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 2px 12px rgba(255,107,53,.35);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  font-size: 1.4rem;
  font-weight: 900;
  text-decoration: none;
  color: white;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.navbar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .75rem;
  font-weight: 700;
  font-size: .95rem;
}

.credits-badge {
  background: var(--yellow);
  color: #7a5a00;
  border-radius: 999px;
  padding: .25rem .75rem;
  font-weight: 800;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: .3rem;
}

/* ── Nav tabs ───────────────────────────────────────────────────────────────── */
.nav-tabs {
  display: flex;
  background: white;
  border-bottom: 2px solid var(--border);
  padding: 0 1rem;
  overflow-x: auto;
  gap: .25rem;
}

.nav-tab {
  padding: .75rem 1.25rem;
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-light);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all .2s;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}

.nav-tab:hover { color: var(--primary); }
.nav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── Main content ───────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  padding: 1.5rem 1rem;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

/* ── Section ────────────────────────────────────────────────────────────────── */
.section { display: none; }
.section.active { display: block; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: .75rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--purple);
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  transition: transform .2s, border-color .2s;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.card:hover { transform: translateY(-3px); border-color: var(--primary); }

.card-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
}

.card-desc {
  font-size: .9rem;
  color: var(--text-light);
  flex: 1;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
}

.reward-badge {
  background: linear-gradient(135deg, var(--yellow), #ffc200);
  color: #7a5a00;
  font-weight: 800;
  border-radius: 999px;
  padding: .3rem .85rem;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: .25rem;
}

/* ── Child overview card ────────────────────────────────────────────────────── */
.child-card {
  background: linear-gradient(135deg, #f8f0ff, #fff0fa);
  border: 2px solid #e0c5f5;
}

.child-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--purple-lt));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 900;
  flex-shrink: 0;
}

.child-info {
  flex: 1;
}

.child-name {
  font-size: 1.1rem;
  font-weight: 800;
}

.child-credits {
  font-size: .9rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: .25rem;
}

/* ── Status badges ──────────────────────────────────────────────────────────── */
.badge {
  border-radius: 999px;
  padding: .2rem .7rem;
  font-size: .8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}

.badge-open      { background: #e8f5e9; color: var(--green); }
.badge-pending   { background: #fff3e0; color: #e67e22; }
.badge-completed { background: #e3f2fd; color: #1565C0; }
.badge-rejected  { background: #fde8e8; color: var(--red); }
.badge-photo     { background: #f3e5f5; color: var(--purple); }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.btn:active { transform: translateY(0); }

.btn-primary   { background: var(--primary); color: white; }
.btn-purple    { background: var(--purple); color: white; }
.btn-teal      { background: var(--teal); color: white; }
.btn-green     { background: var(--green); color: white; }
.btn-red       { background: var(--red); color: white; }
.btn-yellow    { background: var(--yellow); color: #7a5a00; }
.btn-ghost     { background: transparent; color: var(--text); border: 2px solid var(--border); }
.btn-sm        { padding: .35rem .8rem; font-size: .85rem; }
.btn-lg        { padding: .85rem 1.75rem; font-size: 1.1rem; }
.btn-block     { width: 100%; justify-content: center; }

/* ── Forms ──────────────────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-bottom: 1rem;
}

label {
  font-weight: 700;
  font-size: .9rem;
  color: var(--text);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"],
textarea,
select {
  padding: .65rem .9rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .95rem;
  color: var(--text);
  background: white;
  transition: border-color .2s;
  width: 100%;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
}

textarea { resize: vertical; min-height: 80px; }

.checkbox-group {
  display: flex;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* ── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open { display: flex; }

.modal {
  background: white;
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--purple);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
  padding: .25rem;
  border-radius: 6px;
  transition: background .2s;
}

.modal-close:hover { background: var(--border); }

/* ── Alert ──────────────────────────────────────────────────────────────────── */
.alert {
  padding: .85rem 1.1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.alert-error { background: #fde8e8; color: var(--red); border: 1px solid #f5c2c2; }
.alert-success { background: #e8f5e9; color: var(--green); border: 1px solid #c8e6c9; }
.alert-info { background: #e3f2fd; color: #1565C0; border: 1px solid #bbdefb; }

/* ── Empty state ────────────────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-light);
}

.empty-icon { font-size: 3.5rem; margin-bottom: .75rem; display: block; }
.empty h3 { font-size: 1.2rem; font-weight: 800; margin-bottom: .5rem; color: var(--text); }

/* ── Review card (pending submissions) ──────────────────────────────────────── */
.review-card {
  background: linear-gradient(135deg, #fff8e1, #fff);
  border: 2px solid #ffe082;
}

.photo-preview {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  margin-top: .5rem;
}

/* ── Progress / Credits hero ────────────────────────────────────────────────── */
.credits-hero {
  background: linear-gradient(135deg, var(--purple), var(--purple-lt));
  color: white;
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.credits-hero .amount {
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 1;
}

.credits-hero .label {
  font-size: 1.1rem;
  opacity: .85;
  margin-top: .25rem;
}

/* ── Shop item card ─────────────────────────────────────────────────────────── */
.shop-card {
  background: linear-gradient(135deg, #f0fff4, #fff);
  border: 2px solid #b2dfdb;
}

.shop-card .cost {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--teal-dk);
  display: flex;
  align-items: center;
  gap: .3rem;
}

/* ── Completed task pill ────────────────────────────────────────────────────── */
.completed-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: white;
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
}

.completed-item .icon { font-size: 1.5rem; }
.completed-item .info { flex: 1; }
.completed-item .title { font-weight: 700; font-size: .95rem; }
.completed-item .date { font-size: .8rem; color: var(--text-light); }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .cards { grid-template-columns: 1fr; }
  .main { padding: 1rem .75rem; }
  .modal { padding: 1.5rem 1rem; }
  .section-title { font-size: 1.25rem; }
  .credits-hero .amount { font-size: 2.5rem; }
}

/* ── Spinner ────────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Divider ────────────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 1.5rem 0;
}

/* ── Redemption row ─────────────────────────────────────────────────────────── */
.redemption-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: white;
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  margin-bottom: .5rem;
}

.redemption-row .child-label {
  font-weight: 800;
  font-size: .9rem;
  color: var(--purple);
}

.redemption-row .offer-label {
  font-size: .95rem;
  font-weight: 600;
}

.redemption-row .cost-label {
  margin-left: auto;
  font-weight: 800;
  color: var(--teal-dk);
}

/* ── Inline row actions ─────────────────────────────────────────────────────── */
.action-row {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
