/* ============================================================================
   Scopium Education Platform — shared stylesheet
   Extracted from the case-simulation HTMLs to enforce visual consistency
   across the portal (login, dashboards) and the cases themselves.
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  --navy:        #0A1628;
  --navy-mid:    #0F2042;
  --navy-card:   #132245;
  --navy-border: #1E3464;
  --teal:        #00C2CB;
  --teal-dim:    rgba(0,194,203,0.12);
  --white:       #FFFFFF;
  --white-70:    rgba(255,255,255,0.7);
  --white-40:    rgba(255,255,255,0.4);
  --white-10:    rgba(255,255,255,0.06);
  --green:       #22D87A;
  --amber:       #F5A623;
  --red:         #FF5F6D;
  --blue:        #4B8EFF;
  --font:        'Sora', sans-serif;
  --mono:        'DM Mono', monospace;

  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--navy);
  color: var(--white);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------- Header ---------- */

.app-header {
  background: rgba(10,22,40,0.97);
  border-bottom: 1px solid var(--navy-border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
}
.logo-mark {
  width: 30px;
  height: 30px;
  background: var(--teal);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--navy);
}
.logo-text { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }
.logo-text span { color: var(--teal); }

.header-right { display: flex; align-items: center; gap: 14px; }

/* ---------- Badges ---------- */

.badge {
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.badge-teal  { background: var(--teal-dim);              border: 1px solid rgba(0,194,203,0.3);   color: var(--teal); }
.badge-blue  { background: rgba(75,142,255,0.12);        border: 1px solid rgba(75,142,255,0.3);  color: var(--blue); }
.badge-green { background: rgba(34,216,122,0.12);        border: 1px solid rgba(34,216,122,0.35); color: var(--green); }
.badge-amber { background: rgba(245,166,35,0.12);        border: 1px solid rgba(245,166,35,0.3);  color: var(--amber); }
.badge-red   { background: rgba(255,95,109,0.12);        border: 1px solid rgba(255,95,109,0.3);  color: var(--red); }

/* ---------- Buttons ---------- */

.btn {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .18s;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary   { background: var(--teal); color: var(--navy); font-weight: 700; }
.btn-primary:hover { opacity: .88; }
.btn-secondary { background: transparent; border: 1px solid var(--navy-border); color: var(--white-70); }
.btn-secondary:hover { border-color: var(--teal); color: var(--teal); }
.btn-ghost     { background: transparent; color: var(--white-70); padding: 6px 12px; }
.btn-ghost:hover { color: var(--white); }
.btn:disabled  { opacity: .4; cursor: not-allowed; }

/* ---------- Shell / layout ---------- */

.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 60px);
}

.nav-aside {
  border-right: 1px solid var(--navy-border);
  padding: 24px 18px;
  background: rgba(15,32,66,0.3);
  position: sticky;
  top: 60px;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  align-self: start;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: var(--white-40);
  text-transform: uppercase;
  margin: 0 0 12px 2px;
}
.nav-section + .nav-section { margin-top: 22px; }

.nav-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--white-70);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
}
.nav-item:hover  { background: var(--white-10); color: var(--white); }
.nav-item.active { background: var(--teal-dim); border-color: rgba(0,194,203,0.35); color: var(--teal); font-weight: 600; }

.main { padding: 32px; max-width: 1400px; }

/* ---------- Page header ---------- */

.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.4px; margin-bottom: 6px; }
.page-head p  { font-size: 13.5px; color: var(--white-70); line-height: 1.55; max-width: 720px; }

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

.card {
  background: var(--navy-card);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.card-title { font-size: 13px; font-weight: 700; color: var(--white); display: flex; align-items: center; gap: 8px; }
.card-title::before { content: ''; width: 3px; height: 14px; background: var(--teal); border-radius: 2px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

/* ---------- Stat tile ---------- */

.stat {
  background: var(--navy-card);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.stat-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.8px; color: var(--white-40); text-transform: uppercase; margin-bottom: 10px; }
.stat-value { font-size: 30px; font-weight: 700; font-family: var(--mono); letter-spacing: -0.5px; }
.stat-delta { font-size: 11px; color: var(--white-70); margin-top: 6px; font-family: var(--mono); }
.stat-delta.up   { color: var(--green); }
.stat-delta.down { color: var(--red); }

/* ---------- Placeholder (Phase 3 fills these in) ---------- */

.placeholder {
  background: var(--white-10);
  border: 1px dashed var(--navy-border);
  border-radius: var(--radius-md);
  padding: 28px 18px;
  text-align: center;
  color: var(--white-40);
  font-size: 12px;
  font-style: italic;
}
.placeholder strong { color: var(--white-70); font-style: normal; }

/* ---------- Table ---------- */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.table thead th {
  text-align: left;
  padding: 10px 12px;
  color: var(--white-40);
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--navy-border);
}
.table tbody td {
  padding: 12px;
  border-bottom: 1px solid rgba(30,52,100,0.35);
  color: var(--white);
}
.table tbody tr:hover { background: var(--white-10); }

/* ---------- Auth / login shell ---------- */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background:
    radial-gradient(circle at 20% 20%, rgba(0,194,203,0.08), transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(75,142,255,0.08), transparent 60%),
    var(--navy);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--navy-card);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.auth-brand .logo-mark { width: 36px; height: 36px; font-size: 14px; }
