/* ═══════════════════════════════════════════════════════════════
   shared.css — MTM Entrance Viva
   Single source of truth for all design tokens, layout primitives,
   and reusable components. Imported by every page.
═══════════════════════════════════════════════════════════════ */

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design tokens ───────────────────────────────────────────── */
:root {
  /* Colours */
  --bg:        #f5f7fa;
  --surface:   #ffffff;
  --border:    #d8e2ef;
  --text:      #1a2332;
  --muted:     #5e6e8a;
  --accent:    #005EB8;
  --accent2:   #0072ce;
  --green:     #00A499;
  --red:       #d4351c;
  --yellow:    #f59e0b;
  --blue:      #0072ce;

  /* Gradients */
  --gradient-brand: linear-gradient(135deg, #003087 0%, #005EB8 100%);

  /* Type scale — edit here to resize everything uniformly */
  --text-xs:   0.72rem;   /* tiny labels, chips, badges     */
  --text-sm:   0.90rem;   /* secondary text, meta           */
  --text-base: 1rem;      /* body copy                      */
  --text-md:   1.1rem;    /* sub-headings                   */
  --text-lg:   1.35rem;   /* section headings               */
  --text-xl:   1.5rem;    /* page / card titles             */

  /* Layout */
  --header-h:   56px;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
}

/* Viewport-responsive root: 14 px on small screens → 18 px on wide */
html { font-size: clamp(14px, 1.0vw, 18px); }

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
  overflow-y: auto;
  padding-top: var(--header-h);
}

/* ═══════════════════════════════════════════════════════════════
   APP HEADER  — fixed, appears on every page
═══════════════════════════════════════════════════════════════ */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 500;
  display: flex;
  align-items: center;
}

.header-inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
}

/* Left: logo + brand */
.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.logo-mark {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: var(--gradient-brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 800; color: #fff;
  letter-spacing: -.02em;
  flex-shrink: 0;
}

.header-brand {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}

.header-brand-sub {
  display: none;
  font-size: var(--text-xs);
  color: var(--muted);
  margin-left: 6px;
  padding-left: 6px;
  border-left: 1px solid var(--border);
}

/* Nav tabs */
.header-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 24px;
  flex: 1;
}

.nav-tab {
  background: none;
  border: none;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color .15s, background .15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.nav-tab:hover  { color: var(--text); background: var(--bg); }
.nav-tab.active { color: var(--accent); background: rgba(0,94,184,.08); font-weight: 600; }

/* Right: breadcrumb + student pill */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.header-crumb { font-size: var(--text-sm); color: var(--muted); }
.header-crumb .crumb-sep { margin: 0 4px; opacity: .45; }
.header-crumb .crumb-cur { color: var(--text); font-weight: 500; }

.header-student-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px 4px 4px;
}

.student-pill-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--gradient-brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.student-pill-name {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text);
}

/* ═══════════════════════════════════════════════════════════════
   LAYOUT PRIMITIVES
═══════════════════════════════════════════════════════════════ */

/* Standard content column */
.page-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 36px 20px;
  width: 100%;
}

/* Narrow column for forms / feedback */
.page-content-narrow {
  max-width: 50%;
  margin: 0 auto;
  padding: 36px 20px;
  width: 100%;
}

/* Full-height centred layout for entry / briefing screens */
.page-centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-h));
  padding: 20px;
}

/* Single-page screen switcher */
.screen { display: none; }
.screen.active { display: block; }

.screen-centered { display: none; }
.screen-centered.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-h));
  padding: 20px;
}

