/* Chess Analysis Styles */

.chess-analysis-container {
  display: flex;
  gap: 20px;
  max-width: 1400px;
  margin: 40px auto;
  padding: 20px;
}

.chess-board-section {
  flex: 0 0 auto;
}

.chess-board-with-eval {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

/* Fix chessboard piece positioning */
#chess-board {
  position: relative;
}

/* Highlight selected square and valid moves */
#chess-board .square-55d63.highlight-selected {
  box-shadow: inset 0 0 0 3px #ffd700 !important;
}

#chess-board .square-55d63.highlight-valid-move {
  background-image: radial-gradient(circle, rgba(0, 128, 0, 0.5) 25%, transparent 25%) !important;
  background-size: 100% 100% !important;
  background-position: center !important;
}

/* Center chess pieces in squares */
#chess-board .piece-417db {
  position: absolute;
  top: -50px !important;
  width: 75% !important;
  height: 75% !important;
}

/* Fix draggable piece positioning to follow cursor correctly */
body .piece-417db.dragging-417db {
  z-index: 10000 !important;
  cursor: grabbing !important;
  transform: translate(-50%, -50%) !important;
}

.eval-bar-wrapper {
  width: 30px;
  min-height: 600px;
  display: flex;
  flex-direction: column;
}

.eval-bar-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-radius: 4px;
  overflow: hidden;
  background-color: var(--bg-tile);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .eval-bar-container {
  box-shadow: 0 2px 4px rgba(255, 255, 255, 0.1);
}

.eval-bar-black {
  background-color: #2c2c2c;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 4px 0;
  transition: height 0.3s ease;
}

.eval-bar-white {
  background-color: #f0f0f0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 4px 0;
  transition: height 0.3s ease;
}

.eval-text {
  font-size: 11px;
  font-weight: 600;
  font-family: monospace;
}

.eval-text-black {
  color: #f0f0f0;
}

.eval-text-white {
  color: #2c2c2c;
}

.analysis-panel {
  flex: 1;
  min-width: 300px;
}

.analysis-panel-header {
  background-color: var(--bg-accent);
  padding: 15px;
  border-radius: 4px 4px 0 0;
  border-bottom: 2px solid var(--bg-page);
}

.analysis-panel-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text-heading);
}

.analysis-lines {
  background-color: var(--bg-tile);
  border: 1px solid var(--bg-accent);
  border-radius: 0 0 4px 4px;
  padding: 10px;
  min-height: 200px;
}

.analysis-line {
  padding: 10px;
  margin: 5px 0;
  background-color: var(--bg-page);
  border-radius: 4px;
  border-left: 3px solid #4a90e2;
  font-family: monospace;
  font-size: 13px;
  display: flex;
  gap: 12px;
}

.analysis-line:nth-child(1) {
  border-left-color: #4a90e2;
}

.analysis-line:nth-child(2) {
  border-left-color: #7cb342;
}

.analysis-line:nth-child(3) {
  border-left-color: #fb8c00;
}

.analysis-score {
  font-weight: bold;
  min-width: 50px;
  color: var(--text-heading);
}

.analysis-moves {
  color: var(--text-main);
  flex: 1;
  word-break: break-word;
}

.controls-panel {
  max-width: 600px;
  margin: 20px auto;
  text-align: center;
}

.controls-panel button {
  margin: 5px;
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  background-color: #4a90e2;
  color: white;
  border: none;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.controls-panel button:hover {
  background-color: #357abd;
}

.controls-panel button:active {
  background-color: #2a5f8f;
}

.controls-panel button.secondary {
  background-color: #7cb342;
}

.controls-panel button.secondary:hover {
  background-color: #689f38;
}

.controls-panel button.primary {
  background-color: #2196f3;
}

.controls-panel button.primary:hover {
  background-color: #1976d2;
}

/* Report Panel Styles */
#report-panel {
  max-width: 1400px;
  margin: 30px auto;
  background: var(--bg-tile);
  border: 1px solid var(--bg-accent);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] #report-panel {
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
}

.report-panel-header {
  background-color: var(--bg-accent);
  padding: 15px 20px;
  border-bottom: 2px solid var(--bg-page);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.report-panel-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--text-heading);
}

.report-panel-header button {
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  background-color: var(--bg-page);
  color: var(--text-heading);
  border: none;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.report-panel-header button:hover {
  background-color: var(--bg-tile);
}

/* Report Statistics */
.report-stats {
  display: flex;
  gap: 20px;
  padding: 25px;
  flex-wrap: wrap;
}

.player-stats-card {
  flex: 1;
  min-width: 280px;
  border: 1px solid var(--bg-accent);
  border-radius: 6px;
  padding: 20px;
  background: var(--bg-page);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .player-stats-card {
  box-shadow: 0 1px 3px rgba(255, 255, 255, 0.05);
}

.player-stats-card.white {
  border-top: 4px solid #f0f0f0;
}

.player-stats-card.black {
  border-top: 4px solid #2c2c2c;
}

.player-stats-card h3 {
  margin: 0 0 15px 0;
  font-size: 20px;
  color: var(--text-heading);
  text-align: center;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--bg-accent);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--bg-accent);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-label {
  font-weight: 500;
  color: var(--text-main);
  font-size: 14px;
}

.stat-value {
  font-weight: 600;
  color: var(--text-heading);
  font-size: 14px;
}

.accuracy-value {
  font-size: 28px;
  color: #4a90e2;
  font-weight: 700;
}

/* Move Classification Colors */
.blunder-count {
  color: #d32f2f;
  font-weight: 700;
}

.mistake-count {
  color: #f57c00;
  font-weight: 700;
}

.dubious-count {
  color: #fbc02d;
  font-weight: 700;
}

.inaccuracy-count {
  color: #7cb342;
  font-weight: 700;
}

/* Live Stats Section */
.live-stats-section {
  padding: 15px;
  background-color: var(--bg-page);
  border-radius: 4px;
  border: 1px solid var(--bg-accent);
  margin-bottom: 15px;
}

.live-stats-section h4 {
  margin: 0 0 15px 0;
  font-size: 14px;
  color: var(--text-heading);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--bg-accent);
  padding-bottom: 8px;
}

