/* ============================================================
   ChessMaster Academy — Chess Board Styles
   ============================================================ */

/* ── Board Wrapper ───────────────────────────────────────── */
#chess-board {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border: 2px solid #8b6914;
  border-radius: 4px;
  overflow: hidden;
  user-select: none;
  position: relative;
  box-shadow: 0 0 0 4px #2a1f0e, 0 8px 32px rgba(0,0,0,0.6);
}

/* ── Squares ─────────────────────────────────────────────── */
.square {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background-color 0.1s;
}
.square.light { background-color: #f0d9b5; }
.square.dark  { background-color: #b58863; }

.square.selected { background-color: #f7f769 !important; }
.square.last-move-from,
.square.last-move-to  { background-color: rgba(155,199,0,0.4) !important; }
.square.legal-move::after {
  content: '';
  position: absolute;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: rgba(0,0,0,0.18);
  pointer-events: none;
}
.square.legal-capture::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 5px solid rgba(0,0,0,0.18);
  pointer-events: none;
  width: 100%; height: 100%;
}
.square.check { background-color: rgba(255,0,0,0.55) !important; }
.square.hint-square::before {
  content: '';
  position: absolute;
  width: 36%; height: 36%;
  border-radius: 50%;
  background: rgba(34,197,94,0.7);
  box-shadow: 0 0 12px rgba(34,197,94,0.6);
  pointer-events: none;
  z-index: 2;
  animation: hintPulse 1.2s infinite;
}
@keyframes hintPulse {
  0%,100% { transform: scale(1); opacity: 0.8; }
  50%      { transform: scale(1.2); opacity: 1; }
}

/* ── Coordinates ─────────────────────────────────────────── */
.square .coord-file {
  position: absolute;
  bottom: 2px; right: 3px;
  font-size: 0.55rem;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  z-index: 1;
}
.square .coord-rank {
  position: absolute;
  top: 2px; left: 3px;
  font-size: 0.55rem;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  z-index: 1;
}
.square.light .coord-file,
.square.light .coord-rank { color: #b58863; }
.square.dark  .coord-file,
.square.dark  .coord-rank { color: #f0d9b5; }

/* ── Pieces ──────────────────────────────────────────────── */
.piece {
  width: 86%;
  height: 86%;
  cursor: grab;
  transition: transform 0.1s;
  position: relative;
  z-index: 3;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
.piece:active  { cursor: grabbing; transform: scale(1.15); }
.piece.dragging { opacity: 0.4; }

/* ── SVG Piece Colors ────────────────────────────────────── */
.piece-svg { width: 100%; height: 100%; }
.piece-w path { fill: #fff; stroke: #000; stroke-width: 1.5; }
.piece-b path { fill: #1a1a1a; stroke: #000; stroke-width: 1.5; }

/* ── Arrow Overlay (Teacher annotations) ────────────────── */
.board-arrows {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
.arrow-line {
  stroke: rgba(34,197,94,0.85);
  stroke-width: 8;
  stroke-linecap: round;
  fill: none;
  marker-end: url(#arrowhead-green);
}
.arrow-line.red { stroke: rgba(239,68,68,0.85); marker-end: url(#arrowhead-red); }
.arrow-line.blue { stroke: rgba(59,130,246,0.85); marker-end: url(#arrowhead-blue); }

/* ── Promotion Modal ─────────────────────────────────────── */
.promo-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.promo-modal {
  background: #1a2035;
  border: 2px solid #f5c842;
  border-radius: 12px;
  padding: 1rem;
  display: flex; gap: 0.5rem;
}
.promo-piece {
  width: 70px; height: 70px;
  cursor: pointer;
  border-radius: 8px;
  border: 2px solid transparent;
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.promo-piece:hover { border-color: #f5c842; background: rgba(245,200,66,0.15); }

/* ── Board Controls ──────────────────────────────────────── */
.board-controls {
  display: flex; gap: 0.5rem; justify-content: center;
  margin-top: 0.75rem; flex-wrap: wrap;
}
.board-btn {
  padding: 0.4rem 0.9rem;
  background: #1a2035;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  color: #94a3b8;
  font-size: 0.82rem;
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  display: flex; align-items: center; gap: 0.35rem;
  transition: all 0.2s;
}
.board-btn:hover { border-color: rgba(245,200,66,0.35); color: #f5c842; }
.board-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Move List ───────────────────────────────────────────── */
.move-list {
  max-height: 220px;
  overflow-y: auto;
  font-family: 'Outfit', monospace;
  font-size: 0.85rem;
}
.move-list::-webkit-scrollbar { width: 4px; }
.move-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
.move-pair {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  transition: background 0.15s;
}
.move-pair:hover { background: rgba(255,255,255,0.04); }
.move-num { color: #64748b; width: 24px; flex-shrink: 0; }
.move-san {
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.move-san:hover, .move-san.current { background: rgba(245,200,66,0.18); color: #f5c842; }

/* ── Eval Bar ────────────────────────────────────────────── */
.eval-bar {
  width: 18px;
  height: 100%;
  background: #1a1a1a;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.eval-bar-fill {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  transition: height 0.5s ease;
}
