/* Single Board Game View Styles */

.single-board-game {
  max-width: 95vw; /* Use viewport width to accommodate larger puzzles */
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.player-header {
  text-align: center;
  width: 100%;
}

.player-header h2 {
  font-size: 1.8em;
  font-weight: bold;
  margin: 10px 0;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
  color: var(--player-color, #333);
}

.game-status {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  width: 100%;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.turn-indicator {
  font-size: 1.2em;
  font-weight: bold;
  padding: 10px 20px;
  border-radius: 8px;
  text-align: center;
  transition: all 0.3s ease;
}

.turn-indicator.my-turn {
  background: var(--current-player-light-bg, #d4edda);
  color: var(--current-player-dark-text, #155724);
  border: 2px solid var(--current-player-border, #c3e6cb);
}

.turn-indicator.waiting {
  background: var(--current-player-light-bg, #fff3cd);
  color: var(--current-player-dark-text, #856404);
  border: 2px solid var(--current-player-border, #ffeaa7);
}

.score-display {
  font-size: 1.1em;
  text-align: center;
  padding: 8px 16px;
  background: white;
  border-radius: 6px;
  border: 1px solid #dee2e6;
}

.pencil-mode-toggle {
  padding: 10px 20px;
  border: 2px solid #007bff;
  background: white;
  color: #007bff;
  border-radius: 6px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pencil-mode-toggle:hover {
  background: #f8f9fa;
}

.pencil-mode-toggle.active {
  background: #007bff;
  color: white;
}

.single-board-board {
  margin: 20px auto;
}

/* Responsive design */
@media (max-width: 768px) {
  .single-board-game {
    padding: 10px;
    gap: 15px;
  }
  
  .player-header h2 {
    font-size: 1.5em;
  }
  
  .game-status {
    padding: 10px;
    gap: 10px;
  }
  
  .turn-indicator {
    font-size: 1.1em;
    padding: 8px 16px;
  }
}

/* For very small screens, stack vertically if horizontal space becomes too cramped */
@media (max-width: 480px) {
  .game-status {
    flex-direction: column;
    gap: 8px;
  }
}

/* Connection status styles (for multiplayer) */
.connection-status {
  position: fixed;
  top: 10px;
  right: 10px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.9em;
  font-weight: bold;
  z-index: 1000;
}

.connection-status.connected {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.connection-status.disconnected {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.connection-status.connecting {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

/* Game Master indicator styles */
.game-master-indicator {
  font-size: 0.8em;
  color: var(--game-master-color, darkgray);
}

/* Scoreboard table styles */
.scoreboard-table {
  width: 100%;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  margin: 10px 0;
  border: none !important;
}

.scoreboard-table th {
  padding: 6px 8px;
  text-align: left;
  background-color: #f8f9fa;
  font-weight: bold;
}

.scoreboard-table td {
  padding: 4px 8px;
  font-size: 12px;
  border: none !important;
  text-align: center;
}


.player-row {
  transition: background-color 0.3s ease;
}

.player-row.own-player {
  font-weight: bold;
}

.player-row .player-name {
  text-align: left;
  font-weight: bold;
  color: var(--player-color);
  background-color: var(--player-bg-color) !important;
}

.player-row .score-value {
  text-align: center;
  min-width: 40px;
  background-color: var(--player-bg-color) !important;
}

.player-row .score-total {
  text-align: center;
  font-weight: bold;
  font-size: 14px;
  background-color: var(--player-bg-color) !important;
}

/* Force remove any borders and visual effects from player rows */
.player-row {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  border-spacing: 0 !important;
}

.player-row td {
  border: none !important;
  border-top: none !important;
  border-bottom: none !important;
  border-left: none !important;
  border-right: none !important;
  outline: none !important;
  box-shadow: none !important;
  border-spacing: 0 !important;
}

/* Option section margin */
.option-section {
  margin-bottom: 20px;
}

/* Pencil mode styles */
.pencil-mode-toggle.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.pencil-mode-toggle.disabled input {
  cursor: not-allowed;
}

/* Turn indicator positioning - specific to single board layout */
.turn-indicator-left {
  flex: 1;
  text-align: left;
}

.pencil-mode-right {
  flex: 0;
}

/* Confirmation dialog styles */
.completion-conflict-dialog,
.settings-confirmation-dialog,
.premium-required-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.settings-confirmation-dialog .dialog-content,
.premium-required-dialog .dialog-content {
  background: white;
  padding: 20px;
  border-radius: 10px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Completion Conflict Dialog - separate styling with red gradient background */
.completion-conflict-dialog .dialog-content {
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
  color: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(255, 107, 107, 0.4);
  max-width: 450px;
  width: 90%;
  text-align: center;
}

.completion-conflict-dialog h4,
.settings-confirmation-dialog h4,
.premium-required-dialog h3 {
  margin: 0 0 15px 0;
  color: #333;
}

.confirmation-message {
  white-space: pre-line;
}

.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.dialog-buttons button {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.cancel-btn {
  background: #6c757d;
  color: white;
}

.cancel-btn:hover {
  background: #5a6268;
}

.confirm-btn,
.upgrade-btn {
  background: #007bff;
  color: white;
}

.confirm-btn:hover,
.upgrade-btn:hover {
  background: #0056b3;
}

.premium-required-dialog ul {
  text-align: left;
  margin: 15px 0;
}

.premium-required-dialog li {
  margin: 5px 0;
}

.error-text {
  color: red;
}

/* Player Color Classes - use CSS variables set by JavaScript */
.player-colored {
  color: var(--player-color, #333) !important;
}

.game-master-colored {
  color: var(--game-master-color, darkgray) !important;
}

.player-row-styled {
  color: var(--player-color) !important;
  background-color: var(--player-bg-color) !important;
}

/* Animation Classes */
.flash-animation {
  animation: flash 0.5s ease-in-out 3;
}

@keyframes flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Scoreboard Animation Styles - Fixed to work with actual DOM */
.scoreboard-table .player-row.completion-celebration {
  animation: scoreboardCelebration 1.5s ease-out;
}

.scoreboard-table .player-row.primary-celebration {
  animation: primaryCelebration 1.5s ease-out;
}

.scoreboard-table .player-row.secondary-celebration {
  animation: secondaryCelebration 1.5s ease-out;
}

.scoreboard-table .score-value.completion-flash,
.scoreboard-table .score-total.completion-flash {
  animation: scoreFlash 1.2s ease-out;
}

.scoreboard-table .score-value.primary-flash,
.scoreboard-table .score-total.primary-flash {
  animation: primaryScoreFlash 1.2s ease-out;
}

@keyframes scoreboardCelebration {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255, 255, 255, 0);
  }
  25% {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 0 0 5px var(--player-color, #333);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 25px rgba(255, 255, 255, 1), 0 0 10px var(--player-color, #333);
  }
  75% {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.6), 0 0 5px var(--player-color, #333);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255, 255, 255, 0);
  }
}

@keyframes scoreFlash {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  30% {
    transform: scale(1.1);
    filter: brightness(1.3);
  }
  60% {
    transform: scale(1.05);
    filter: brightness(1.2);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

@keyframes primaryCelebration {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255, 255, 255, 0);
  }
  25% {
    transform: scale(1.08);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.9), 0 0 8px var(--player-color, #333);
  }
  50% {
    transform: scale(1.15);
    box-shadow: 0 0 35px rgba(255, 255, 255, 1), 0 0 15px var(--player-color, #333);
  }
  75% {
    transform: scale(1.08);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.7), 0 0 8px var(--player-color, #333);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255, 255, 255, 0);
  }
}

@keyframes secondaryCelebration {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255, 255, 255, 0);
  }
  25% {
    transform: scale(1.03);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5), 0 0 3px var(--player-color, #333);
  }
  50% {
    transform: scale(1.06);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.7), 0 0 5px var(--player-color, #333);
  }
  75% {
    transform: scale(1.03);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.4), 0 0 3px var(--player-color, #333);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255, 255, 255, 0);
  }
}

@keyframes primaryScoreFlash {
  0% {
    transform: scale(1);
    filter: brightness(1) drop-shadow(0 0 0 transparent);
  }
  20% {
    transform: scale(1.2);
    filter: brightness(1.4) drop-shadow(0 0 3px rgba(255, 255, 255, 0.8));
    font-weight: bold;
  }
  40% {
    transform: scale(1.15);
    filter: brightness(1.3) drop-shadow(0 0 2px rgba(255, 255, 255, 0.6));
  }
  70% {
    transform: scale(1.05);
    filter: brightness(1.2) drop-shadow(0 0 1px rgba(255, 255, 255, 0.4));
  }
  100% {
    transform: scale(1);
    filter: brightness(1) drop-shadow(0 0 0 transparent);
    font-weight: inherit;
  }
}