/* sessions.css — "tansinh ses-v1" (9 Oct 2026): the Sessions page (index.html).
   Loaded only by index.html, after style.css. Every class starts with ses-.
   One week grid is shared by every row on the page: seven day columns, Monday first,
   the same width everywhere, so a teacher's week and a student's days line up and can be
   read straight down a column. Today's column (or the day picked in the toolbar) is the
   one strong colour on the page.
   Colours follow the Schedule page (availability-grid.css): ink #1f2937, lines #e5e7eb,
   the blue of a normal lesson block, and the same avatar colours. */

:root {
  --ses-ink: #1f2937;
  --ses-muted: #6b7280;
  --ses-faint: #9ca3af;
  --ses-line: #e5e7eb;
  --ses-hair: #f0f2f5;
  --ses-soft: #f3f5f8;
  --ses-slot-bg: #eef3ff;
  --ses-slot-bd: #c7d7fe;
  --ses-slot-ink: #1e3a8a;
  --ses-focus: #2563eb;
  --ses-focus-tint: #f3f7ff;
  --ses-grid: minmax(0, 1fr) repeat(7, minmax(46px, 62px)) 84px;
}

/* ---------- page frame ---------- */
.ses-main.app-main { max-width: 1120px; padding: 6px 20px 56px; }

.ses-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 0 18px; }
.ses-title { margin: 0; font-size: 1.5rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.015em; color: var(--ses-ink); }
.ses-summary { margin: 6px 0 0; min-height: 1.3em; font-size: 0.875rem; color: var(--ses-muted); font-variant-numeric: tabular-nums; }

/* ---------- toolbar ---------- */
.ses-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 6px; }

.ses-search { position: relative; flex: 1 1 240px; max-width: 340px; margin: 0; }
.ses-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 0.8rem; color: var(--ses-faint); pointer-events: none; }
.ses-search input {
  width: 100%; height: 38px; padding: 0 12px 0 34px; border: 1px solid var(--ses-line); border-radius: 10px;
  background: #fff; color: var(--ses-ink); font: inherit; font-size: 0.875rem; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ses-search input::placeholder { color: var(--ses-faint); }
.ses-search input:focus { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15); }

