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

/* =========================================================================
   CLASSROOM V2 — PREMIUM DARK THEME
   Implementation of glassmorphism, tabbed UI, and focus mode
   ========================================================================= */

:root {
  --bg-main: #0b0c10;
  --bg-sidebar: rgba(18, 20, 26, 0.65);
  --border-light: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 255, 255, 0.15);
  --text-main: #f0f0f0;
  --text-dim: #9ca3af;
  --brand-primary: #f59e0b; /* Amber */
  --brand-hover: #fbbf24;
  --success: #10b981;
  --danger: #ef4444;
  --header-h: 60px;
  --sidebar-w: 320px;
}

body {
  margin: 0;
  background: var(--bg-main);
  font-family: 'Inter', sans-serif;
  color: var(--text-main);
  overflow: hidden; /* Prevent body scroll, layout handles it */
}

/* Base utilities from original base.css, simplified for standalone mock */
.text-muted { color: var(--text-dim) !important; }
.text-primary { color: var(--brand-primary) !important; }
.text-success { color: var(--success) !important; }
.w-100 { width: 100%; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }

/* Form inputs & Buttons */
.form-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text-main);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border 0.2s;
  box-sizing: border-box;
}
.form-input:focus {
  border-color: var(--brand-primary);
}

button {
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  border: none;
  outline: none;
}
.btn-primary, .btn-success, .btn-danger {
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  transition: transform 0.1s, filter 0.2s;
}
.btn-primary { background: linear-gradient(135deg, var(--brand-hover), var(--brand-primary)); color: #000; }
.btn-success { background: linear-gradient(135deg, #34d399, var(--success)); color: #fff; }
.btn-danger { background: linear-gradient(135deg, #f87171, var(--danger)); color: #fff; }

.btn-primary:active, .btn-success:active, .btn-danger:active {
  transform: scale(0.97);
}
.btn-primary:hover, .btn-success:hover, .btn-danger:hover {
  filter: brightness(1.1);
}

/* --------------------------------------------------------
   LAYOUT OVERVIEW
   -------------------------------------------------------- */
.classroom-layout-v2 {
  display: flex;
  height: calc(100vh - var(--header-h));
  margin-top: var(--header-h); /* assuming header exists */
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --------------------------------------------------------
   SIDEBARS
   -------------------------------------------------------- */
.sidebar-v2 {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-sidebar);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border-light);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), margin 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 10;
}
.sidebar-v2.right-sidebar {
  border-right: none;
  border-left: 1px solid var(--border-light);
}

/* Collapsible behavior */
.classroom-layout-v2.hide-left-sidebar .left-sidebar {
  margin-left: calc(-1 * var(--sidebar-w));
}
.classroom-layout-v2.hide-right-sidebar .right-sidebar {
  margin-right: calc(-1 * var(--sidebar-w));
}

/* --------------------------------------------------------
   SIDEBAR TABS & NAVIGATION
   -------------------------------------------------------- */
.sidebar-tabs {
  display: flex;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid var(--border-light);
}
.tab-btn {
  flex: 1;
  background: transparent;
  color: var(--text-dim);
  padding: 14px 10px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255,255,255,0.03);
}
.tab-btn.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
  background: rgba(245, 158, 11, 0.05);
}
.collapse-btn {
  flex: 0 0 45px;
  color: var(--text-dim);
}
.collapse-btn:hover { background: rgba(255,255,255,0.08); color: white; }

/* Tab Content Areas */
.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  flex-direction: column;
}
.tab-content.active {
  display: flex;
}

