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

/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --orange: #F7941D;
  --orange-dark: #E07A00;
  --orange-light: #FFF0DC;
  --navy: #1A3A5C;
  --navy-light: #2E5F9E;
  --green: #27ae60;
  --red: #e74c3c;
  --bg: #FFFBF5;
  --white: #FFFFFF;
  --gray-100: #f8f8f8;
  --gray-200: #eeeeee;
  --gray-400: #aaaaaa;
  --gray-600: #666666;
  --gray-800: #333333;
  --text: #1a1a2e;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-hover: 0 8px 32px rgba(0,0,0,0.14);
}
html { scroll-behavior: smooth; }
body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--orange); }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; }

/* ─── Typography ───────────────────────────────────────────────────────────── */
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 900; line-height: 1.2; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 800; }
h3 { font-size: 1.1rem; font-weight: 700; }

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--orange); color: white;
  padding: 10px 24px; border-radius: 50px; font-weight: 700; font-size: 0.95rem;
  transition: all 0.2s; border: 2px solid var(--orange);
}
.btn-primary:hover { background: var(--orange-dark); border-color: var(--orange-dark); color: white; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(247,148,29,0.35); }
.btn-primary.btn-lg { padding: 14px 32px; font-size: 1.05rem; }
.btn-ghost { display: inline-flex; align-items: center; gap: 8px; background: transparent; color: var(--navy); padding: 10px 24px; border-radius: 50px; font-weight: 700; border: 2px solid var(--navy); transition: all 0.2s; }
.btn-ghost:hover { background: var(--navy); color: white; }
.btn-ghost.btn-lg { padding: 14px 32px; font-size: 1.05rem; }
.btn-outline-sm { background: transparent; color: var(--gray-600); padding: 6px 14px; border-radius: 50px; font-size: 0.85rem; font-weight: 600; border: 1.5px solid var(--gray-200); transition: all 0.2s; }
.btn-outline-sm:hover { border-color: var(--orange); color: var(--orange); }
.btn-sponsor { width: 100%; background: var(--orange); color: white; padding: 12px; border-radius: 10px; font-size: 1rem; font-weight: 700; transition: all 0.2s; margin-top: 12px; }
.btn-sponsor:hover { background: var(--orange-dark); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(247,148,29,0.4); }
.btn-cancel { width: 100%; background: transparent; color: var(--red); padding: 10px; border-radius: 10px; font-size: 0.9rem; font-weight: 700; border: 1.5px solid var(--red); transition: all 0.2s; margin-top: 12px; }
.btn-cancel:hover { background: var(--red); color: white; }

