/* ============================================================================
   Noori Preschool Juanda — Portal
   Palet hangat & ramah untuk preschool: krem, coral, sage green.
   ============================================================================ */

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

:root {
  --cream: #FFFBF4;
  --card: #FFFFFF;
  --ink: #35302B;
  --ink-soft: #6F675F;
  --coral: #FF8965;
  --coral-dark: #E8693F;
  --coral-tint: #FFE8DD;
  --sage: #5FA893;
  --sage-tint: #E2F1EC;
  --gold: #E8B44C;
  --gold-tint: #FBEED0;
  --danger: #E0574C;
  --danger-tint: #FBE3E0;
  --border: #EEE6DA;
  --shadow: 0 4px 18px rgba(53, 48, 43, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .brand {
  font-family: 'Poppins', 'Inter', sans-serif;
  font-weight: 600;
  margin: 0;
}

a { color: var(--coral-dark); text-decoration: none; }

/* ---------- Layout shells ---------- */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 20% 10%, var(--coral-tint), transparent 45%),
              radial-gradient(circle at 85% 90%, var(--sage-tint), transparent 40%),
              var(--cream);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 20px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sidebar-brand .logo-dot {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--coral);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-family: 'Poppins', sans-serif;
}

.sidebar-brand .role-tag {
  font-size: 11px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.nav-list { list-style: none; padding: 0; margin: 0; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 4px;
  transition: background .15s ease, color .15s ease;
}

.nav-item:hover { background: var(--coral-tint); color: var(--coral-dark); }
.nav-item.active { background: var(--coral); color: #fff; }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  font-size: 13px;
  color: var(--ink-soft);
}

.btn-logout {
  width: 100%;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}
.btn-logout:hover { background: var(--danger-tint); border-color: var(--danger); color: var(--danger); }

.main {
  flex: 1;
  padding: 28px 34px;
  max-width: 100%;
  overflow-x: hidden;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 12px;
}

.main-header h1 { font-size: 22px; }
.main-header .subtitle { color: var(--ink-soft); font-size: 13px; margin-top: 2px; }

.child-switcher {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.child-chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--ink-soft);
}
.child-chip.active { background: var(--sage); border-color: var(--sage); color: #fff; }

/* ---------- Cards / panels ---------- */

.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}

.panel-title {
  font-size: 15px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.stat-card .stat-label { font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; }
.stat-card .stat-value { font-size: 22px; font-family: 'Poppins', sans-serif; font-weight: 600; }
.stat-card.coral .stat-value { color: var(--coral-dark); }
.stat-card.sage .stat-value { color: var(--sage); }
.stat-card.gold .stat-value { color: var(--gold); }
.stat-card.danger .stat-value { color: var(--danger); }

/* ---------- Forms ---------- */

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--ink-soft);
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--coral);
}
.field textarea { resize: vertical; min-height: 70px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: opacity .15s ease;
}
.btn:hover { opacity: .9; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--coral); color: #fff; width: 100%; }
.btn-sage { background: var(--sage); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--ink); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-danger { background: var(--danger); color: #fff; }

.error-msg {
  background: var(--danger-tint);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
}
.success-msg {
  background: var(--sage-tint);
  color: #2F7A64;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
}

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.tab-btn {
  padding: 9px 14px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab-btn.active { color: var(--coral-dark); border-bottom: 2px solid var(--coral); }

/* ---------- Tables / lists ---------- */

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--ink-soft); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge-green { background: var(--sage-tint); color: #2F7A64; }
.badge-orange { background: var(--gold-tint); color: #A87710; }
.badge-red { background: var(--danger-tint); color: var(--danger); }
.badge-gray { background: #EFEBE4; color: var(--ink-soft); }

.empty-state {
  text-align: center;
  padding: 30px 10px;
  color: var(--ink-soft);
  font-size: 13.5px;
}

/* ---------- Gallery ---------- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.gallery-item {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--border);
  aspect-ratio: 1;
  position: relative;
}
.gallery-item img, .gallery-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-caption {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.6));
  color: #fff; font-size: 11px; padding: 14px 8px 6px;
}

/* ---------- Chat ---------- */

.chat-window {
  height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 4px;
  margin-bottom: 12px;
}
.chat-bubble {
  max-width: 72%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.4;
}
.chat-bubble.mine { align-self: flex-end; background: var(--coral); color: #fff; border-bottom-right-radius: 4px; }
.chat-bubble.theirs { align-self: flex-start; background: var(--sage-tint); color: var(--ink); border-bottom-left-radius: 4px; }
.chat-meta { font-size: 10.5px; opacity: .7; margin-top: 3px; }
.chat-input-row { display: flex; gap: 8px; }
.chat-input-row input { flex: 1; }

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(53,48,43,.4);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100;
}
.modal-box {
  background: #fff; border-radius: var(--radius);
  padding: 24px; width: 100%; max-width: 480px;
  max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--ink-soft); line-height: 1; }

/* ---------- Loading ---------- */

.loading-msg { text-align: center; padding: 40px; color: var(--ink-soft); font-size: 14px; }

/* ---------- Responsive ---------- */

@media (max-width: 780px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; overflow-x: auto; padding: 14px; }
  .sidebar-brand { display: none; }
  .nav-list { display: flex; flex: none; }
  .nav-item { white-space: nowrap; }
  .sidebar-footer { display: none; }
  .main { padding: 18px; }
  .field-row { flex-direction: column; gap: 0; }
}
