/* ==========================================================================
   Students Scheduler — Component styles (plain CSS, class-based)
   Reference implementation of the recurring UI pieces, using tokens.css.
   This is what production CSS should look like — the inline styles in the
   prototype HTML are a live-preview artifact, NOT meant to be copied.
   Import order:  @import "./tokens.css";  @import "./components.css";
   ========================================================================== */

/* ---- Base ---------------------------------------------------------------- */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: #E2ECE9;
  -webkit-font-smoothing: antialiased;
}
.tnum { font-variant-numeric: tabular-nums; } /* times, money, dates */

/* ---- App shell ----------------------------------------------------------- */
.app {
  display: flex;
  width: min(var(--app-max), calc(100% - 40px));
  min-height: 880px;
  margin: 32px auto;
  background: var(--teal-bg);
  border-radius: var(--radius-3xl);
  box-shadow: 0 24px 70px rgba(31,45,43,.14);
  overflow: hidden;
}
.main { flex: 1; min-width: 0; }
.screen { padding: var(--space-8) var(--space-9); }
.screen--narrow { max-width: 620px; }

/* ---- Side rail ----------------------------------------------------------- */
.rail {
  width: var(--rail-width);
  flex: none;
  background: var(--surface);
  border-right: 1px solid #E6EFEC;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-6) 0;
  gap: 10px;
}
.rail__brand {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  background: var(--teal-600);
  display: grid; place-items: center;
  margin-bottom: var(--space-4);
}
.rail__item {
  width: 48px; height: 48px;
  border-radius: 15px;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--rail-icon-off);            /* icon stroke uses currentColor */
}
.rail__item.is-active {
  background: var(--teal-600);
  color: #fff;
}
.rail__spacer { flex: 1; }
.rail__avatar {
  width: 44px; height: 44px;
  border-radius: var(--radius-pill);
  background: var(--teal-600);
  color: #fff; font-weight: var(--weight-bold);
  display: grid; place-items: center;
  cursor: pointer;
}

/* ---- Typography helpers -------------------------------------------------- */
.screen-title { font-size: var(--text-3xl); font-weight: var(--weight-extrabold);
  letter-spacing: var(--tracking-tight); color: var(--ink); margin: 0; }
.card-title   { font-size: var(--text-2xl); font-weight: var(--weight-extrabold); color: var(--ink); }
.eyebrow      { font-size: var(--text-sm); font-weight: var(--weight-bold);
  color: var(--grey-500); text-transform: uppercase; letter-spacing: var(--tracking-label); }
.field-label  { font-size: var(--text-sm); font-weight: var(--weight-bold);
  color: var(--grey-500); margin-bottom: var(--space-2); display: block; }
