/* ── FissionLab Student Portal — Dark Theme ── */

:root {
  --navy:      #0a1628;
  --navy2:     #0d1f3c;
  --navy3:     #122040;
  --gold:      #c9a84c;
  --gold2:     #e8c97a;
  --white:     #ffffff;
  --cream:     #f0ebe0;
  --dim:       rgba(240,235,224,0.80);
  --border:    rgba(201,168,76,0.15);
  --border2:   rgba(201,168,76,0.08);
  --success:   #22c55e;
  --error:     #ef4444;
  --warning:   #f59e0b;
  --muted:     rgba(240,235,224,0.45);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--navy);
  color: var(--cream);
  line-height: 1.65;
  min-height: 100vh;
}
a { color: var(--gold); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--gold2); }
img { max-width: 100%; }

/* ── Typography ── */
h1, h2, h3, h4 {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 700; line-height: 1.2;
  color: var(--white);
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 0.95rem; }

/* ── Layout ── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 1.5rem; }
.page-content { padding: 2rem 0 4rem; }

/* ── Navigation ── */
.portal-nav {
  background: rgba(10,22,40,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 100;
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 0 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; gap: 16px;
}
.nav-brand {
  display: flex; align-items: center; gap: 8px;
  color: var(--white);
  font-size: 1rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  text-decoration: none; flex-shrink: 0;
}
.nav-brand .atom {
  font-size: 1.3rem; color: var(--gold);
  animation: breathe 3s ease-in-out infinite;
}
@keyframes breathe { 0%,100%{opacity:.7}50%{opacity:1} }
.nav-brand em { color: var(--gold); font-style: normal; }
.nav-links { display: flex; align-items: center; gap: 1.25rem; }
.nav-links a {
  color: var(--dim); font-size: 0.82rem;
  font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em;
  transition: color 0.2s; padding: 4px 0;
}
.nav-links a:hover { color: var(--gold); }
.nav-meta { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.nav-user { color: var(--dim); font-size: 0.82rem; white-space: nowrap; }
.nav-badge {
  background: var(--gold); color: var(--navy);
  font-size: 0.7rem; font-weight: 800;
  padding: 2px 6px; border-radius: 10px; min-width: 18px; text-align: center;
}
.btn-logout {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--dim);
  padding: 5px 12px; border-radius: 6px;
  font-size: 0.8rem; cursor: pointer; transition: all 0.2s;
  text-decoration: none; display: inline-block;
}
.btn-logout:hover { background: rgba(255,255,255,0.12); color: var(--white); }

/* ── Buttons ── */
.btn {
  display: inline-block; padding: 9px 20px;
  border-radius: 7px; font-weight: 600;
  font-size: 0.88rem; cursor: pointer;
  border: none; transition: all 0.2s;
  text-decoration: none; text-align: center;
  white-space: nowrap; font-family: inherit;
}
.btn-primary { background: var(--gold); color: var(--navy); }
.btn-primary:hover { background: var(--gold2); color: var(--navy); }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-gold:hover { background: var(--gold2); color: var(--navy); }
.btn-outline {
  background: transparent;
  border: 1.5px solid rgba(201,168,76,0.4);
  color: var(--gold);
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold2); background: rgba(201,168,76,0.06); }
.btn-ghost {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--cream);
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); color: var(--white); }
.btn-danger { background: #dc2626; color: white; border: none; }
.btn-danger:hover { background: #b91c1c; color: white; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-xs { padding: 3px 9px; font-size: 0.72rem; }
.btn-full { width: 100%; display: block; }

/* ── Cards ── */
.card {
  background: var(--navy2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--border); }
.card-title {
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--gold); margin-bottom: 14px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border2);
  display: flex; align-items: center; gap: 8px;
}
.card-title .icon { font-size: 1rem; }