.recent-moves-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 15px 0 10px 0;
  padding-top: 15px;
  border-top: 1px solid var(--bg-accent);
}

.recent-moves {
  margin-bottom: 10px;
}

.no-analysis {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-main);
  font-style: italic;
}

.recent-move {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin: 4px 0;
  background-color: var(--bg-tile);
  border-radius: 4px;
  font-size: 13px;
  font-family: monospace;
}

.move-indicator {
  font-size: 12px;
}

.move-notation {
  font-weight: 600;
  min-width: 60px;
  color: var(--text-heading);
}

.move-accuracy {
  font-weight: 600;
  min-width: 45px;
}

.move-classification {
  font-size: 16px;
  font-weight: 700;
  margin-left: auto;
}

.move-classification.blunder {
  color: #d32f2f;
}

.move-classification.mistake {
  color: #f57c00;
}

.move-classification.dubious {
  color: #fbc02d;
}

.move-classification.inaccuracy {
  color: #7cb342;
}

.move-classification.best {
  color: #15781B;
  font-weight: 800;
}

.move-classification.good {
  color: #4a90e2;
  font-weight: 700;
}

.live-stats-summary {
  display: flex;
  gap: 15px;
  margin-bottom: 10px;
}

.stat-column {
  flex: 1;
  text-align: center;
  padding: 10px;
  background-color: var(--bg-tile);
  border-radius: 4px;
}

.stat-header {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 10px;
  color: var(--text-heading);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-accuracy {
  font-size: 32px;
  font-weight: 700;
  color: #4a90e2;
  margin-bottom: 12px;
}

.stat-detail {
  font-size: 12px;
  color: var(--text-main);
  margin: 6px 0;
}

@media (max-width: 900px) {
  .chess-analysis-container {
    flex-direction: column;
  }

  .chess-board-with-eval {
    margin: 0 auto;
  }

  .analysis-panel {
    min-width: 100%;
  }
}

/* Chessground Core Overrides */
.cg-wrap {
  width: 100%;
  height: 100%;
  display: block;
}

cg-board {
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* Analysis Arrow Colors (SVG) */
/* These classes map to the 'brush' property in chessground-wrapper.js */

/* Green: Best Move */
.cg-shapes g[stroke="green"],
.cg-shapes g[data-brush="green"] {
  stroke: #15781B;
  opacity: 0.8;
}
.cg-shapes g[fill="green"],
.cg-shapes g[data-brush="green"] {
  fill: #15781B;
  opacity: 0.8;
}

/* Blue: Brilliant Move */
.cg-shapes g[stroke="blue"],
.cg-shapes g[data-brush="blue"] {
  stroke: #00BFFF;
  opacity: 0.9;
}
.cg-shapes g[fill="blue"],
.cg-shapes g[data-brush="blue"] {
  fill: #00BFFF;
  opacity: 0.9;
}

/* Red: Blunder */
.cg-shapes g[stroke="red"],
.cg-shapes g[data-brush="red"] {
  stroke: #d32f2f;
  opacity: 0.8;
}
.cg-shapes g[fill="red"],
.cg-shapes g[data-brush="red"] {
  fill: #d32f2f;
  opacity: 0.8;
}

/* Orange: Mistake */
.cg-shapes g[stroke="orange"],
.cg-shapes g[data-brush="orange"] {
  stroke: #ffa000;
  opacity: 0.8;
}
.cg-shapes g[fill="orange"],
.cg-shapes g[data-brush="orange"] {
  fill: #ffa000;
  opacity: 0.8;
}

/* Yellow: Alternative line */
.cg-shapes g[stroke="yellow"],
.cg-shapes g[data-brush="yellow"] {
  stroke: #e68f00;
  opacity: 0.7;
}
.cg-shapes g[fill="yellow"],
.cg-shapes g[data-brush="yellow"] {
  fill: #e68f00;
  opacity: 0.7;
}

/* Pale Green: Good/Excellent */
.cg-shapes g[stroke="paleGreen"],
.cg-shapes g[data-brush="paleGreen"] {
  stroke: #8bc34a;
  opacity: 0.8;
}
.cg-shapes g[fill="paleGreen"],
.cg-shapes g[data-brush="paleGreen"] {
  fill: #8bc34a;
  opacity: 0.8;
}

/* Piece theme compatibility */
.cg-wrap piece {
  background-size: cover;
}

/* Coordinates */
.cg-wrap coords {
  position: absolute;
  display: flex;
  pointer-events: none;
  opacity: 0.8;
  font-size: 10px;
}

.cg-wrap coords.ranks {
  flex-flow: column-reverse;
  left: 2px;
  top: 2px;
  bottom: 2px;
}

.cg-wrap coords.files {
  flex-flow: row;
  left: 2px;
  right: 2px;
  bottom: 2px;
}