/* ─── Header / Nav ─────────────────────────────────────────────────────────── */
header {
  position: sticky; top: 0; z-index: 100;
  background: var(--white); border-bottom: 1px solid var(--gray-200);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
nav { max-width: 1200px; margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.05rem; color: var(--navy); flex-shrink: 0; }
.logo-icon { width: 36px; height: 36px; background: var(--orange); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; color: white; }
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-link { padding: 6px 14px; border-radius: 50px; font-weight: 600; font-size: 0.9rem; color: var(--gray-600); transition: all 0.2s; }
.nav-link:hover, .nav-link.active { color: var(--orange); background: var(--orange-light); }
.user-menu { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid var(--orange); }
.user-name { font-weight: 700; font-size: 0.9rem; color: var(--navy); }

/* ─── Main Layout ──────────────────────────────────────────────────────────── */
#main-content { min-height: calc(100vh - 64px - 80px); }
.section-inner { max-width: 1200px; margin: 0 auto; padding: 60px 24px; }
.section-title { text-align: center; margin-bottom: 40px; color: var(--navy); }
.page-header { max-width: 1200px; margin: 0 auto; padding: 40px 24px 20px; text-align: center; }
.page-header h1 { color: var(--navy); }
.page-header p { color: var(--gray-600); margin-top: 10px; max-width: 600px; margin-left: auto; margin-right: auto; }

/* ─── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, #0d2540 100%);
  color: white; padding: 80px 24px;
  display: grid; grid-template-columns: 1fr auto; gap: 40px;
  align-items: center; max-width: 100%;
}
.hero-content { max-width: 620px; margin: 0 auto; }
.hero-badge { display: inline-block; background: rgba(247,148,29,0.2); color: var(--orange); border: 1px solid rgba(247,148,29,0.4); padding: 6px 16px; border-radius: 50px; font-size: 0.85rem; font-weight: 700; margin-bottom: 20px; }
.hero h1 { color: white; margin-bottom: 20px; }
.hero-sub { color: rgba(255,255,255,0.8); font-size: 1.1rem; margin-bottom: 32px; }
.hero-sub strong { color: var(--orange); }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-visual { padding: 0 20px; }
.hero-stats { display: flex; flex-direction: column; gap: 16px; }
.hero-stat { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); border-radius: 16px; padding: 20px 28px; text-align: center; min-width: 120px; }
.stat-num { display: block; font-size: 2rem; font-weight: 900; color: var(--orange); }
.stat-label { font-size: 0.85rem; color: rgba(255,255,255,0.7); font-weight: 600; }

/* ─── How It Works ─────────────────────────────────────────────────────────── */
.how-it-works { background: var(--white); }
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.step { text-align: center; padding: 32px 24px; background: var(--gray-100); border-radius: var(--radius); }
.step-icon { font-size: 2.5rem; margin-bottom: 16px; }
.step h3 { color: var(--navy); margin-bottom: 10px; }
.step p { color: var(--gray-600); font-size: 0.95rem; }

/* ─── Budget ───────────────────────────────────────────────────────────────── */
.budget-section { background: var(--orange-light); }
.budget-visual { display: flex; align-items: center; justify-content: center; gap: 48px; flex-wrap: wrap; margin-bottom: 24px; }
.budget-ring svg { filter: drop-shadow(0 4px 12px rgba(0,0,0,0.1)); }
.budget-legend { display: flex; flex-direction: column; gap: 14px; }
.legend-item { display: flex; align-items: center; gap: 12px; font-size: 0.95rem; }
.legend-dot { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; }
.budget-note { text-align: center; color: var(--gray-600); font-size: 0.95rem; background: white; padding: 12px 20px; border-radius: 10px; display: inline-block; width: 100%; max-width: 600px; margin: 0 auto; display: block; }

/* ─── Featured / Section CTA ──────────────────────────────────────────────── */
.featured-children { background: var(--bg); }
.section-cta { text-align: center; margin-top: 40px; }
.preview-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* ─── Children Grid ────────────────────────────────────────────────────────── */
.gallery-controls { max-width: 1200px; margin: 0 auto; padding: 0 24px 20px; }
.search-input { width: 100%; padding: 12px 20px; border-radius: 50px; border: 2px solid var(--gray-200); font-size: 1rem; font-family: inherit; outline: none; transition: border-color 0.2s; }
.search-input:focus { border-color: var(--orange); }
.filter-pills { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.pill { padding: 6px 16px; border-radius: 50px; font-size: 0.85rem; font-weight: 600; background: var(--gray-100); color: var(--gray-600); border: 1.5px solid var(--gray-200); cursor: pointer; transition: all 0.2s; }
.pill:hover, .pill.active { background: var(--orange); color: white; border-color: var(--orange); }
.children-grid { max-width: 1200px; margin: 0 auto; padding: 0 24px 60px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; }
.empty-state { grid-column: 1/-1; text-align: center; padding: 60px; color: var(--gray-400); font-size: 1.1rem; }

/* ─── Child Card ───────────────────────────────────────────────────────────── */
.child-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; cursor: pointer; transition: all 0.22s; border: 2px solid transparent; }
.child-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: var(--orange); }
.child-card.card-full { opacity: 0.75; }
.child-card.card-full:hover { opacity: 1; }
.card-photo-wrap { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--gray-200); }
.card-photo { width: 100%; height: 100%; object-fit: cover; }
.status-badge { position: absolute; top: 10px; right: 10px; padding: 4px 10px; border-radius: 50px; font-size: 0.75rem; font-weight: 700; }
.status-badge.full { background: var(--navy); color: white; }
.status-badge.partial { background: var(--orange); color: white; }
.status-badge.open { background: var(--green); color: white; }
.card-body { padding: 16px; }
.card-name { font-size: 1.05rem; font-weight: 800; color: var(--navy); margin-bottom: 4px; }
.card-meta { font-size: 0.82rem; color: var(--gray-400); margin-bottom: 8px; }
.card-ambition { font-size: 0.88rem; color: var(--gray-600); margin-bottom: 12px; }
.card-footer { display: flex; align-items: center; justify-content: space-between; }
.progress-dots { display: flex; gap: 8px; }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--gray-200); transition: all 0.2s; }
.dot.filled { background: var(--orange); border-color: var(--orange); }
.dot.empty { background: white; }
.card-amount { font-size: 1.1rem; font-weight: 900; color: var(--orange); }
.card-amount span { font-size: 0.75rem; font-weight: 600; color: var(--gray-400); }

