/* Default styles (compact mode) - 3 columns */
.chess-game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 20px auto;
  max-width: 1000px;
}

@media (max-width: 1200px) {
  .main-content-container {
    flex-direction: column;
  }

  .auth-panel {
    flex: none;
    width: 100%;
    min-height: auto;
    margin-bottom: 20px;
  }

  .user-info {
    flex-direction: row;
    justify-content: center;
  }

  .user-avatar {
    margin-bottom: 0;
  }
}

.chess-game-container.large-board + .auth-panel {
  min-height: 600px;
}

.main-content-container {
  display: flex;
  flex-direction: row;
  width: 100%;
  gap: 20px;
  align-items: flex-start;
}

.auth-panel {
  flex: 0 0 250px;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 20px;
  min-height: 400px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 14px;
  color: #ccc;
}

.form-group input {
  padding: 10px;
  border-radius: 4px;
  border: 1px solid #555;
  background-color: rgba(0, 0, 0, 0.3);
  color: #fff;
}

.auth-button {
  padding: 10px;
  background-color: #555;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  margin-top: 10px;
}
.auth-button:hover {
  background-color: #777;
}

.auth-switch {
  margin-top: 15px;
  font-size: 14px;
  color: #aaa;
}
.auth-switch a {
  color: #eee;
  text-decoration: underline;
}

.auth-panel h3 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 20px;
  color: #eee;
  text-align: center;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

.user-details {
  width: 100%;
  text-align: center;
}

.username {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 10px;
}

.user-level, .user-games, .user-rating {
  margin: 5px 0;
  font-size: 14px;
  color: #ccc;
}

.user-avatar {
  width: 80px;
  height: 80px;
  margin-bottom: 10px;
}

.avatar-placeholder {
  width: 100%;
  height: 100%;
  background-color: #555;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.avatar-initial {
  font-size: 40px;
  color: #fff;
  font-weight: bold;
}


.player-label {
  display: block;
  margin: 10px 0;
  font-size: 1.2em;
  font-weight: bold;
  color: #eee;
}

.player-label.top-label {
  margin-bottom: 5px;
}

.player-label.bottom-label {
  margin-top: 5px;
}

/* Adjust label positioning in large board mode */
.chess-game-container.large-board .player-label {
  max-width: 600px; /* Match the board width in large mode */
}

.chess-game-container.compact-board .player-label {
  max-width: 400px; /* Match the board width in compact mode */
}

.chess-board-column {
  flex: 0 0 400px; /* Compact size */
  display: flex;
  flex-direction: column;
}

/* Middle column - captured pieces (compact mode) */
.chess-captured-column {
  flex: 0 0 150px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Right column - controls */
.chess-controls-column {
  flex: 0 0 200px;
  display: flex;
  flex-direction: column;
}

.chess-content {
  flex: 1;
}

#chess-board {
  position: relative;
  width: 400px; /* Compact size */
  height: 400px; /* Compact size */
  flex-shrink: 0;
  overflow: hidden;
  user-select: none;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
}

/* Chessboard image */
#chess-board img {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* Chess pieces container */
#chess-pieces {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  user-select: none;
}

.chess-piece {
  position: absolute;
  width: 50px; /* Compact size - square size */
  height: 50px; /* Compact size - square size */
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  z-index: 10;
  cursor: grab;
}

/* Visual cue for pieces being dragged */
.chess-piece.dragging {
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  z-index: 100 !important;
  transform: scale(1.1);
  cursor: none !important;
}

/* Chess panel for controls and move history */
.chess-panel {
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 15px;
  margin: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Control buttons */
.control-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-buttons button {
  padding: 12px 15px;
  border-radius: 4px;
  background-color: #555;
  color: white;
  border: none;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s;
}

.control-buttons button:hover {
  background-color: #777;
}

/* Move history area */
.move-history {
  flex-grow: 1;
  margin-top: 15px;
}

.move-history h3 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 18px;
  color: #ddd;
}

.move-list {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  padding: 10px;
  height: 280px; /* Make larger in compact mode */
  overflow-y: auto;
  font-family: monospace;
  color: #eee;
}

/* Captured pieces areas */
.captured-pieces-area {
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 15px;
  margin: 0;
  min-height: 150px; /* Taller in compact mode */
  display: flex;
  flex-direction: column;
}

.captured-pieces-area h3 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 16px;
  color: #ddd;
}

/* Captured pieces display */
.captured-pieces {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex-grow: 1;
  padding: 5px;
  border-radius: 4px;
  background-color: rgba(200, 170, 130, .8);
}

.captured-piece {
  width: 20px;
  height: 20px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
}

/* Move indicators */
.move-indicator {
  position: absolute;
  width: 10px; /* Compact size - indicator */
  height: 10px; /* Compact size - indicator */
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.6);
  pointer-events: none;
  cursor: none;
  z-index: 6;
}

/* Large board styles - 2 columns */
.chess-game-container.large-board {
  max-width: 1000px;
  gap: 30px;
}

.chess-game-container.large-board .chess-board-column {
  flex: 0 0 600px; /* 150% of compact size */
}

.chess-game-container.large-board #chess-board {
  width: 600px; /* 150% of compact size */
  height: 600px; /* 150% of compact size */
}

.chess-game-container.large-board .chess-piece {
  width: 75px; /* 150% of compact size */
  height: 75px; /* 150% of compact size */
}

.chess-game-container.large-board .move-indicator {
  width: 15px; /* 150% of compact size */
  height: 15px; /* 150% of compact size */
}

/* Layout changes for large mode - move captured pieces to control column */
.chess-game-container.large-board .chess-captured-column {
  display: none; /* Hide middle column in large mode */
}

.chess-game-container.large-board .chess-controls-column {
  flex: 1;
  max-width: 300px;
}

/* Large mode - add captured pieces to control column */
.chess-game-container.large-board .chess-controls-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chess-game-container.large-board .chess-controls-column .captured-pieces-area {
  min-height: 80px;
  margin: 0;
}

.chess-game-container.large-board .move-list {
  height: 180px; /* Smaller in large mode */
}

/* Chess overlay for color selection */
.chess-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 20;
  border-radius: 4px;
}

.chess-overlay button {
  margin: 10px;
  padding: 12px 24px;
  font-size: 18px;
  cursor: pointer;
  border: none;
  border-radius: 5px;
  transition: transform 0.2s, background-color 0.2s;
}

.chess-overlay button:hover {
  transform: scale(1.05);
}

.white-button {
  background-color: #fff;
  color: #000;
}

.black-button {
  background-color: #000;
  color: #fff;
}

/* Prevent text selection across the entire chess area */
.chess-game-container * {
  user-select: none;
  -webkit-user-select: none;
}

.chess-game-area {
  display: flex;
  justify-content: center;
  gap: 20px;
  width: 100%;
}

/* Move history styling */
.move-row {
  display: flex;
  align-items: center;
  text-align: left;
  margin-bottom: 4px;
}

.move-number {
  flex: 0 0 30px;
  font-weight: bold;
  color: #999;
  text-align: right;
  margin-right: 8px;
}

.white-move, .black-move {
  flex: 1;
  text-align: left;
  padding: 2px 5px;
  border-radius: 3px;
}

.white-move {
  margin-right: 5px;
}

.black-move {
  background-color: rgba(0, 0, 0, 0.2);
}

/* Make sure move list has proper alignment */
.move-list {
  text-align: left;
}
