/* ============================================================
   NUTREATSY - Stylesheet Utama
   Tema: lembut, hangat, ramah orang tua
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,500&family=Nunito:wght@400;500;600;700;800&display=swap');

:root {
  /* Palet warna — brand biru Nutreatsy */
  --mint: #0e97cf;          /* biru utama (brand) */
  --mint-dark: #0077ad;     /* biru tua: hover, judul, link */
  --mint-light: #cbeaf7;    /* biru sangat muda: pill, highlight */
  --mint-bg: #eef7fc;       /* tint latar lembut */
  --yellow: #f3b13a;        /* amber: status perlu dipantau */
  --yellow-soft: #fdf1d6;
  --blue: #4cc1e3;          /* biru muda (aksen anak) */
  --blue-soft: #ddf3fa;
  --orange: #2fb6d0;        /* teal-cyan: variasi kartu */
  --orange-soft: #d6f2f8;
  --lime: #cfe89a;          /* aksen hijau-limau dari logo */
  --lime-soft: #eef7d6;
  --cream: #f4f9fc;         /* off-white sejuk */
  --ink: #14323f;           /* biru-arang gelap */
  --ink-soft: #44616e;
  --muted: #7b94a0;
  --line: #e1ecf2;
  --white: #ffffff;
  --danger: #e57373;
  --danger-bg: #fdeaea;

  --green: #16a34a;
  --warn: #d97706;
  --red: #dc2626;

  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --shadow-sm: 0 2px 8px rgba(14, 151, 207, 0.10);
  --shadow: 0 8px 24px rgba(14, 151, 207, 0.14);
  --shadow-lg: 0 16px 44px rgba(20, 50, 63, 0.16);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;

  --sidebar-w: 248px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 100% -10%, var(--mint-bg) 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, var(--blue-soft) 0%, transparent 55%),
    var(--cream);
  background-attachment: fixed;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; color: var(--ink); }
