/* Styles spécifiques à l'éditeur PGN */

.pgnedit-description-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 15px;
}

.pgnedit-description-container p {
  margin: 0;
  flex: 1;
}

.pgnedit-container {
  margin: 0 auto;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  overflow: hidden;
}

.pgnedit-main-content {
  display: flex;
  padding: 20px;
  gap: 20px;
}

/* Section échiquier */
.pgnedit-board-section {
  flex: 1;
  min-width: 0;
}

.pgnedit-board-container {
  background: #e8e8e8;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.pgnedit-chess-board {
  width: 100%;
  aspect-ratio: 1/1;
  border: 2px solid #888;
  border-radius: 4px;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.pgnedit-chess-board *,
.pgnedit-chess-board cg-board,
.pgnedit-chess-board cg-piece {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.pgnedit-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.pgnedit-control-group {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-right: 20px;
}

/* Aligner les boutons d'action (Effacer, Importer) à droite */
.pgnedit-action-buttons {
  margin-left: auto;
  margin-right: 0;
}

/* Boutons - utilise les couleurs du template */
.pgnedit-nav-button {
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: #800000;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.pgnedit-nav-button:hover {
  background: #a00000;
}

.pgnedit-nav-button:active {
  transform: scale(0.98);
}

.pgnedit-nav-button:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

button {
  padding: 8px 16px;
  border: none;
  border-radius: 5px;
  background: #800000;
  color: white;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s, transform 0.1s;
}

button:hover {
  background: #a00000;
}

button:active {
  transform: scale(0.98);
}

button:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

/* Boutons Undo/Redo */
.pgnedit-undo-redo {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pgnedit-undo-redo button {
  padding: 8px 16px;
  height: 40px;
}

.pgnedit-undo-redo button:disabled {
  opacity: 0.5;
}

/* Bouton Nouvelle partie - largeur naturelle */
.pgnedit-clear-btn {
  padding: 8px 16px;
  height: 40px;
}

select {
  padding: 8px 12px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
  background: white;
  cursor: pointer;
}

select:focus {
  outline: none;
  border-color: #800000;
}

/* Indicateur de tour */
.pgnedit-turn-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #555;
}

/* Conteneur pour les indicateurs de statut (trait à gauche, mode insertion à droite) */
.pgnedit-status-indicators {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.pgnedit-turn-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #333;
  display: inline-block;
}

.pgnedit-turn-circle.white {
  background: #fff;
}

.pgnedit-turn-circle.black {
  background: #333;
}

/* Mode insertion */
.pgnedit-insertion-mode {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  padding: 8px 12px;
  border-radius: 5px;
  margin-bottom: 10px;
  font-size: 13px;
  color: #856404;
}

/* Info overlay et bar */
.pgnedit-info-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: none;
  z-index: 1001;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.pgnedit-info-overlay.show {
  display: block;
}

.pgnedit-info-bar {
  background: #e7f3ff;
  padding: 12px 15px;
  border-radius: 8px;
  font-size: 14px;
  border-left: 4px solid #800000;
  display: block;
  
  /* Centré dans l'overlay */
  margin: 0 auto;
  max-width: 500px;
}

.pgnedit-info-bar.error {
  background: #f8d7da;
  border-left-color: #dc3545;
}

.pgnedit-info-bar.success {
  background: #d4edda;
  border-left-color: #28a745;
}

/* Status bar */
.pgnedit-status-bar {
  display: flex;
  justify-content: space-between;
  padding: 10px 15px;
  background: #f8f9fa;
  border-top: 1px solid #eee;
  font-size: 13px;
  color: #666;
}

/* Section PGN */
.pgnedit-pgn-section {
  flex: 1;
  min-width: 350px;
  display: flex;
  flex-direction: column;
}

.pgnedit-pgn-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
}

.pgnedit-pgn-header h2 {
  font-size: 18px;
  color: #333;
}

.pgnedit-pgn-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pgnedit-pgn-table-wrapper {
  flex: 1;
  overflow-y: auto;
  max-height: 500px;
  border: 1px solid #eee;
  border-radius: 5px;
}

.pgnedit-move-indicator {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 13px;
  color: #666;
}

.pgnedit-pgn-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.pgnedit-pgn-table th {
  background: #f8f9fa;
  padding: 10px;
  text-align: left;
  border-bottom: 2px solid #ddd;
  font-weight: 600;
  color: #555;
}

.pgnedit-pgn-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background 0.1s;
}

