/*
 * Sprout design system — shared tokens + components for every public/*.html
 * page. Two platform-tuned palettes over one shared system: emerald/Public
 * Sans above the --mobile-bp breakpoint (tutor desktop tool), sage/Figtree
 * below it (booking/portal/on-the-go, mostly opened on a phone). Components
 * use CSS logical properties (margin-inline, text-align: start, etc.) so RTL
 * (dir="rtl") mirrors automatically without duplicate rules.
 */
@import url('https://fonts.googleapis.com/css2?family=Public+Sans:wght@400;500;600;700;800&family=Figtree:wght@400;500;600;700;800&display=swap');

:root {
  --mobile-bp: 768px;

  /* Web — Direction A (Public Sans / emerald) */
  --font: 'Public Sans', sans-serif;
  --emerald: #0E8A53;
  --deep-green: #0B6B41;
  --mint: #ECF7F1;
  --panel-tint: #F7FAF9;
  --ink: #16201B;
  --muted: #5B6B62;
  --faint: #8A988F;
  --border: #E5EAE7;
  --hairline: #EEF2F0;
  --chrome-bg: #F3F5F4;
  --avatar-bg: #D7EEE2;
  --avatar-ink: #0B6B41;
  --chip-border: #BFE0CD;
  --warn: #D9883C;
  --warn-bg: #FBF0E4;
  --dark-panel: #16201B;
  --dark-muted: #9DB0A8;
  --dark-muted-2: #8FB7A4;
  --radius-card: 13px;
  --radius-inner: 11px;
  --radius-btn: 10px;
  --radius-pill: 20px;
  --shadow-card: 0 14px 36px rgba(20, 45, 32, .12), 0 2px 6px rgba(0, 0, 0, .05);
  --primary: var(--emerald);
  --primary-deep: var(--deep-green);
  --surface: #fff;
  --bg: var(--panel-tint);
}

@media (max-width: 768px) {
  :root {
    /* Mobile — Direction C (Figtree / sage) */
    --font: 'Figtree', sans-serif;
    --emerald: #57A773;
    --deep-green: #3E8C5C;
    --mint: #EAF4EC;
    --panel-tint: #F0F3EC;
    --ink: #25302A;
    --muted: #6E7C71;
    --faint: #9AA69C;
    --border: #E6ECE1;
    --hairline: #EEF2EA;
    --warn: #C77A38;
    --warn-bg: #FBF6EF;
    --radius-card: 18px;
    --radius-inner: 14px;
    --radius-btn: 14px;
    --shadow-card: 0 16px 40px rgba(20, 45, 32, .16), 0 2px 6px rgba(0, 0, 0, .06);
    --primary: var(--emerald);
    --primary-deep: var(--deep-green);
    --bg: #FBFCF8;
  }
}

.hidden { display: none !important; }

/* .hide-mobile/.hide-desktop are only ever used on flex containers (.sidebar,
   .bottomtabs) — "flex" not "revert", since revert resets to the UA default
   (block) for a div and discards the component's own display:flex rule. */
.hide-mobile { display: flex !important; }
.hide-desktop { display: none !important; }
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .hide-desktop { display: flex !important; }
  body.sprout:has(.bottomtabs) { padding-bottom: 64px; }
}

* { box-sizing: border-box; }
html, body { background: var(--bg); }
body.sprout {
  font-family: var(--font);
  color: var(--ink);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}
body.sprout h1, body.sprout h2, body.sprout h3 {
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}
body.sprout :is(input, select, textarea, button) { font-family: var(--font); }

.sprout-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding-inline: 24px;
}
@media (max-width: 768px) {
  .sprout-shell { max-width: 480px; padding-inline: 16px; }
}

/* ---------- Logo ---------- */
.sprout-logo {
  width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); border-radius: 2px 72% 2px 72%; flex: none;
}
.sprout-logo svg { width: 16px; height: 16px; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font); font-weight: 600; font-size: 14px; cursor: pointer;
  border-radius: var(--radius-btn); padding: 10px 18px; min-height: 44px;
  border: 1px solid var(--border); background: #fff; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(14, 138, 83, 0.22); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-deep); border-color: var(--primary-deep); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--ink); }
.btn-outline { background: #fff; border-color: var(--border); color: var(--ink); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; min-height: 36px; font-size: 13px; }
.btn-danger-outline { background: #fff; border-color: var(--border); color: var(--warn); }

/* ---------- Inputs ---------- */
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 6px; }
.input, .select {
  width: 100%; height: 46px; border-radius: var(--radius-btn); border: 1.5px solid var(--border);
  background: #fff; color: var(--ink); font-size: 15px; padding-inline: 14px; font-family: var(--font);
}
.input:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14, 138, 83, 0.14); }

/* Segmented toggle (Phone / Email, EN / עב) */
.segmented {
  display: inline-flex; background: var(--chrome-bg, var(--panel-tint)); border-radius: var(--radius-btn);
  padding: 3px; gap: 2px;
}
.segmented button {
  font-family: var(--font); border: none; background: transparent; color: var(--muted); font-weight: 600;
  font-size: 13px; padding: 8px 16px; border-radius: calc(var(--radius-btn) - 2px); cursor: pointer;
}
.segmented button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); }

/* ---------- Cards ---------- */
.card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.panel-tint { background: var(--panel-tint); }