.auth-brand .logo-text { font-size: 18px; }
.auth-title { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; margin-bottom: 6px; }
.auth-sub   { font-size: 13px; color: var(--white-70); margin-bottom: 22px; line-height: 1.5; }

.form-row { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--white-70);
  margin-bottom: 7px;
  text-transform: uppercase;
}
.form-input {
  width: 100%;
  background: rgba(10,22,40,0.65);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: var(--font);
  font-size: 14px;
  padding: 11px 14px;
  outline: none;
  transition: border-color .18s;
}
.form-input:focus { border-color: var(--teal); }

.form-error {
  background: rgba(255,95,109,0.08);
  border: 1px solid rgba(255,95,109,0.3);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--red);
  margin-bottom: 14px;
}

.form-submit {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  justify-content: center;
}

.demo-hint {
  margin-top: 22px;
  padding: 14px;
  background: rgba(75,142,255,0.06);
  border: 1px solid rgba(75,142,255,0.25);
  border-radius: var(--radius-md);
  font-size: 11.5px;
  color: var(--white-70);
  line-height: 1.6;
}
.demo-hint strong { color: var(--white); font-weight: 600; }
.demo-hint code { font-family: var(--mono); font-size: 11px; color: var(--teal); }

/* ---------- Config-missing banner ---------- */

.config-banner {
  background: rgba(245,166,35,0.12);
  border-bottom: 1px solid rgba(245,166,35,0.4);
  color: var(--amber);
  padding: 10px 20px;
  font-size: 12px;
  text-align: center;
  font-weight: 500;
}
.config-banner code { background: rgba(0,0,0,0.25); padding: 1px 6px; border-radius: 3px; font-family: var(--mono); }

/* ---------- User menu (header right) ---------- */

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border-radius: 24px;
  background: var(--white-10);
  border: 1px solid var(--navy-border);
  font-size: 12px;
}
.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
}
.user-chip .user-name { font-weight: 600; }
.user-chip .user-role { color: var(--white-40); font-size: 10.5px; }

/* ---------- Charts + heatmaps ---------- */

/* Muted paragraph used under card titles to explain what a chart shows. */
.muted {
  color: var(--white-70);
  font-size: 12px;
  line-height: 1.5;
  margin: 0 0 12px;
}
.muted em { color: var(--white); font-style: normal; }

/* Wrapper around every Chart.js canvas — gives it a fixed height so the
   library's responsive sizing has something to measure against. */
.chart-host {
  position: relative;
  width: 100%;
}
.chart-host canvas { display: block; width: 100% !important; height: 100% !important; }

/* Heatmap — chips × cases. Horizontally scrolls on narrow screens. */
.heatmap-host { width: 100%; overflow-x: auto; padding-bottom: 4px; }
.heatmap-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  min-width: 520px;
}
.heatmap-row {
  display: grid;
  grid-template-columns: 220px repeat(var(--case-cols, 3), minmax(72px, 1fr));
  gap: 4px;
  align-items: stretch;
}
.heatmap-head-row .heatmap-col-head {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  border-bottom: 1px solid var(--navy-border);
  color: var(--white-70);
  font-size: 11.5px;
}
.heatmap-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--white-10);
  border-radius: var(--radius-sm);
  min-height: 32px;
}
.heatmap-row-head code { font-size: 11.5px; color: var(--white); }
.heatmap-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--white);
  background: var(--white-10);
  transition: transform 120ms ease;
}
.heatmap-cell:hover { transform: scale(1.04); cursor: default; }

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

.label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--white-70);
  margin-bottom: 6px;
  font-weight: 600;
}
.hint {
  font-size: 11.5px;
  color: var(--white-40);
  margin-top: 5px;
  line-height: 1.4;
}

form input[type=text],
form input[type=url],
form input[type=email],
form input[type=password],
form input[type=number],
form select,
form textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--navy);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-sm);
  color: var(--white);
  font: inherit;
  font-size: 13.5px;
  transition: border-color 120ms ease;
}
form input:focus,
form select:focus,
form textarea:focus {
  outline: none;
  border-color: var(--teal);
}
form input:disabled,
form select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
form input::placeholder { color: var(--white-40); }

.radio-inline {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  color: var(--white-70);
  cursor: pointer;
}
.radio-inline input { accent-color: var(--teal); }

.form-error,
.form-success {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.5;
}
.form-error {
  background: rgba(255,95,109,0.1);
  border: 1px solid rgba(255,95,109,0.35);
  color: var(--red);
}
.form-success {
  background: rgba(34,216,122,0.12);
  border: 1px solid rgba(34,216,122,0.35);
  color: var(--green);
}

.url-preview {
  background: var(--navy);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12.5px;
}
.url-preview summary {
  cursor: pointer;
  color: var(--white-70);
  font-weight: 500;
  user-select: none;
}
.url-preview summary:hover { color: var(--teal); }
.url-preview-body {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 6px 14px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--navy-border);
}
.url-preview-body .label { margin: 0; align-self: center; }
.url-preview-body code {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--white);
  word-break: break-all;
}

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

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .nav-aside { display: none; }
  .main { padding: 20px; }
  .url-preview-body { grid-template-columns: 1fr; }
  form [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
}