a { color: var(--mint-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============== LAYOUT AUTH ============== */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  border: 1px solid var(--line);
}
.auth-logo { text-align: center; margin-bottom: 8px; }
.auth-logo img { height: 56px; }
.auth-title { text-align: center; font-size: 1.6rem; margin: 8px 0 4px; }
.auth-sub { text-align: center; color: var(--muted); margin-bottom: 26px; font-size: 0.95rem; }
.auth-footer { text-align: center; margin-top: 20px; color: var(--ink-soft); font-size: 0.92rem; }

/* ============== APP SHELL ============== */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--white) 0%, var(--mint-bg) 100%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  overflow-y: auto;
}
.sidebar-logo { padding: 20px 22px 14px; }
.sidebar-logo img { height: 38px; }
.sidebar-nav { padding: 6px 12px 24px; flex: 1; }
.nav-group-label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); padding: 14px 12px 6px; font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--ink-soft); font-weight: 600; font-size: 0.92rem;
  margin-bottom: 2px; transition: all 0.15s; text-decoration: none;
}
.nav-item:hover { background: var(--mint-light); color: var(--ink); text-decoration: none; }
.nav-item.active { background: var(--mint); color: #fff; box-shadow: var(--shadow-sm); }
.nav-item .ico { width: 20px; text-align: center; font-size: 1.05rem; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 16px 28px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.topbar h1 { font-size: 1.35rem; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.child-switch {
  display: flex; align-items: center; gap: 8px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 6px 4px 14px;
}
.child-switch select {
  border: none; background: transparent; font-family: var(--font-body);
  font-weight: 700; color: var(--ink); font-size: 0.92rem; cursor: pointer;
  padding-right: 4px;
}
.child-switch select:focus { outline: none; }

.avatar-circle {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--mint); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-family: var(--font-display); overflow: hidden;
}
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }

.content { padding: 26px 28px 60px; max-width: 1180px; }

/* ============== CARDS ============== */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 18px; }
.card-title { font-size: 1.12rem; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.card-sub { color: var(--muted); font-size: 0.88rem; margin-bottom: 16px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* Stat cards */
.stat {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.stat::after {
  content: ''; position: absolute; right: -20px; top: -20px;
  width: 80px; height: 80px; border-radius: 50%; opacity: 0.5;
}
.stat.mint::after { background: var(--mint-light); }
.stat.blue::after { background: var(--blue-soft); }
.stat.yellow::after { background: var(--yellow-soft); }
.stat.orange::after { background: var(--orange-soft); }
.stat-ico { font-size: 1.5rem; margin-bottom: 6px; position: relative; }
.stat-value { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; position: relative; }
.stat-label { color: var(--muted); font-size: 0.85rem; position: relative; }

/* ============== BADGES ============== */
.badge {
  display: inline-block; padding: 3px 11px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700; line-height: 1.5;
}
.badge-green { background: #dcfce7; color: #15803d; }
.badge-yellow { background: #fef3c7; color: #b45309; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-gray { background: #eef2f0; color: #64748b; }
.badge-blue { background: var(--blue-soft); color: #0369a1; }

/* ============== BUTTONS ============== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-weight: 700; font-size: 0.95rem;
  padding: 11px 20px; border-radius: 999px; border: none; cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s; text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--mint); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--mint-dark); }
.btn-outline { background: var(--white); color: var(--ink); border: 1.5px solid var(--line); }
.btn-outline:hover { border-color: var(--mint); color: var(--mint-dark); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--mint-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #d05f5f; }
.btn-sm { padding: 7px 14px; font-size: 0.85rem; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 9px; border-radius: 50%; width: 38px; height: 38px; }

/* ============== FORMS ============== */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }
label { display: block; font-weight: 700; font-size: 0.88rem; margin-bottom: 6px; color: var(--ink-soft); }
.req { color: var(--danger); }
input, select, textarea {
  width: 100%; font-family: var(--font-body); font-size: 0.95rem;
  padding: 11px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--white); color: var(--ink); transition: border 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--mint);
  box-shadow: 0 0 0 3px var(--mint-light);
}
textarea { resize: vertical; min-height: 80px; }
.hint { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

/* ============== TABLES ============== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; background: var(--white); }
th, td { padding: 12px 14px; text-align: left; font-size: 0.9rem; }
th { background: var(--mint-bg); color: var(--ink-soft); font-weight: 700; font-size: 0.82rem;
     text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
tbody tr { border-top: 1px solid var(--line); }
tbody tr:hover { background: var(--mint-bg); }
.table-actions { display: flex; gap: 6px; }

/* ============== FLASH ============== */
.flash { padding: 13px 18px; border-radius: var(--radius-sm); margin-bottom: 18px; font-weight: 600; font-size: 0.92rem; }
.flash-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.flash-error { background: var(--danger-bg); color: #b91c1c; border: 1px solid #fecaca; }
.flash-info { background: var(--blue-soft); color: #0369a1; border: 1px solid #bae6fd; }

/* ============== EMPTY STATE ============== */
.empty {
  text-align: center; padding: 48px 24px; color: var(--muted);
}
.empty .emoji { font-size: 3rem; display: block; margin-bottom: 12px; }

/* ============== DISCLAIMER ============== */
.disclaimer {
  background: var(--yellow-soft); border: 1px solid #f6dfae;
  border-radius: var(--radius-sm); padding: 14px 18px; font-size: 0.85rem;
  color: #92651a; margin-top: 24px; display: flex; gap: 10px;
}
.disclaimer .ico { font-size: 1.2rem; }

/* ============== CHILD HEADER ============== */
.child-hero {
  display: flex; align-items: center; gap: 18px;
  background: linear-gradient(120deg, var(--mint-light), var(--blue-soft));
  border-radius: var(--radius); padding: 20px 24px; margin-bottom: 22px;
  border: 1px solid var(--line);
}
.child-hero .photo {
  width: 72px; height: 72px; border-radius: 22px; overflow: hidden;
  background: var(--mint); display: grid; place-items: center; color: #fff;
  font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; flex-shrink: 0;
}
.child-hero .photo img { width: 100%; height: 100%; object-fit: cover; }
.child-hero h2 { font-size: 1.5rem; }
.child-hero .meta { color: var(--ink-soft); font-size: 0.92rem; margin-top: 2px; }

/* ============== SECTION TABS ============== */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.tab {
  padding: 8px 16px; border-radius: 999px; background: var(--white);
  border: 1.5px solid var(--line); font-weight: 700; font-size: 0.88rem;
  color: var(--ink-soft); cursor: pointer; text-decoration: none;
}
.tab:hover { border-color: var(--mint); text-decoration: none; }
.tab.active { background: var(--mint); color: #fff; border-color: var(--mint); }

/* ============== PAGE HEADER ============== */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-head h2 { font-size: 1.5rem; }
.page-head .sub { color: var(--muted); font-size: 0.92rem; }

/* ============== LIST ITEMS ============== */
.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: none; }
.list-item .li-ico {
  width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 1.2rem; background: var(--mint-light);
}
.list-item .li-body { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 700; font-size: 0.95rem; }
.list-item .li-sub { color: var(--muted); font-size: 0.85rem; }

/* ============== MODAL ============== */
.modal-bg {
  display: none; position: fixed; inset: 0; background: rgba(47,62,52,0.45);
  z-index: 100; place-items: center; padding: 20px;
}
.modal-bg.open { display: grid; }
.modal {
  background: var(--white); border-radius: var(--radius-lg); padding: 28px;
  width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { font-size: 1.25rem; }
.modal-close { background: var(--mint-bg); border: none; width: 34px; height: 34px;
  border-radius: 50%; cursor: pointer; font-size: 1.1rem; color: var(--ink-soft); }

/* ============== MILESTONE / CHECK ============== */
.check-row {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px;
  transition: background 0.15s;
}
.check-row.done { background: var(--mint-bg); border-color: var(--mint-light); }
.check-row input[type=checkbox] { width: auto; margin-top: 3px; accent-color: var(--mint); transform: scale(1.3); }
.check-row .ci-body { flex: 1; }
.check-row .ci-title { font-weight: 700; font-size: 0.94rem; }
.check-row .ci-desc { color: var(--muted); font-size: 0.84rem; }

/* ============== PROGRESS ============== */
.progress { height: 10px; background: var(--mint-bg); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--mint); border-radius: 999px; }

/* ============== RECIPE CARD ============== */
.recipe-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); transition: transform 0.15s, box-shadow 0.15s; }
.recipe-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.recipe-card .thumb { height: 120px; background: linear-gradient(135deg, var(--mint-light), var(--yellow-soft));
  display: grid; place-items: center; font-size: 2.4rem; }
.recipe-card .rc-body { padding: 14px 16px; }
.recipe-card .rc-title { font-weight: 700; font-size: 1rem; font-family: var(--font-display); }
.recipe-card .rc-meta { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }

/* ============== UTIL ============== */
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 0.85rem; }
.text-center { text-align: center; }
.fw-bold { font-weight: 800; }
.gap-sm { gap: 6px; }
.wrap { flex-wrap: wrap; }
.hidden { display: none; }
.w-100 { width: 100%; }
.nowrap { white-space: nowrap; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============== MOBILE ============== */
.menu-toggle { display: none; background: var(--white); border: 1px solid var(--line);
  width: 40px; height: 40px; border-radius: 12px; cursor: pointer; font-size: 1.2rem; }
.sidebar-overlay { display: none; }

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
  .sidebar-overlay.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 45; }
  .content { padding: 18px 16px 50px; }
  .topbar { padding: 12px 16px; }
}

/* ============== CHART ============== */
.chart-box { position: relative; height: 360px; }
.legend-dots { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 0.82rem; color: var(--ink-soft); }
.legend-dots span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dots i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* Footer */
.app-footer { text-align: center; color: var(--muted); font-size: 0.82rem; padding: 24px; }

/* ============================================================
   EDITOR TEKS (rich text) — admin
   ============================================================ */
.rt-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.rt-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: 6px 8px; background: var(--mint-bg); border-bottom: 1px solid var(--line);
}
.rt-btn {
  border: 1px solid transparent; background: transparent; cursor: pointer;
  min-width: 32px; height: 30px; padding: 0 8px; border-radius: 7px;
  font-size: .92rem; color: var(--ink); line-height: 1; transition: background .15s, border-color .15s;
}
.rt-btn:hover { background: #fff; border-color: var(--line); }
.rt-btn:active { background: var(--mint-light); }
.rt-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.rt-editor {
  min-height: 180px; max-height: 460px; overflow-y: auto;
  padding: 14px 16px; font-family: var(--font-body); font-size: 1rem;
  line-height: 1.7; color: var(--ink); outline: none;
}
.rt-editor.is-empty:before {
  content: attr(data-placeholder); color: var(--muted); pointer-events: none;
}
.rt-editor:focus { box-shadow: inset 0 0 0 2px var(--mint-light); }
/* tampilan isi editor mendekati hasil akhir */
.rt-editor p { margin: 0 0 12px; }
.rt-editor h2 { font-family: var(--font-display); font-size: 1.45rem; margin: 18px 0 8px; font-weight: 700; }
.rt-editor h3 { font-family: var(--font-display); font-size: 1.2rem; margin: 16px 0 6px; font-weight: 600; }
.rt-editor ul, .rt-editor ol { margin: 0 0 12px; padding-left: 24px; }
.rt-editor li { margin-bottom: 5px; }
.rt-editor a { color: var(--mint-dark); text-decoration: underline; }
.rt-editor blockquote {
  margin: 12px 0; padding: 8px 16px; background: var(--mint-bg);
  border-left: 4px solid var(--mint); border-radius: 0 10px 10px 0; color: var(--ink-soft);
}
.rt-editor img { max-width: 100%; border-radius: 10px; }