/* ---------- Pills / badges ---------- */
.pill {
  display: inline-flex; align-items: center; border-radius: var(--radius-pill); font-size: 12px;
  font-weight: 600; padding: 3px 10px; line-height: 1.6;
}
.pill-subject { background: var(--mint); color: var(--deep-green); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-success { background: var(--mint); color: var(--deep-green); }
.pill-paid { color: var(--deep-green); font-weight: 600; }
.pill-due { color: var(--warn); font-weight: 600; }
.dot-warn::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); margin-inline-end: 6px; }

/* ---------- Avatar ---------- */
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--avatar-bg); color: var(--avatar-ink);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none;
}

/* ---------- Sidebar (desktop tutor pages — Direction F "Studio Grid") ---------- */
.sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0; width: 210px; z-index: 20;
  background: #F4F8F6; border-inline-end: 1px solid #E2EBE6; padding: 20px 14px;
  display: flex; flex-direction: column; gap: 22px;
}
.sidebar-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; padding-inline: 8px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--muted);
  font-weight: 600; font-size: 14px; padding: 9px 10px; border-radius: var(--radius-inner);
}
.sidebar-nav a svg { width: 18px; height: 18px; stroke-width: 1.8; flex: none; }
.sidebar-nav a.active { background: #E2EFE8; color: #0B5234; }
.sidebar-footer { margin-block-start: auto; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-inner); cursor: pointer; }
.sidebar-footer:hover { background: #E2EFE8; }
.sidebar-footer-text .name { font-size: 13px; font-weight: 700; color: var(--ink); }
.sidebar-footer-text .role { font-size: 12px; color: var(--muted); }
.sidebar-menu { position: fixed; inset-inline-start: 14px; bottom: 76px; min-width: 160px; padding: 6px; z-index: 21; }

@media (min-width: 769px) {
  body.has-sidebar { padding-inline-start: 210px; }
}

/* ---------- Bottom tabs (mobile pages) ---------- */
.bottomtabs {
  position: fixed; bottom: 0; inset-inline: 0; display: flex; border-top: 1px solid var(--hairline);
  background: #fff; z-index: 30;
}
.bottomtabs button {
  flex: 1; background: none; border: none; display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding-block: 8px 10px; color: var(--faint); font-family: var(--font); font-size: 11px; font-weight: 600; cursor: pointer;
}
.bottomtabs button.active { color: var(--primary-deep); }
.bottomtabs svg { width: 20px; height: 20px; stroke-width: 1.8; }

/* ---------- Stat cards ---------- */
.stat-card { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px; }
.stat-card .label { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.stat-card .value { font-size: 30px; font-weight: 700; margin-block: 4px; }
.stat-card .sub { font-size: 13px; color: var(--muted); }

/* ---------- Tables ---------- */
.sprout-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sprout-table thead th {
  text-align: start; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); background: var(--panel-tint); padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.sprout-table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.sprout-table tbody tr:last-child td { border-bottom: none; }

/* ---------- Toggle switch ---------- */
.switch { position: relative; width: 40px; height: 24px; flex: none; }
.switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; }
.switch .track {
  position: absolute; inset: 0; background: #D7DDD9; border-radius: 999px; transition: background .15s;
}
.switch .thumb {
  position: absolute; inset-block-start: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: inset-inline-start .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked ~ .thumb { inset-inline-start: 19px; }

/* ---------- Tabular numbers for times/currency ---------- */
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Modal ---------- */
.add-modal { position: fixed; inset: 0; background: rgba(20,32,27,.4); display: flex; align-items: center; justify-content: center; z-index: 30; }
.add-modal.hidden { display: none; }
.add-modal .card { width: 420px; max-height: 86vh; overflow-y: auto; padding: 20px; }
.add-modal h2 { font-size: 18px; margin-block-end: 12px; }

/* ---------- Shared add/edit student fields ---------- */
.student-fields { display: flex; flex-direction: column; gap: 6px; }
.field-section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-block: 10px 2px; }
.field-section-label:first-child { margin-block-start: 0; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field-grid input:only-child { grid-column: 1 / -1; }
@media (max-width: 480px) { .field-grid { grid-template-columns: 1fr; } }

/* ---------- Empty / skeleton states ---------- */
.empty-state { text-align: center; padding: 48px 16px; color: var(--muted); }
.skeleton { background: linear-gradient(90deg, var(--hairline) 25%, var(--border) 37%, var(--hairline) 63%); background-size: 400% 100%; animation: sprout-shimmer 1.4s ease infinite; border-radius: var(--radius-inner); }
@keyframes sprout-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Warning banner ---------- */
.warn-banner {
  display: flex; align-items: flex-start; gap: 8px; background: var(--warn-bg); color: var(--warn);
  border-radius: var(--radius-inner); padding: 10px 12px; font-size: 13px; font-weight: 600;
}

/* ---------- Dark summary panel (booking confirm) ---------- */
.dark-panel { background: var(--dark-panel); color: #fff; border-radius: var(--radius-card); padding: 20px; }
.dark-panel .label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--dark-muted); }
.dark-panel .row { margin-block-end: 14px; }
.dark-panel .row .value { font-weight: 700; margin-block-start: 2px; }
.dark-panel .note { color: var(--dark-muted-2); font-size: 12px; margin-block-start: 12px; text-align: center; }
.dark-panel .btn-primary { background: #fff; color: var(--dark-panel); border-color: #fff; }
.dark-panel .btn-primary:hover { background: #EDF4F0; }