/* ═══════════════════════════════════════════════════════════════
   CARD
═══════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
}

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: var(--text-base);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform .1s, opacity .15s;
  letter-spacing: .02em;
  text-decoration: none;
}

.btn:hover  { opacity: .88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--accent);  color: #fff; }
.btn-ghost   { background: var(--border);  color: var(--text); }

/* White button — used on dark/gradient backgrounds */
.btn-white { background: #fff; color: var(--accent); }
.btn-white:hover { background: #f0f4f8; opacity: 1; }

/* Muted bordered button — e.g. "I don't know — skip" */
.btn-warn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: var(--text-sm);
  padding: 8px 16px;
}
.btn-warn:hover { border-color: var(--red); color: var(--red); }

/* Inline back link — no chrome, just text */
.btn-back {
  background: none;
  border: none;
  color: var(--muted);
  font-size: var(--text-sm);
  font-family: inherit;
  cursor: pointer;
  padding: 0 0 18px;
  display: inline-block;
  transition: color .15s;
  text-decoration: none;
}
.btn-back:hover { color: var(--text); }

/* Red end-call button */
.btn-end-call {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 8px 20px;
  font-size: var(--text-sm);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background .15s, transform .1s;
}
.btn-end-call:hover  { background: #b02e18; transform: translateY(-1px); }
.btn-end-call:active { transform: translateY(0); }

/* ═══════════════════════════════════════════════════════════════
   FORM ELEMENTS
═══════════════════════════════════════════════════════════════ */
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

.input-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }

.input-group label {
  font-size: var(--text-sm);
  color: var(--muted);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.input-group input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 16px;
  color: var(--text);
  font-size: var(--text-base);
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,94,184,.15);
}

/* ═══════════════════════════════════════════════════════════════
   UTILITY CLASSES
═══════════════════════════════════════════════════════════════ */

/* Uppercase label — e.g. section titles, chip labels */
.label-caps {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
  color: var(--muted);
}

/* ═══════════════════════════════════════════════════════════════
   TOPBAR COMPONENT  — reused in session dialog + viewer
═══════════════════════════════════════════════════════════════ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }

/* ═══════════════════════════════════════════════════════════════
   BADGES
═══════════════════════════════════════════════════════════════ */
.live-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(212,53,28,.1);
  border: 1px solid rgba(212,53,28,.2);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.live-badge .live-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--red);
  animation: livepulse 1s infinite;
}
@keyframes livepulse { 0%,100%{opacity:1} 50%{opacity:.3} }

.score-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: var(--text-xs);
  font-weight: 700;
}
.score-badge.high { background: rgba(52,211,153,.15); color: var(--green); }
.score-badge.mid  { background: rgba(251,191,36,.15);  color: var(--yellow); }
.score-badge.low  { background: rgba(248,113,113,.15); color: var(--red); }

/* ═══════════════════════════════════════════════════════════════
   SPINNER
═══════════════════════════════════════════════════════════════ */
.spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════════
   ENTRY META BADGES
═══════════════════════════════════════════════════════════════ */
.entry-meta { display: flex; gap: 16px; margin-top: 20px; flex-wrap: wrap; }

.entry-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--muted);
}

.entry-badge .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
}

/* ═══════════════════════════════════════════════════════════════
   FEEDBACK SHARED STYLES
═══════════════════════════════════════════════════════════════ */
.fb-section { margin-bottom: 18px; }
.fb-section h3 {
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 700;
}

.fb-list { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.fb-list li {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  line-height: 1.6;
}
.fb-list.strengths    li { background: rgba(0,164,153,.08); border-left: 3px solid var(--green); }
.fb-list.improvements li { background: rgba(212,53,28,.08); border-left: 3px solid var(--red); }
.fb-list.topics       li { background: rgba(0,114,206,.08); border-left: 3px solid var(--blue); }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════ */
@media (min-width: 640px) {
  .header-brand-sub { display: inline; }
}

@media (max-width: 860px) {
  .card { padding: 28px 22px; }
}

@media (max-width: 540px) {
  .header-inner  { padding: 0 14px; }
  .nav-tab       { padding: 6px 10px; font-size: 0.82rem; }
  .card          { padding: 20px 14px; border-radius: var(--radius-md); }
  .page-content,
  .page-content-narrow { padding: 20px 14px; }
}

/* ── Logout button (header) ──────────────────────────────────── */
.btn-logout {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 16px;
  font-size: var(--text-sm);
  font-family: inherit;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn-logout:hover { border-color: var(--accent); color: var(--accent); }
