/* ============================================================
   GTS Student Portal — Dark Theme
   (Shares design language with teacher.css)
   ============================================================ */

:root {
  --bg: #0a0a0f;
  --surface: #13131e;
  --surface-2: #1a1a2a;
  --surface-3: #202032;
  --border: #252538;
  --border-subtle: #1e1e30;
  --text: #f0f0f8;
  --muted: #8888a8;
  --accent: #b11226;
  --accent-hover: #d01530;
  --accent-dim: rgba(177, 18, 38, 0.15);
  --green: #22c55e;
  --blue: #60a5fa;
  --radius: 12px;
  --radius-lg: 18px;
  --sidebar-width: 260px;
  --mobile-header-height: 56px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.6;
  display: flex;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
p { margin: 0 0 0.75rem; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* ---- Sidebar ---------------------------------------------- */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  z-index: 30;
}

.sidebar-header {
  padding: 1.25rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.sidebar-logo {
  font-size: 1.3rem;
  font-weight: 850;
  color: var(--text);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.sidebar-logo:hover { color: var(--accent); }

.sidebar-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.5rem;
  background: var(--surface-2);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 540;
  cursor: pointer;
  text-align: left;
  transition: background 150ms ease, color 150ms ease;
}

.sidebar-nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sidebar-nav-item.active {
  background: var(--accent-dim);
  color: var(--text);
  font-weight: 640;
  border: 1px solid rgba(177, 18, 38, 0.25);
}

.nav-icon {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  opacity: 0.8;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.sidebar-back-link {
  font-size: 0.8rem;
  color: var(--muted);
  transition: color 150ms;
}

.sidebar-back-link:hover { color: var(--text); }

/* ---- Mobile header ---------------------------------------- */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--mobile-header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  align-items: center;
  padding: 0 1rem;
  gap: 0.75rem;
  z-index: 40;
}

.mobile-menu-btn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.3rem 0.55rem;
  font-size: 1rem;
  cursor: pointer;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 25;
  backdrop-filter: blur(2px);
}

/* ---- Main -------------------------------------------------- */
.portal-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.view {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.view.active {
  display: flex;
}

.view-header {
  padding: 2rem 2rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.view-header h1 {
  font-size: 1.6rem;
  font-weight: 750;
}

.view-subtitle {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 0.3rem;
}

/* ---- Sessions content ------------------------------------- */
.sessions-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem;
}

.sessions-content::-webkit-scrollbar {
  width: 4px;
}
.sessions-content::-webkit-scrollbar-track { background: transparent; }
.sessions-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* ---- Session cards ---------------------------------------- */
.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.session-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  transition: border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}

.session-card:hover {
  border-color: #35354a;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.session-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.session-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.session-date {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 550;
}

.session-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.session-teacher {
  font-size: 0.82rem;
  color: var(--muted);
}

.session-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.session-badge.complete {
  background: rgba(34, 197, 94, 0.12);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.session-badge.in-progress {
  background: rgba(96, 165, 250, 0.12);
  color: var(--blue);
  border: 1px solid rgba(96, 165, 250, 0.25);
}

.session-stats {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 750;
  color: var(--text);
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.session-accuracy-bar {
  height: 4px;
  background: var(--surface-2);
  border-radius: 4px;
  margin-bottom: 1rem;
  overflow: hidden;
}

.session-accuracy-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), #d01530);
  transition: width 600ms ease;
}

.session-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.btn-session {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 640;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.btn-session:hover {
  background: var(--surface-3);
  border-color: #35354a;
}

.btn-session:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-session.primary {
  background: var(--accent-dim);
  border-color: rgba(177, 18, 38, 0.3);
  color: var(--text);
}

.btn-session.primary:hover {
  background: rgba(177, 18, 38, 0.25);
  border-color: var(--accent);
}

.btn-session svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

/* ---- Empty state ------------------------------------------ */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 2rem;
  gap: 0.75rem;
}

.empty-icon {
  font-size: 2.5rem;
  color: var(--border);
  margin-bottom: 0.5rem;
}

.empty-state h2 {
  font-size: 1.25rem;
  color: var(--text);
}

.empty-state p {
  color: var(--muted);
  max-width: 40ch;
  font-size: 0.92rem;
}

/* ---- Modals ----------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal[aria-hidden="false"] {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 12, 0.82);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  width: min(100% - 2rem, 760px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-dialog-lg {
  width: min(100% - 2rem, 900px);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-close {
  width: 2rem;
  height: 2rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  line-height: 1;
  transition: background 150ms, color 150ms;
}

.modal-close:hover {
  background: var(--surface-3);
  color: var(--text);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

/* Video player */
.session-video {
  width: 100%;
  border-radius: var(--radius);
  background: #000;
  max-height: 60vh;
  outline: none;
}

/* Transcript */
.transcript-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 60vh;
}

.transcript-turn {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.transcript-turn:last-child {
  border-bottom: none;
}

.turn-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.turn-number {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
  min-width: 2rem;
}

.turn-speaker {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.turn-speaker.teacher { color: var(--accent); }
.turn-speaker.student { color: var(--blue); }

.turn-mood {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
}

.turn-text {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.55;
  padding-left: 2.5rem;
}

.turn-accuracy {
  padding-left: 2.5rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.turn-accuracy.correct { color: var(--green); }
.turn-accuracy.incorrect { color: var(--accent); }

/* ---- Responsive ------------------------------------------- */
@media (max-width: 700px) {
  body {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 250ms ease;
    z-index: 35;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .mobile-header {
    display: flex;
  }

  .portal-main {
    margin-top: var(--mobile-header-height);
    height: calc(100vh - var(--mobile-header-height));
  }

  .sessions-content {
    padding: 1rem;
  }

  .view-header {
    padding: 1.25rem 1rem 0.75rem;
  }

  .session-card {
    padding: 1rem;
  }

  .session-stats {
    gap: 0.75rem;
  }
}