/* ── Dashboard Grid ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 1.25rem;
}
.col-full { grid-column: 1 / -1; }
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .col-full { grid-column: 1; }
  .nav-links { display: none; }
}

/* ── Session Summary Bar ── */
.session-summary {
  background: var(--navy2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 1.25rem;
}
.session-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}
.session-stat { text-align: center; padding: 8px; }
.session-stat .num {
  font-family: Georgia, serif;
  font-size: 2rem; font-weight: 700;
  line-height: 1; margin-bottom: 4px;
}
.session-stat .num.green { color: var(--success); }
.session-stat .num.gold  { color: var(--gold); }
.session-stat .num.white { color: var(--white); }
.session-stat .num.dim   { color: var(--dim); }
.session-stat .lbl {
  font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted);
}
.payment-cta {
  margin-top: 14px;
  padding: 12px 16px;
  background: rgba(201,168,76,0.08);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: 8px;
  display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 10px;
}
.payment-cta p { font-size: 0.88rem; color: var(--gold); font-weight: 600; }

/* ── Welcome Header ── */
.welcome-bar {
  background: var(--navy2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 16px 20px;
  display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 12px;
  margin-bottom: 1.25rem;
}
.welcome-bar h1 {
  font-size: 1.25rem; color: var(--white);
  font-weight: 700; margin-bottom: 3px;
}
.welcome-bar .meta { color: var(--muted); font-size: 0.83rem; }

/* ── App Resource Cards ── */
.app-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
@media (max-width: 600px) { .app-grid { grid-template-columns: 1fr; } }
.app-card {
  border: 1px solid var(--border2);
  border-radius: 8px; padding: 12px 14px;
  transition: border-color 0.2s, transform 0.15s;
  background: rgba(10,22,40,0.5);
}
.app-card.unlocked {
  border-left: 3px solid var(--gold);
}
.app-card.unlocked:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}
.app-card.locked { opacity: 0.45; }
.app-icon { font-size: 1.4rem; margin-bottom: 5px; }
.app-name { font-weight: 700; font-size: 0.88rem; color: var(--white); margin-bottom: 3px; }
.app-desc { font-size: 0.76rem; color: var(--dim); margin-bottom: 10px; line-height: 1.4; }
.app-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.token-pill {
  font-family: 'Courier New', monospace; font-size: 0.72rem;
  background: rgba(201,168,76,0.1); border: 1px solid var(--border);
  padding: 3px 8px; border-radius: 4px;
  color: var(--gold); display: inline-block; user-select: all;
}
.locked-label { font-size: 0.76rem; color: var(--muted); font-style: italic; margin-top: 4px; }