.back-link    { display: inline-flex; align-items: center; gap: 7px;
  color: var(--teal-600); font-size: var(--text-base); font-weight: var(--weight-bold);
  cursor: pointer; margin-bottom: var(--space-4); }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--font); font-size: var(--text-md); font-weight: var(--weight-bold);
  border: none; cursor: pointer; border-radius: var(--radius-lg);
  padding: 14px 20px; line-height: 1;
}
.btn--primary { background: var(--teal-600); color: #fff; box-shadow: var(--shadow-btn); }
.btn--primary:hover { background: var(--teal-700); }
.btn--compact { padding: 11px 18px; box-shadow: var(--shadow-btn-sm); }
.btn--secondary { background: var(--surface); color: var(--teal-600);
  border: 1px solid var(--field-border); box-shadow: none; }
.btn--destructive { background: var(--danger); color: #fff;
  box-shadow: 0 10px 22px rgba(194,105,122,.30); }
.btn--ghost { background: var(--teal-bg); color: var(--teal-600); box-shadow: none;
  width: 100%; }
.btn--block { width: 100%; }

/* segmented control (duration 30/45/60) */
.seg { display: flex; gap: 10px; }
.seg__opt { flex: 1; text-align: center; padding: 14px 0; border-radius: var(--radius-lg);
  background: var(--field-bg); border: 1px solid var(--field-border);
  color: var(--grey-600); font-size: var(--text-lg); font-weight: var(--weight-bold); cursor: pointer; }
.seg__opt.is-selected { background: var(--teal-600); color: #fff; border-color: transparent; }

/* ---- Form fields --------------------------------------------------------- */
.field {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  color: var(--ink);
  font-size: var(--text-md);
  font-family: var(--font);
}
.field::placeholder, .field.is-placeholder { color: var(--grey-400); }
.field:focus { outline: none; border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(47,126,118,.12); }
.field--select { display: flex; align-items: center; justify-content: space-between; font-weight: var(--weight-semibold); }
.callout { display: flex; gap: 10px; background: var(--info-bg); border-radius: var(--radius-md);
  padding: 11px 14px; color: var(--info-text); font-size: var(--text-sm); line-height: 1.5; }

/* ---- Cards & panels ------------------------------------------------------ */
.card  { background: var(--surface); border-radius: var(--radius-3xl);
  padding: var(--space-6); box-shadow: var(--shadow-card); }
.panel { background: var(--surface); border-radius: var(--radius-2xl);
  overflow: hidden; box-shadow: var(--shadow-row); }

/* ---- Data list / table --------------------------------------------------- */
.list__head, .list__row { display: grid; align-items: center; padding: 14px 22px; }
.list__head { font-size: var(--text-xs); font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-label); color: var(--grey-500);
  text-transform: uppercase; border-bottom: 1px solid var(--line-200); }
.list__row { border-bottom: 1px solid var(--line); cursor: pointer; }  /* whole row navigates */
.list__row:hover { background: #FAFCFB; }
.list__name { font-size: var(--text-md); font-weight: var(--weight-bold); color: var(--ink); }
.list__meta { font-size: var(--text-sm); color: var(--grey-500); margin-top: 2px; }
.avatar-chip { width: 38px; height: 38px; border-radius: var(--radius-md); flex: none;
  background: var(--teal-tint); color: var(--teal-600);
  display: grid; place-items: center; font-weight: var(--weight-bold); }
/* inner row buttons must call stopPropagation so they don't trigger the row */
.row-action { display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 11px; cursor: pointer; }

/* badges / pills */
.badge { font-size: var(--text-xs); font-weight: var(--weight-bold);
  padding: 4px 11px; border-radius: var(--radius-pill); }
.badge--success { color: var(--success); background: var(--success-bg); }
.badge--danger  { color: var(--danger);  background: var(--danger-bg); }
.badge--info    { color: var(--info-text); background: #EEF1F7; }
.badge--muted   { color: var(--grey-500); background: #F0F4F2; }
.amount-pos { color: var(--success); font-weight: var(--weight-bold); }
.amount-neg { color: var(--danger);  font-weight: var(--weight-bold); }

/* ---- Tabs (student detail) ---------------------------------------------- */
.tabs { display: inline-flex; gap: 6px; background: var(--surface);
  border-radius: var(--radius-lg); padding: 5px; box-shadow: var(--shadow-row); }
.tab { padding: 9px 22px; border-radius: var(--radius-md);
  font-size: var(--text-md); font-weight: var(--weight-bold); color: var(--grey-600); cursor: pointer; }
.tab.is-active { background: var(--teal-600); color: #fff; }

/* ---- Lesson chip (week / day / agenda) ----------------------------------
   Apply a hue via a modifier that sets --chip-bg / --chip-accent, e.g.
   .lesson--mint { --chip-bg: var(--lesson-mint-bg); --chip-accent: var(--lesson-mint-accent); } */
.lesson {
  display: flex; align-items: center; gap: 11px;
  background: var(--chip-bg, var(--lesson-teal-bg));
  border-radius: var(--radius-xl);
  padding: 11px 13px; margin-bottom: var(--space-2);
  cursor: pointer;                       /* whole chip opens booking edit */
}
.lesson__start { font-size: var(--text-base); font-weight: var(--weight-bold);
  color: var(--chip-accent, var(--teal-600)); }
.lesson__end   { font-size: var(--text-xs); color: var(--ink); opacity: .45; }
.lesson__name  { flex: 1; font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--ink); }
/* free-time gap label between lessons */
.gap-label { text-align: center; padding: 3px 0 9px; }
.gap-label span { font-size: var(--text-xs); font-weight: var(--weight-semibold);
  color: var(--grey-500); background: var(--teal-bg);
  padding: 3px 10px; border-radius: var(--radius-pill); }

/* ---- Colour swatch picker ----------------------------------------------- */
.swatches { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 10px; }
.swatch { width: 32px; height: 32px; border-radius: 10px; cursor: pointer; }
.swatch.is-selected { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--teal-600); }

/* ---- Modal --------------------------------------------------------------- */
.modal-overlay { position: fixed; inset: 0; z-index: 50;
  background: rgba(20,32,30,.45); display: grid; place-items: center; padding: 24px; }
.modal { background: var(--surface); border-radius: var(--radius-3xl);
  padding: 28px; width: 400px; max-width: 100%; box-shadow: var(--shadow-modal); }
.modal__icon { width: 48px; height: 48px; border-radius: 15px; background: var(--danger-bg);
  display: grid; place-items: center; margin-bottom: var(--space-4); }
.modal__title { font-size: var(--text-2xl); font-weight: var(--weight-extrabold); color: var(--ink); margin-bottom: var(--space-2); }
.modal__body { font-size: var(--text-md); color: var(--grey-600); line-height: 1.5; margin-bottom: var(--space-6); }
.modal__actions { display: flex; gap: 12px; }
.modal__actions .btn { flex: 1; padding: 13px 0; }

/* ---- "Up next" hero (dashboard) ----------------------------------------- */
.hero {
  background: linear-gradient(135deg, var(--teal-600), var(--teal-500));
  border-radius: var(--radius-3xl); padding: 26px 28px; color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow-hero);
}
.hero__eyebrow { font-size: var(--text-xs); font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-eyebrow); color: #CDEBE5; }
.hero__name { font-size: var(--text-6xl); font-weight: var(--weight-extrabold); margin-top: 8px; }

/* ---- Parent portal (warm theme override) --------------------------------
   Wrap the parent screens in .parent and these tokens recolour the surface. */
.parent { background: var(--parent-bg); color: var(--parent-ink); }
.parent .hero { background: linear-gradient(135deg, var(--parent-accent), var(--parent-accent-2));
  box-shadow: 0 14px 30px rgba(224,133,60,.26); }
.parent .card { box-shadow: 0 2px 16px rgba(58,46,34,.05); }