.ses-days { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--ses-line); border-radius: 10px; background: #fff; }
.ses-days button {
  position: relative; height: 30px; min-width: 38px; padding: 0 10px; border: 0; border-radius: 7px;
  background: transparent; color: var(--ses-muted); font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer;
}
.ses-days button:hover { background: var(--ses-soft); color: var(--ses-ink); }
.ses-days button[aria-pressed="true"] { background: #1e293b; color: #fff; }
.ses-days button.is-today::after {
  content: ""; position: absolute; left: 50%; bottom: 3px; width: 4px; height: 4px; margin-left: -2px;
  border-radius: 50%; background: var(--ses-focus);
}
.ses-days button[aria-pressed="true"].is-today::after { background: #93c5fd; }

.ses-btn, .ses-ibtn {
  height: 38px; border: 1px solid var(--ses-line); border-radius: 10px; background: #fff; color: var(--ses-muted);
  font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.ses-btn { padding: 0 14px; margin-left: auto; }
.ses-ibtn { width: 38px; flex: none; }
.ses-btn:hover:not(:disabled), .ses-ibtn:hover { color: var(--ses-ink); border-color: #cbd5e1; background: #fafbfc; }
.ses-btn:disabled { opacity: 0.45; cursor: default; }
.ses-ibtn.is-busy i { animation: ses-spin 0.8s linear infinite; }

/* ---------- the shared week grid ---------- */
.ses-grid-head, .ses-th, .ses-row { display: grid; grid-template-columns: var(--ses-grid); column-gap: 4px; }

.ses-grid-head {
  position: sticky; top: 0; z-index: 5; padding: 12px 15px 8px; margin: 0;
  background: var(--page, #f6f7fb); color: var(--ses-faint);
  font-size: 0.72rem; font-weight: 700; text-align: center;
}
.ses-grid-head .ses-c.is-focus { color: var(--ses-focus); }
.ses-grid-head .ses-dot { display: block; width: 4px; height: 4px; margin: 3px auto 0; border-radius: 50%; background: var(--ses-focus); }

.ses-list { display: flex; flex-direction: column; gap: 12px; }

/* one teacher */
.ses-t { background: #fff; border: 1px solid var(--ses-line); border-radius: 14px; overflow: hidden; }
.ses-th { padding: 0 14px; background: #fafbfc; cursor: pointer; }
.ses-t:not(.is-shut) .ses-th { border-bottom: 1px solid var(--ses-line); }
.ses-filtering .ses-th { cursor: default; }
.ses-th > .ses-c { align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 11px 0; }

.ses-who { flex-direction: row !important; justify-content: flex-start !important; gap: 4px; min-width: 0; padding-right: 10px !important; }
.ses-fold {
  display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; padding: 0; margin: 0;
  border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: inherit;
}
.ses-fold > i { flex: none; width: 12px; font-size: 0.62rem; color: var(--ses-faint); transition: transform 0.15s; }
.ses-t.is-shut .ses-fold > i { transform: rotate(-90deg); }
.ses-av {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  color: #fff; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.3px;
}
.ses-tn { display: flex; flex-direction: column; min-width: 0; }
.ses-name { font-size: 0.95rem; font-weight: 600; line-height: 1.25; color: var(--ses-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ses-sub { font-size: 0.75rem; color: var(--ses-muted); }
.ses-cal {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  color: var(--ses-faint); text-decoration: none; font-size: 0.8rem; transition: background 0.15s, color 0.15s;
}
.ses-cal:hover { background: var(--ses-slot-bg); color: var(--ses-focus); }

.ses-cnt { font-size: 0.82rem; color: var(--ses-muted); font-variant-numeric: tabular-nums; }
.ses-cnt b { font-weight: 600; color: #374151; }
.ses-tot { align-items: flex-end !important; font-size: 0.78rem; font-weight: 600; color: var(--ses-muted); white-space: nowrap; }

/* one student */
.ses-row { padding: 0 14px; border-top: 1px solid var(--ses-hair); }
.ses-row:first-child { border-top: 0; }
.ses-row:hover { background: #fcfdff; }
.ses-row > .ses-c {
  align-self: stretch; min-width: 0; padding: 9px 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.ses-row > .ses-st { align-items: flex-start; padding-right: 12px; }
.ses-email { max-width: 100%; font-size: 0.875rem; color: var(--ses-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ses-domain { color: var(--ses-faint); }
.ses-other { display: flex; flex-wrap: wrap; gap: 4px; }
.ses-other span { padding: 1px 6px; border-radius: 6px; background: var(--ses-soft); color: var(--ses-muted); font-size: 0.7rem; }

.ses-time {
  display: block; min-width: 46px; padding: 3px 0; border: 1px solid var(--ses-slot-bd); border-radius: 7px;
  background: var(--ses-slot-bg); color: var(--ses-slot-ink);
  font-size: 0.75rem; font-weight: 600; line-height: 1.2; text-align: center; font-variant-numeric: tabular-nums;
}
.ses-off::after { content: ""; width: 4px; height: 4px; border-radius: 50%; background: #d9dee5; }
.ses-min { align-items: flex-end !important; font-size: 0.82rem; font-weight: 600; color: var(--ses-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ses-none { padding: 14px 18px; font-size: 0.85rem; color: var(--ses-faint); }

/* the day labels inside cells only show on a phone, where the grid header is gone */
.ses-dl { display: none; }

/* today's column, or the day picked: a light band down every card, and solid lessons */
.ses-c.is-focus { background: var(--ses-focus-tint); }
.ses-th > .ses-c.is-focus { background: #edf2fe; }
.ses-cnt.is-focus b { color: var(--ses-focus); font-weight: 700; }
.ses-c.is-focus .ses-time { background: var(--ses-focus); border-color: var(--ses-focus); color: #fff; }

/* a day is picked: the other days step back */
.ses-dayon .ses-c:not(.is-focus) .ses-time { opacity: 0.38; }
.ses-dayon .ses-cnt:not(.is-focus) b { opacity: 0.45; }

/* ---------- states ---------- */
.ses-state {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px;
  padding: 44px 16px; border: 1px dashed #d6dbe2; border-radius: 14px; background: #fff;
  color: var(--ses-muted); font-size: 0.9rem; text-align: center;
}
.ses-state.ses-err { color: #b91c1c; border-color: #fecaca; background: #fffafa; }
.ses-link { padding: 0; border: 0; background: none; color: var(--ses-focus); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.ses-spin { width: 16px; height: 16px; border: 2px solid #dbe2ea; border-top-color: var(--ses-focus); border-radius: 50%; animation: ses-spin 0.7s linear infinite; }
@keyframes ses-spin { to { transform: rotate(360deg); } }

/* keyboard focus */
.ses-fold:focus-visible, .ses-days button:focus-visible, .ses-btn:focus-visible,
.ses-ibtn:focus-visible, .ses-cal:focus-visible, .ses-link:focus-visible {
  outline: 2px solid #3b82f6; outline-offset: 2px; border-radius: 8px;
}

/* ---------- drawer mode: keep the title clear of the menu button ---------- */
@media (max-width: 1099px) {
  .ses-main.app-main { padding-top: 26px; }
}

/* ---------- narrower screens ---------- */
@media (max-width: 900px) {
  :root { --ses-grid: minmax(0, 1fr) repeat(7, minmax(42px, 52px)) 70px; }
  .ses-email { font-size: 0.82rem; }
}

/* ---------- phone: name on its own line, the week below it ---------- */
@media (max-width: 720px) {
  .ses-main.app-main { padding: 26px 12px 40px; }
  .ses-title { font-size: 1.3rem; }
  .ses-search { max-width: none; flex-basis: 100%; }
  .ses-days { max-width: 100%; overflow-x: auto; }
  .ses-btn { margin-left: 0; }
  .ses-grid-head { display: none; }
  .ses-th, .ses-row { grid-template-columns: repeat(7, minmax(0, 1fr)) auto; column-gap: 3px; padding: 0 10px; }
  .ses-th > .ses-who, .ses-row > .ses-st { grid-column: 1 / -1; }
  .ses-th > .ses-c { padding: 6px 0 9px; }
  .ses-th > .ses-who { padding: 10px 0 2px !important; }
  .ses-row > .ses-c { padding: 4px 0 9px; justify-content: flex-start; }
  .ses-th > .ses-cnt { justify-content: flex-start; }
  .ses-row > .ses-st { padding: 10px 0 2px; }
  .ses-tot, .ses-min { padding-left: 6px !important; justify-content: center !important; }
  .ses-dl { display: block; font-size: 0.6rem; font-weight: 700; color: var(--ses-faint); line-height: 1.2; }
  .ses-c.is-focus .ses-dl { color: var(--ses-focus); }
  .ses-off::after { display: none; }
  .ses-time { min-width: 0; width: 100%; font-size: 0.68rem; padding: 2px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ses-ibtn.is-busy i, .ses-spin { animation: none; }
  .ses-fold > i, .ses-search input, .ses-btn, .ses-ibtn, .ses-cal { transition: none; }
}