/* Custom Scrollbar for sleek UI */
.tab-content::-webkit-scrollbar { width: 6px; }
.tab-content::-webkit-scrollbar-track { background: transparent; }
.tab-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
.tab-content::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* Common internal blocks */
.section-header {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* --------------------------------------------------------
   LEFT SIDEBAR: STUDENTS & CHAT
   -------------------------------------------------------- */
.room-info-card {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(135deg, rgba(245,158,11,0.05), transparent);
}
.room-label { font-size: 11px; text-transform: uppercase; color: var(--text-dim); margin-bottom: 6px; }
.room-code-group { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.room-code { font-family: 'Roboto Mono', monospace; font-size: 24px; font-weight: 700; color: var(--brand-primary); letter-spacing: 2px; }

.btn-icon {
  width: 34px; height: 34px; border-radius: 8px;
  background: rgba(255,255,255,0.05); color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  transition: 0.2s;
}
.btn-icon:hover { background: rgba(255,255,255,0.1); color: white; }

.badge { background: var(--brand-primary); color: #000; padding: 2px 6px; border-radius: 10px; font-size: 10px; }

.student-list { padding: 8px; }
.student-item {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 8px; transition: background 0.15s;
}
.student-item:hover { background: rgba(255,255,255,0.04); }
.student-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: rgba(245,158,11,0.15); color: var(--brand-primary);
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; position: relative;
}
.online-dot { position: absolute; bottom: 0; right: 0; width: 10px; height: 10px; background: var(--success); border-radius: 50%; border: 2px solid var(--bg-main); }
.online-dot.offline { background: var(--text-dim); }
.student-name { font-size: 13px; font-weight: 500; }

.chat-messages { flex: 1; padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { font-size: 13px; line-height: 1.4; padding: 6px 10px; border-radius: 8px; background: rgba(255,255,255,0.02); }
.chat-msg.system { font-size: 12px; font-style: italic; color: var(--text-dim); text-align: center; background: none; }
.chat-msg .sender { font-weight: 600; color: var(--brand-primary); margin-right: 6px; }
.chat-msg .coach { color: var(--brand-hover); }

.chat-input-area { padding: 12px; border-top: 1px solid var(--border-light); display: flex; gap: 8px; background: rgba(0,0,0,0.15); }
.chat-input { flex: 1; padding: 10px 14px; background: rgba(0,0,0,0.5); border: 1px solid var(--border-light); border-radius: 20px; color: white; outline: none; font-size: 13px; }

/* --------------------------------------------------------
   CENTER AREA: BOARD FOCUS
   -------------------------------------------------------- */
.board-area-v2 {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at center, rgba(255,255,255,0.02) 0%, transparent 60%);
}

.expand-btn {
  position: absolute; top: 10px;
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(255,255,255,0.05); color: var(--text-dim);
  backdrop-filter: blur(8px); border: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: center;
  z-index: 5; opacity: 0; pointer-events: none; transition: 0.3s;
}
.expand-btn:hover { background: rgba(255,255,255,0.15); color: white; }
.classroom-layout-v2.hide-left-sidebar .expand-left { opacity: 1; pointer-events: auto; left: 10px; }
.classroom-layout-v2.hide-right-sidebar .expand-right { opacity: 1; pointer-events: auto; right: 10px; }

/* Board + Eval Integration */
.board-with-eval {
  display: flex;
  align-items: stretch;
  gap: 12px;
  max-width: 600px;
  width: 100%;
  aspect-ratio: 1.05 / 1;
  background: rgba(0,0,0,0.2);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border-focus);
  box-shadow: 0 16px 40px rgba(0,0,0,0.4);
  position: relative;
}

.eval-bar-wrapper {
  width: 24px;
  display: flex;
  flex-direction: column;
  background: #111;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  overflow: hidden;
  position: relative;
}
.eval-score {
  position: absolute; top: 4px; left: 0; right: 0;
  text-align: center; font-size: 10px; font-weight: 700;
  font-family: 'Roboto Mono', monospace; z-index: 2; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
.eval-bar-track { flex: 1; display: flex; align-items: flex-end; }
.eval-bar-fill { width: 100%; background: #e2e8f0; transition: height 0.3s ease; }

.board-wrapper-main {
  flex: 1;
  position: relative;
  background: #2a2c35; /* Dummy board color */
  border-radius: 4px;
}
.dummy-board { width: 100%; height: 100%; position: relative; }

/* Floating Toolbar */
.floating-toolbar {
  position: absolute;
  bottom: 25px; /* Floats over the bottom of the board-area slightly */
  display: flex; align-items: center; gap: 8px;
  background: rgba(15, 17, 26, 0.85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding: 8px 12px; border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 8px 20px rgba(0,0,0,0.5);
  transform: translateY(15px); /* overlapping effect */
}
.tool-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.05); color: var(--text-dim);
  font-size: 13px; display: flex; align-items: center; justify-content: center;
  transition: 0.2s;
}
.tool-btn:hover { background: rgba(255,255,255,0.15); color: white; transform: translateY(-2px); }
.tool-btn.primary { background: var(--brand-primary); color: #000; }
.tool-btn.primary:hover { filter: brightness(1.1); }
.floating-toolbar .divider { width: 1px; height: 20px; background: rgba(255,255,255,0.1); margin: 0 4px; }

/* Horizontal Moves Roll */
.move-history-bar {
  display: flex; align-items: center; gap: 12px;
  margin-top: 40px; width: 100%; max-width: 600px;
  background: rgba(0,0,0,0.3); border-radius: 8px; border: 1px solid var(--border-light);
  padding: 8px 16px;
}
.move-nav { display: flex; gap: 4px; }
.move-nav button { padding: 6px 10px; background: transparent; color: var(--text-dim); border-radius: 4px; }
.move-nav button:hover { background: rgba(255,255,255,0.08); color: white; }
.moves-scroll {
  flex: 1; overflow-x: auto; white-space: nowrap; font-family: 'Roboto Mono', monospace;
  font-size: 14px; padding-bottom: 4px;
}
.moves-scroll::-webkit-scrollbar { height: 4px; }
.m-num { color: var(--text-dim); margin-left: 12px; }
.m-ply { color: white; margin-left: 6px; padding: 2px 6px; border-radius: 4px; cursor: pointer; }
.m-ply:hover { background: rgba(255,255,255,0.1); }
.m-ply.active { background: rgba(245,158,11,0.2); color: var(--brand-hover); }

/* --------------------------------------------------------
   RIGHT SIDEBAR: ANALYSIS, PUZZLES, VIDEO
   -------------------------------------------------------- */
.fen-loader-card { padding: 16px; border-bottom: 1px solid var(--border-light); }
.fen-loader-card label { display: block; font-size: 11px; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
.input-group { display: flex; gap: 8px; }

.engine-card { padding: 16px; }
.engine-header { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; margin-bottom: 12px; }
.engine-header .depth { color: var(--text-dim); }
.pv-line { font-family: 'Roboto Mono', monospace; font-size: 12px; padding: 6px 8px; border-radius: 6px; cursor: pointer; display: flex; gap: 12px; }
.pv-line:hover { background: rgba(255,255,255,0.04); }
.pv-eval { font-weight: 700; width: 45px; }
.pv-moves { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Puzzles */
.puzzle-controls-card { padding: 16px; border-bottom: 1px solid var(--border-light); }
.puzzle-status { display: inline-block; padding: 4px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; margin-bottom: 12px; }
.puzzle-status.off { background: rgba(255,255,255,0.05); color: var(--text-dim); }
.puzzle-status.active { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.attempts-feed { padding: 16px; }
.attempt-card { padding: 10px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05); border-radius: 8px; margin-bottom: 8px; }
.attempt-header { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.attempt-time { font-family: 'Roboto Mono', monospace; color: var(--text-dim); font-size: 10px; font-weight: 400; }
.attempt-moves { font-family: 'Roboto Mono', monospace; font-size: 11px; }
.attempt-moves.wrong { color: #fca5a5; }
.attempt-moves.success { color: #6ee7b7; }

/* Video */
.video-header { padding: 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-light); font-size: 13px; font-weight: 600; }
.live-badge { background: var(--danger); color: white; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 700; animation: pulse 2s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.6; } 100% { opacity: 1; } }

.video-grid, .hms-video-grid { padding: 16px; display: grid; grid-template-columns: 1fr; gap: 12px; overflow-y: auto; }
.video-tile, .hms-video-tile { width: 100%; max-height: 200px; aspect-ratio: 4/3; background: #000; border-radius: 8px; border: 1px solid var(--border-focus); position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.video-tile video, .hms-video-tile video { width: 100%; height: 100%; object-fit: cover !important; display: block; }
.vid-placeholder { font-size: 32px; color: rgba(255,255,255,0.1); }
.vid-label, .hms-peer-label { position: absolute; bottom: 0; left: 0; right: 0; padding: 4px 8px; background: linear-gradient(to top, rgba(0,0,0,0.8), transparent); font-size: 11px; font-weight: 500; color: #fff; display: flex; justify-content: space-between; align-items: center; }
.video-tile.no-video, .hms-video-tile.no-video { background: #1a1c23; border-color: rgba(255,255,255,0.05); }
.video-controls { display: flex; justify-content: center; gap: 12px; padding: 16px; }
.vid-ctrl-btn { width: 44px; height: 44px; border-radius: 50%; font-size: 16px; background: rgba(255,255,255,0.1); color: white; display:flex; align-items:center; justify-content:center; }
.vid-ctrl-btn:hover { background: rgba(255,255,255,0.2); }
.vid-ctrl-btn.danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.vid-ctrl-btn.danger:hover { background: rgba(239, 68, 68, 0.4); }

/* --------------------------------------------------------
   RESPONSIVE & MOBILE
   -------------------------------------------------------- */
@media (max-width: 900px) {
  body {
    overflow-y: auto; /* Allow scrolling on android */
  }

  .classroom-layout-v2 {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - var(--header-h));
    overflow: visible;
  }
  
  .sidebar-v2 {
    width: 100%;
    margin: 0 !important; /* disabled collapsible hiding on mobile layout */
    border-right: none;
    border-bottom: 1px solid var(--border-light);
  }
  
  .board-area-v2 {
    padding: 10px;
    order: -1; /* Move board to top */
  }

  .board-with-eval {
    max-width: 100%;
    box-shadow: none;
  }
  
  .expand-btn { display: none; }
  
  .floating-toolbar {
    position: static;
    transform: none;
    margin-top: 10px;
  }
  
  .move-history-bar { margin-top: 10px; }
}

/* --------------------------------------------------------
   GAMES TAB — result badges & game cards
   -------------------------------------------------------- */
.game-res-white { color: #f1f5f9; background: rgba(241,245,249,0.1); padding: 2px 5px; border-radius: 4px; }
.game-res-black { color: #94a3b8; background: rgba(148,163,184,0.1); padding: 2px 5px; border-radius: 4px; }
.game-res-draw  { color: #fbbf24; background: rgba(251,191,36,0.1);  padding: 2px 5px; border-radius: 4px; }

.attempt-card:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-1px);
  transition: all 0.15s ease;
}
.attempt-card { transition: all 0.15s ease; }

/* --------------------------------------------------------
   PUZZLE GRID VIEW — Streak / Storm mini-boards
   -------------------------------------------------------- */
.grid-attempt-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.grid-attempt-card:hover { border-color: rgba(245,158,11,0.3); }

.grid-attempt-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(0,0,0,0.2);
}
.grid-attempt-label span:last-child { color: #f97316; }  /* streak fire */

/* Streak badge inline in list view */
.attempt-streak {
  display: inline-block;
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
  border: 1px solid rgba(249,115,22,0.3);
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 6px;
}

/* cl-* class aliases used by admin JS */
.cl-student-item   { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 8px; transition: background 0.15s; }
.cl-student-item:hover { background: rgba(255,255,255,0.04); }
.cl-student-avatar { width: 36px; height: 36px; border-radius: 50%; background: rgba(245,158,11,0.15); color: var(--brand-primary); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; position: relative; }
.cl-student-name   { font-size: 13px; font-weight: 500; }
.cl-attempt-item   { padding: 10px; background: rgba(255,255,255,0.02); border-radius: 8px; margin-bottom: 6px; border: 1px solid rgba(255,255,255,0.04); }
.cl-attempt-header { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.cl-attempt-name   { color: var(--text-main); }
.cl-attempt-time   { font-family: 'Roboto Mono', monospace; color: var(--text-dim); font-size: 10px; }
.cl-attempt-moves  { font-family: 'Roboto Mono', monospace; font-size: 11px; color: var(--text-dim); }
.cl-empty-state    { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px; color: var(--text-dim); font-size: 12px; opacity: 0.7; }
.cl-pv-line        { font-family: 'Roboto Mono', monospace; font-size: 12px; padding: 6px 8px; border-radius: 6px; cursor: pointer; display: flex; gap: 12px; }
.cl-pv-line:hover  { background: rgba(255,255,255,0.04); }
.cl-pv-eval        { font-weight: 700; min-width: 45px; }
.cl-pv-moves       { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-move-row       { display: inline-flex; align-items: center; gap: 4px; margin-right: 8px; }
.cl-move-num       { color: var(--text-dim); font-size: 12px; }
.cl-move-ply       { color: white; padding: 2px 5px; border-radius: 3px; cursor: pointer; font-size: 13px; }
.cl-move-ply:hover  { background: rgba(255,255,255,0.1); }
.cl-move-ply.active { background: rgba(245,158,11,0.2); color: var(--brand-hover); }

/* Puzzle mode toggles active state */
#puzzleModeToggles button.active {
  background: rgba(245, 158, 11, 0.25) !important;
  border-color: var(--brand-primary) !important;
  color: var(--brand-primary) !important;
  box-shadow: 0 0 0 1px var(--brand-primary);
}

/* Board arrow SVG layer */
.board-arrow-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 20;
  overflow: visible;
}