/* ── File list ── */
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: rgba(10,22,40,0.5);
  border: 1px solid var(--border2);
  border-radius: 8px;
  transition: border-color 0.2s;
}
.file-item:hover { border-color: var(--border); }
.file-icon { font-size: 1.4rem; flex-shrink: 0; }
.file-info { flex: 1; min-width: 0; }
.file-name {
  font-size: 0.88rem; font-weight: 600;
  color: var(--white); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.file-meta { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.file-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Messages ── */
.message-item {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  margin-bottom: 8px;
  background: rgba(10,22,40,0.4);
  transition: border-color 0.2s;
}
.message-item.unread {
  border-left: 3px solid var(--gold);
  background: rgba(201,168,76,0.04);
}
.message-item:hover { border-color: var(--border); }
.msg-subject { font-weight: 600; font-size: 0.88rem; color: var(--white); }
.msg-meta { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.msg-preview { font-size: 0.8rem; color: var(--dim); margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Chat bubbles (admin message thread) ── */
.chat-wrap { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 78%; padding: 10px 14px; border-radius: 10px; font-size: 0.88rem; }
.bubble.from-admin {
  align-self: flex-end;
  background: rgba(201,168,76,0.15);
  border: 1px solid rgba(201,168,76,0.3);
  color: var(--cream);
}
.bubble.from-student {
  align-self: flex-start;
  background: rgba(13,31,60,0.8);
  border: 1px solid var(--border2);
  color: var(--cream);
}
.bubble-meta { font-size: 0.68rem; color: var(--muted); margin-top: 4px; }

/* ── Session Notes Table ── */
.session-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.session-table th {
  background: rgba(10,22,40,0.6); color: var(--gold);
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--border2);
}
.session-table td {
  padding: 10px 14px; border-bottom: 1px solid var(--border2);
  vertical-align: top; color: var(--cream);
}
.session-table tr:last-child td { border-bottom: none; }
.session-table tr:hover td { background: rgba(201,168,76,0.04); }

/* ── Admin table ── */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.admin-table th {
  background: rgba(10,22,40,0.8); color: var(--gold);
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--border2);
  white-space: nowrap;
}
.admin-table td {
  padding: 10px 14px; border-bottom: 1px solid var(--border2);
  color: var(--cream);
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(201,168,76,0.04); }
.admin-table .owed-warn { color: var(--gold); font-weight: 700; }
.admin-table .owed-danger { color: var(--error); font-weight: 700; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block; font-size: 0.76rem; font-weight: 700;
  color: rgba(240,235,224,0.6); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.form-control {
  width: 100%; padding: 10px 13px;
  border: 1.5px solid rgba(201,168,76,0.2);
  border-radius: 7px; font-size: 0.9rem;
  background: rgba(10,22,40,0.6);
  color: var(--white);
  transition: border-color 0.2s;
  font-family: inherit;
}
.form-control::placeholder { color: rgba(240,235,224,0.25); }
.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.1);
}
.form-control option { background: #0d1f3c; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: 0.76rem; color: var(--muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 500px) { .form-row { grid-template-columns: 1fr; } }
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.88rem; color: var(--dim); }
.form-check input[type=checkbox] { accent-color: var(--gold); width: 16px; height: 16px; flex-shrink: 0; }

/* ── Flash Messages ── */
.flash-messages { margin: 1rem 0 0; }
.flash {
  padding: 10px 16px; border-radius: 7px;
  font-size: 0.88rem; margin-bottom: 8px;
  display: flex; align-items: flex-start; gap: 10px;
  color: var(--white);
}
.flash-error   { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.flash-success { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.3); color: #86efac; }
.flash-info    { background: rgba(59,130,246,0.12); border: 1px solid rgba(59,130,246,0.3); color: #93c5fd; }
.flash-warning { background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.3); color: #fcd34d; }

/* ── Auth Pages ── */
.auth-page {
  min-height: 100vh;
  background: var(--navy);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem; position: relative; overflow: hidden;
}
/* CSS atomic rings */
.auth-rings {
  position: fixed; inset: 0; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}
.ring {
  position: absolute; border-radius: 50%;
  border: 1px solid rgba(201,168,76,0.08);
  animation: pulse-ring 4s ease-in-out infinite;
}
.ring:nth-child(1) { width: 400px; height: 400px; animation-delay: 0s; }
.ring:nth-child(2) { width: 600px; height: 600px; animation-delay: 0.7s; }
.ring:nth-child(3) { width: 800px; height: 800px; animation-delay: 1.4s; }
@keyframes pulse-ring {
  0%,100% { opacity: 0.3; transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(1.02); }
}
.auth-card {
  background: var(--navy2);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 2.5rem;
  width: 100%; max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  position: relative; z-index: 1;
}
.auth-brand { text-align: center; margin-bottom: 1.75rem; }
.auth-brand .atom { font-size: 2.5rem; color: var(--gold); display: block; margin-bottom: 8px; }
.auth-brand h1 { font-size: 1.4rem; color: var(--white); margin-bottom: 4px; }
.auth-brand p { font-size: 0.85rem; color: var(--gold); font-weight: 600; letter-spacing: 0.06em; }
.auth-footer { text-align: center; margin-top: 1.25rem; font-size: 0.83rem; color: var(--muted); }
.auth-footer a { color: var(--gold); font-weight: 600; }
.auth-footer a:hover { color: var(--gold2); }
.auth-divider { border: none; border-top: 1px solid var(--border2); margin: 1.25rem 0; }

/* ── Badges ── */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 12px;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em;
}
.badge-gold     { background: rgba(201,168,76,0.15); color: var(--gold); border: 1px solid rgba(201,168,76,0.3); }
.badge-green    { background: rgba(34,197,94,0.12); color: #86efac; }
.badge-red      { background: rgba(239,68,68,0.12); color: #fca5a5; }
.badge-blue     { background: rgba(59,130,246,0.12); color: #93c5fd; }
.badge-active   { background: rgba(34,197,94,0.12); color: #86efac; }
.badge-inactive { background: rgba(239,68,68,0.12); color: #fca5a5; }
.badge-error    { background: rgba(239,68,68,0.12); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }

/* ── Toggle switches ── */
.toggle-wrap { display: flex; flex-direction: column; gap: 2px; }
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--border2);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-label { font-size: 0.9rem; color: var(--cream); }
.toggle {
  position: relative; width: 44px; height: 24px;
  cursor: pointer; flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 24px;
  transition: background 0.25s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  left: 3px; top: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  transition: transform 0.25s, background 0.25s;
}
.toggle input:checked + .toggle-slider { background: var(--gold); }
.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: var(--navy);
}

/* ── Tabs (admin detail page) ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border2); margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab-btn {
  padding: 10px 18px; border-radius: 6px 6px 0 0;
  font-size: 0.82rem; font-weight: 600;
  color: var(--muted); background: none;
  border: none; border-bottom: 2px solid transparent;
  cursor: pointer; transition: all 0.2s;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: -1px; font-family: inherit;
}
.tab-btn:hover { color: var(--cream); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Stat cards ── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--navy2); border: 1px solid var(--border2);
  border-radius: 10px; padding: 18px 20px;
  border-left: 3px solid var(--gold);
}
.stat-card .num { font-size: 2rem; font-weight: 800; color: var(--gold); line-height: 1; }
.stat-card .lbl {
  font-size: 0.72rem; color: var(--muted);
  margin-top: 4px; text-transform: uppercase; letter-spacing: 0.08em;
}

/* ── Token display ── */
.token-display {
  font-family: 'Courier New', monospace; font-size: 0.95rem;
  background: rgba(10,22,40,0.6);
  border: 1.5px solid var(--border);
  padding: 10px 14px; border-radius: 7px;
  letter-spacing: 0.1em; color: var(--gold);
  font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

/* ── Calendly ── */
.calendly-container { width: 100%; border-radius: 8px; overflow: hidden; border: 1px solid var(--border2); }

/* ── Progress bar ── */
.progress-wrap { margin: 10px 0; }
.progress-label { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--muted); margin-bottom: 5px; }
.progress-bar { height: 8px; background: rgba(255,255,255,0.08); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--gold); border-radius: 4px; transition: width 0.5s; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 2rem; color: var(--muted); font-size: 0.88rem; }
.empty-state .icon { font-size: 2.2rem; margin-bottom: 10px; }

/* ── Subject Badge ── */
.subject-badge {
  background: rgba(201,168,76,0.12); border: 1px solid rgba(201,168,76,0.35);
  color: var(--gold); font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 20px; display: inline-block;
}

/* ── Drag/drop upload zone ── */
.drop-zone {
  border: 2px dashed rgba(201,168,76,0.3);
  border-radius: 10px; padding: 40px 20px;
  text-align: center; cursor: pointer;
  transition: all 0.2s; background: rgba(10,22,40,0.3);
}
.drop-zone.dragover {
  border-color: var(--gold);
  background: rgba(201,168,76,0.06);
}
.drop-zone-icon { font-size: 2.5rem; margin-bottom: 10px; }
.drop-zone p { font-size: 0.88rem; color: var(--muted); }
.drop-zone strong { color: var(--gold); }
.upload-progress {
  margin-top: 12px; height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px; overflow: hidden; display: none;
}
.upload-progress-bar { height: 100%; background: var(--gold); width: 0%; transition: width 0.3s; }

/* ── Inline editable fields ── */
.inline-edit {
  display: flex; align-items: center; gap: 8px;
}
.inline-edit .val {
  font-size: 1.8rem; font-weight: 800; color: var(--white);
  font-family: Georgia, serif; line-height: 1;
}
.inline-edit input {
  width: 80px; text-align: center;
  font-size: 1.4rem; font-weight: 700;
  background: rgba(10,22,40,0.8);
  border: 1.5px solid var(--border);
  color: var(--white); border-radius: 6px;
  padding: 4px 8px; font-family: Georgia, serif;
}
.inline-edit input:focus { border-color: var(--gold); outline: none; }

/* ── Utilities ── */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.text-muted { color: var(--muted) !important; }
.text-gold  { color: var(--gold) !important; }
.text-white { color: var(--white) !important; }
.text-green { color: var(--success) !important; }
.text-red   { color: var(--error) !important; }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.74rem; }
.font-mono { font-family: 'Courier New', monospace; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.justify-between { justify-content: space-between; }
.hidden { display: none; }
.w-full { width: 100%; }
.text-right { text-align: right; }