/* ─── Child Detail ─────────────────────────────────────────────────────────── */
.child-detail { max-width: 1100px; margin: 0 auto; padding: 32px 24px 60px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--gray-600); font-weight: 600; font-size: 0.9rem; margin-bottom: 24px; padding: 6px 14px; border-radius: 50px; background: var(--gray-100); transition: all 0.2s; }
.back-link:hover { color: var(--orange); background: var(--orange-light); }
.detail-layout { display: grid; grid-template-columns: 320px 1fr; gap: 40px; align-items: start; }
.detail-left { position: sticky; top: 80px; }
.detail-photo { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 20px; box-shadow: var(--shadow-hover); }
.detail-name-box { text-align: center; padding: 20px 0 16px; }
.detail-name-box h1 { font-size: 1.6rem; color: var(--navy); }
.detail-badge { display: inline-block; background: var(--orange-light); color: var(--orange-dark); padding: 6px 16px; border-radius: 50px; font-weight: 700; font-size: 0.9rem; margin-top: 8px; }
.detail-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.info-item { background: var(--gray-100); border-radius: 10px; padding: 10px 12px; }
.info-label { display: block; font-size: 0.75rem; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.5px; }
.info-val { display: block; font-size: 0.9rem; font-weight: 700; color: var(--navy); margin-top: 2px; }
.detail-section { margin-bottom: 32px; }
.detail-section h2 { color: var(--navy); margin-bottom: 14px; padding-bottom: 10px; border-bottom: 2px solid var(--gray-200); }
.detail-section h3 { color: var(--navy); margin-bottom: 10px; }
.story-text { color: var(--gray-600); line-height: 1.8; font-size: 0.97rem; }
.need-section { background: #fff4e0; border-left: 4px solid var(--orange); padding: 16px 20px; border-radius: 0 10px 10px 0; }
.need-section h3 { color: var(--orange-dark); }
.need-section p { color: #7a4e00; font-size: 0.93rem; }
.sponsor-intro { color: var(--gray-600); font-size: 0.93rem; margin-bottom: 20px; }
.sponsor-cards-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Sponsorship cards */
.sponsor-card { border-radius: 14px; padding: 20px; border: 2px solid var(--gray-200); background: var(--white); }
.sponsor-card.available { border-color: var(--orange); box-shadow: 0 4px 16px rgba(247,148,29,0.12); }
.sponsor-card.mine { border-color: var(--green); box-shadow: 0 4px 16px rgba(39,174,96,0.12); }
.sponsor-card.taken { border-color: var(--gray-200); background: var(--gray-100); opacity: 0.8; }
.scard-header { margin-bottom: 12px; }
.scard-badge { display: inline-block; padding: 4px 12px; border-radius: 50px; font-size: 0.78rem; font-weight: 700; }
.scard-badge.available { background: var(--orange-light); color: var(--orange-dark); }
.scard-badge.mine { background: #d4f5e3; color: #1a6b3a; }
.scard-badge.taken { background: var(--gray-200); color: var(--gray-600); }
.scard-amount { margin-bottom: 16px; }
.scard-amount .amount { font-size: 2rem; font-weight: 900; color: var(--navy); }
.scard-amount .freq { font-size: 0.85rem; color: var(--gray-400); font-weight: 600; }
.scard-breakdown { display: flex; flex-direction: column; gap: 8px; }
.sbreak { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; padding: 6px 10px; background: var(--gray-100); border-radius: 8px; }
.sbreak strong { color: var(--navy); }
.scard-taken-label { margin-top: 12px; font-size: 0.85rem; color: var(--gray-600); text-align: center; font-style: italic; }

/* ─── Dashboard ────────────────────────────────────────────────────────────── */
.dashboard { max-width: 900px; margin: 0 auto; padding: 40px 24px 60px; }
.dash-header { margin-bottom: 32px; }
.dash-welcome { display: flex; align-items: center; gap: 20px; background: var(--white); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.dash-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 3px solid var(--orange); }
.dash-welcome h1 { font-size: 1.6rem; color: var(--navy); margin-bottom: 4px; }
.dash-welcome p { color: var(--gray-600); }
.dash-section h2 { color: var(--navy); margin-bottom: 20px; }
.dash-sponsorships { display: flex; flex-direction: column; gap: 14px; margin-bottom: 32px; }
.dash-card { display: flex; align-items: center; gap: 16px; background: var(--white); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); cursor: pointer; transition: box-shadow 0.2s; }
.dash-card:hover { box-shadow: var(--shadow-hover); }
.dash-photo { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.dash-card-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.dash-card-info strong { color: var(--navy); font-size: 1rem; }
.dash-card-info span { font-size: 0.85rem; color: var(--gray-600); }
.dash-card-tag { display: inline-block; background: var(--orange-light); color: var(--orange-dark); padding: 2px 10px; border-radius: 50px; font-size: 0.78rem; font-weight: 700; width: fit-content; }
.dash-view-link { color: var(--orange); font-weight: 700; font-size: 0.9rem; }
.impact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.impact-item { background: var(--white); border-radius: 12px; padding: 20px; text-align: center; box-shadow: var(--shadow); }
.impact-val { display: block; font-size: 1.5rem; font-weight: 900; color: var(--orange); }
.impact-label { font-size: 0.85rem; color: var(--gray-600); margin-top: 4px; display: block; }
.dash-cta { text-align: center; margin-top: 32px; color: var(--gray-600); }
.empty-dashboard { text-align: center; padding: 60px 24px; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); }
.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-dashboard h3 { color: var(--navy); margin-bottom: 10px; }
.empty-dashboard p { color: var(--gray-600); margin-bottom: 20px; }
.auth-wall { max-width: 480px; margin: 80px auto; text-align: center; padding: 24px; }
.auth-wall-icon { font-size: 3rem; margin-bottom: 16px; }
.auth-wall h2 { color: var(--navy); margin-bottom: 12px; }
.auth-wall p { color: var(--gray-600); margin-bottom: 24px; }
.auth-note { margin-top: 16px; font-size: 0.88rem; color: var(--gray-600); }

/* ─── Modal ────────────────────────────────────────────────────────────────── */
#modal { display: none; }
#modal.open { display: block; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px); }
.modal-box { background: white; border-radius: 20px; padding: 32px; max-width: 440px; width: 100%; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,0.3); animation: modalIn 0.25s ease; }
@keyframes modalIn { from { transform: scale(0.9) translateY(20px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.modal-close { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border-radius: 50%; background: var(--gray-100); color: var(--gray-600); font-size: 1rem; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.modal-close:hover { background: var(--gray-200); }
.modal-icon { font-size: 2.5rem; text-align: center; margin-bottom: 12px; }
.modal-box h2 { text-align: center; color: var(--navy); margin-bottom: 6px; }
.modal-box > p { text-align: center; color: var(--gray-600); margin-bottom: 20px; font-size: 0.95rem; }
.modal-breakdown { background: var(--gray-100); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.mb-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 0.9rem; color: var(--gray-600); }
.mb-total { display: flex; justify-content: space-between; padding: 10px 0 0; border-top: 2px solid var(--gray-200); margin-top: 8px; font-size: 1.05rem; font-weight: 800; color: var(--navy); }
.modal-note { font-size: 0.82rem; color: var(--gray-400); text-align: center; margin-bottom: 16px; }
.modal-confirm { width: 100%; justify-content: center; margin-bottom: 10px; }
.modal-box .btn-ghost { width: 100%; justify-content: center; border-color: var(--gray-200); color: var(--gray-600); }

/* ─── Toasts ───────────────────────────────────────────────────────────────── */
#toasts { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { background: var(--navy); color: white; padding: 12px 20px; border-radius: 10px; font-weight: 600; font-size: 0.9rem; box-shadow: 0 4px 20px rgba(0,0,0,0.2); opacity: 0; transform: translateX(20px); transition: all 0.3s; max-width: 360px; }
.toast.visible { opacity: 1; transform: translateX(0); }
.toast.toast-success { background: var(--green); }
.toast.toast-error { background: var(--red); }
.toast.toast-info { background: var(--orange); }

/* ─── Footer ───────────────────────────────────────────────────────────────── */
footer { background: var(--navy); color: rgba(255,255,255,0.8); text-align: center; padding: 24px; font-size: 0.88rem; }
footer strong { color: var(--orange); }

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 60px 24px; }
  .hero-visual { display: none; }
  .steps-grid { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-left { position: static; }
  .detail-photo { max-height: 320px; }
  .sponsor-cards-row { grid-template-columns: 1fr; }
  .impact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  nav { padding: 0 16px; }
  .logo-text { display: none; }
  .nav-links .nav-link { padding: 6px 8px; font-size: 0.82rem; }
  .children-grid { padding: 0 16px 40px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
  .user-name { display: none; }
  .hero-actions { flex-direction: column; }
  .modal-box { padding: 24px 20px; }
}