.pgnedit-pgn-table td:hover {
  background: #f8f9fa;
}

.pgnedit-pgn-table tr:hover {
  background: #f5f7fa;
}

.pgnedit-pgn-table .pgnedit-move-number {
  font-weight: 600;
  color: #666;
  text-align: center;
  width: 60px;
}

.pgnedit-pgn-table .pgnedit-white-move,
.pgnedit-pgn-table .pgnedit-black-move {
  width: 42%;
  min-width: 80px;
}

.pgnedit-pgn-table input {
  width: 100%;
  padding: 6px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 13px;
  background: white;
}

.pgnedit-pgn-table input:focus {
  outline: none;
  border-color: #800000;
}

/* Classes pour les cellules de coup */
.move-cell-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.move-cursor {
  display: inline-block;
  width: 16px;
  min-width: 16px;
  text-align: center;
  color: #800000;
  font-size: 11px;
}

.move-text {
  flex: 1;
}

.move-text.current {
  color: #800000;
  font-weight: bold;
}

.half-move-delete {
  background: none;
  border: none;
  color: #dc3545;
  cursor: pointer;
  font-size: 12px;
  padding: 0 4px;
  margin-left: 4px;
  width: auto;
  height: auto;
  vertical-align: middle;
  opacity: 0.5;
  transition: opacity 0.1s;
}

.half-move-delete:hover {
  opacity: 1;
  background: none;
}

.full-move-delete {
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  padding: 4px 10px;
  opacity: 0.6;
  transition: opacity 0.1s;
}

.full-move-delete:hover {
  opacity: 1;
}

.pgnedit-row-delete-cell {
  width: 50px;
  text-align: center;
}

/* PGN Output */
.pgnedit-pgn-output-section {
  padding: 0 20px 20px 20px;
}

.pgnedit-pgn-output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.pgnedit-pgn-output-header h3 {
  font-size: 16px;
  color: #333;
  margin: 0;
}

.pgnedit-pgn-output-actions {
  display: flex;
  gap: 10px;
}

.pgnedit-pgn-output {
  width: 100%;
  height: 120px;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-family: monospace;
  font-size: 12px;
  resize: vertical;
  background: #f8f9fa;
}

.pgnedit-pgn-output:focus {
  outline: none;
  border-color: #800000;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Invalid move styling */
.invalid-move {
  background: #fee !important;
  color: #c00 !important;
}

.current-move {
  background: #e7f3ff !important;
  font-weight: 600;
}

.delete-btn {
  background: #dc3545;
}

.delete-btn:hover {
  background: #c82333;
}

/* Responsive */
@media (max-width: 1200px) {
  .outils-card {
    padding: 0;
    overflow: visible;
  }
  
  .pgnedit-main-content {
    flex-direction: column;
    padding: 10px;
  }

  .pgnedit-board-section,
  .pgnedit-pgn-section {
    min-width: 100%;
  }

  .pgnedit-pgn-table-wrapper {
    max-height: 300px;
  }

  .pgnedit-pgn-output-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* Modal pour l'import PGN */
.pgnedit-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.pgnedit-modal-content {
  background: white;
  padding: 20px;
  border-radius: 10px;
  max-width: 800px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.pgnedit-modal-content h3 {
  margin: 0 0 15px;
  color: #333;
}

.pgnedit-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 15px;
}

/* Mobile: masquer le texte du bouton Nouvelle partie */
@media (max-width: 768px) {
  .pgnedit-clear-text {
    display: none;
  }
  
  .pgnedit-nav-button,
  .pgnedit-clear-btn {
    width: 40px;
    height: 40px;
    padding: 0;
  }
}
