/* =============================================================================
 * CONFRONTATION.CSS - Styles pour la gestion des affrontements Pokémon
 * =============================================================================
 */

/* =============================================================================
 * 1. VARIABLES ET THÈME
 * =============================================================================
 */
:root {
  /* Ces variables sont définies dans le fichier principal mais sont référencées ici */
  /* --dark-bg-primary: #1a1c2e;
  --dark-bg-secondary: #1e213a;
  --dark-bg-tertiary: #262b45;
  --text-light: #f3f4f6;
  --text-muted: #9ca3af;
  --primary-color: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --danger: #f43f5e;
  --info: #3b82f6;
  --warning: #f59e0b;
  --success: #22c55e;
  --border-color: #374151; */
}

/* =============================================================================
 * 2. LAYOUT PRINCIPAL - Vue liste des affrontements
 * =============================================================================
 */
.battles-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.add-battle-container {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
}

.battles-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
}

/* =============================================================================
 * 3. CARTES D'AFFRONTEMENT - Liste des affrontements
 * =============================================================================
 */
.battle-item {
  background-color: var(--dark-bg-secondary);
  color: var(--text-light);
  padding: 12px 15px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 500;
  text-align: center;
  transition: background-color 0.2s, transform 0.1s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
}

.battle-item:hover {
  background-color: var(--dark-bg-tertiary);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.battle-item:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 3.1 Structure de base du contenu de la carte */
.battle-content {
  position: relative;
  width: 100%;
  height: 60px;
  padding: 0;
  margin: 0;
}

/* 3.2 Titre et nom dans la carte */
.battle-content .battle-header {
  text-align: center;
  width: 100%;
  padding: 0;
  margin: 0;
}

.battle-content .battle-name {
  margin: 0;
  padding: 0;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
}

/* 3.3 Score dans la carte */
.battle-content .battle-score {
  width: 100%;
  text-align: center;
  padding: 0;
  margin-top: 5px;
}

/* 3.4 Boutons d'action sur les cartes (Desktop) */
/* a. Conteneur pour les boutons Modifier + CSV */
.battle-btn-stack {
  position: absolute;
  top: 8px;
  right: 100px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 10;
}

/* b. Bouton de modification */
.edit-battle-btn {
  position: static !important;
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--info);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 5px;
}

.edit-battle-btn:hover {
  background-color: rgba(59, 130, 246, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* c. Bouton d'exportation CSV */
.export-battle-csv-btn {
  position: static !important;
  background-color: rgba(34, 197, 94, 0.1);
  color: var(--success, #22c55e);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
}

.export-battle-csv-btn:hover {
  background-color: rgba(34, 197, 94, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* d. Bouton de suppression */
.delete-battle-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background-color: rgba(244, 67, 54, 0.1);
  color: var(--danger);
  border: 1px solid rgba(244, 67, 54, 0.3);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 10;
}

.delete-battle-btn:hover {
  background-color: rgba(244, 67, 54, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 3.5 Conteneur pour les boutons sur mobile (caché sur desktop) */
.battle-actions-container {
  display: none; /* Par défaut invisible, affiché uniquement sur mobile */
}

/* =============================================================================
 * 4. COMPOSANTS DE SCORE
 * =============================================================================
 */
.score-container {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: bold;
}

.score-value {
  padding: 1px 6px;
  min-width: 22px;
  text-align: center;
  border-radius: 4px;
}

.winner-trainer1 {
  color: var(--info);
  background-color: rgba(33, 150, 243, 0.1);
}

.winner-trainer2 {
  color: var(--warning);
  background-color: rgba(255, 152, 0, 0.1);
}

.score-separator {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* =============================================================================
 * 5. BOUTONS ET ACTIONS
 * =============================================================================
 */
/* 5.1 Bouton d'action principal */
.btn-action {
  background-color: var(--primary-color);
  color: var(--text-light);
  font-weight: 600;
  padding: 12px 24px;
  border-radius: 30px;
  border: none;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.2s, transform 0.1s;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-action:hover {
  background-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.btn-action:active {
  background-color: var(--primary-dark);
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 5.2 Variantes de boutons */
.btn-cancel {
  background-color: transparent;
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-cancel:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.btn-submit {
  background-color: var(--primary-color);
  border: none;
  color: var(--text-light);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-submit:hover {
  background-color: var(--primary-light);
}

.btn-back {
  background-color: transparent;
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-back:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* 5.3 Groupe de boutons d'action dans la vue détaillée */
.battle-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 15px;
  margin-bottom: 20px;
}

/* 5.4 Styles pour les boutons d'action spécifiques */
.battle-action-btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.edit-btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
}

.edit-btn:hover {
  background-color: var(--primary-light);
}

.delete-btn {
  background-color: #7f1d1d;
  color: white;
  border: none;
}

.delete-btn:hover {
  background-color: var(--danger);
}

/* =============================================================================
 * 6. FORMULAIRES
 * =============================================================================
 */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 14px;
  color: var(--text-muted);
}

.form-group input, 
.form-group select {
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background-color: var(--dark-bg-primary);
  color: var(--text-light);
}

.form-group input:focus, 
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* =============================================================================
 * 7. MODALES
 * =============================================================================
 */
/* 7.1 Structure de base commune pour toutes les modales */
.battle-modal,
.delete-confirmation-modal,
.fight-modal,
.confirm-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1010;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.battle-modal.active,
.delete-confirmation-modal.active,
.fight-modal.active,
.confirm-modal.active {
  opacity: 1;
  visibility: visible;
}

/* 7.2 Conteneur du contenu de la modale */
.battle-modal-content,
.delete-modal-content,
.fight-modal-content,
.confirm-modal-content {
  background-color: var(--dark-bg-secondary);
  width: 90%;
  max-width: 500px;
  border-radius: 10px;
  padding: 25px;
  color: var(--text-light);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  transform: translateY(20px);
  transition: transform 0.3s;
}

.battle-modal.active .battle-modal-content,
.delete-confirmation-modal.active .delete-modal-content,
.fight-modal.active .fight-modal-content,
.confirm-modal.active .confirm-modal-content {
  transform: translateY(0);
}

/* 7.3 En-têtes des modales */
.battle-modal-header,
.delete-modal-header,
.fight-modal-header,
.confirm-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.battle-modal-title,
.delete-modal-title,
.fight-modal-title,
.confirm-modal-title {
  font-size: 20px;
  font-weight: 600;
}

.battle-modal-close,
.delete-modal-close,
.fight-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
}

/* 7.4 Contenu des modales */
.battle-modal-form,
.fight-modal-body {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.delete-modal-body,
.confirm-modal-body {
  margin-bottom: 25px;
}

/* 7.5 Actions des modales */
.battle-modal-actions,
.delete-modal-actions,
.fight-modal-actions,
.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* =============================================================================
 * 8. RESPONSIVE
 * =============================================================================
 */
/* 8.1 Breakpoint Large (992px) - Adaptation Menu */
@media screen and (max-width: 992px) {
  /* Sur mobile, assurer la compatibilité avec le menu */
  .main-content {
    width: 100%;
  }
  
  /* Adapter les conteneurs pour le mobile */
  .battles-container,
  .battle-details-container {
    max-width: 100%;
    padding: 0 15px;
  }
  
  /* Adapter les modales pour le mobile */
  .battle-modal-content,
  .fight-modal-content,
  .delete-modal-content,
  .confirm-modal-content {
    width: 95%;
    max-width: 95%;
    padding: 15px;
  }
  
  /* Ajuster la taille des textes pour le mobile */
  .battle-modal-title,
  .fight-modal-title,
  .delete-modal-title,
  .confirm-modal-title {
    font-size: 18px;
  }
}

/* 8.2 Breakpoint Medium (768px) - Adaptation Tablette */
@media screen and (max-width: 768px) {
  .battles-container,
  .battle-details-container {
    padding: 0 15px;
  }
  
  .battle-modal-content,
  .delete-modal-content,
  .fight-modal-content,
  .confirm-modal-content {
    width: 95%;
    padding: 20px;
  }
  
  .battle-details-container .battle-title {
    font-size: 18px;
  }
  
  .battle-details-container #back-to-battles-btn {
    padding: 6px 10px;
    font-size: 12px;
  }
  
  /* Ajustements pour les éléments d'en-tête */
  .main-header {
    flex-direction: column;
    align-items: flex-start;
    padding-left: 60px; /* Espace pour le bouton menu */
  }
  
  .main-header h1 {
    margin-bottom: 10px;
  }
  
  /* Style pour les combats */
  .battle-vs-table {
    width: 100%;
    margin: 10px 0;
  }
  
  .trainer-cell {
    font-size: 14px;
    padding: 5px;
  }
  
  .score-value {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  
  .versus-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
  
  /* Adapter la disposition des boutons d'action */
  .add-battle-container,
  .fight-modal-actions,
  .battle-modal-actions,
  .delete-modal-actions,
  .confirm-modal-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  .add-battle-container .btn,
  .fight-modal-actions .btn,
  .battle-modal-actions .btn,
  .delete-modal-actions .btn,
  .confirm-modal-actions .btn {
    width: 100%;
  }
  
  /* Améliorer la lisibilité des boutons sur mobile */
  .btn-action {
    padding: 10px 15px;
    font-size: 15px;
  }
  
  /* Ajuster les cartes d'affrontement sur mobile */
  .battle-item {
    padding: 10px;
  }
  
  .battle-content {
    height: auto;
    min-height: 70px;
  }
  
  /* Retour aux batailles */
  #back-to-battles-btn {
    padding: 6px 12px;
    font-size: 14px;
  }
}

/* 8.3 Breakpoint Small (576px) - Adaptation Mobile */
@media screen and (max-width: 576px) {
  /* Masquer les boutons desktop */
  .battle-btn-stack,
  .battle-item .delete-battle-btn {
    display: none;
  }
  
  /* Augmenter la hauteur de la carte */
  .battle-item .battle-content {
    height: auto;
    min-height: 100px;
    padding-bottom: 45px;
    position: relative;
  }
  
  /* Centrer le titre et le score */
  .battle-content .battle-header,
  .battle-content .battle-score {
    padding-right: 0;
    width: 100%;
    text-align: center;
  }
  
  /* Afficher le conteneur mobile */
  .battle-actions-container {
    position: absolute;
    bottom: 8px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 0 10px;
  }
  
  /* Style commun pour tous les boutons avec largeur égale */
  .mobile-edit-btn,
  .mobile-csv-btn,
  .mobile-delete-btn {
    padding: 5px 0;
    font-size: 12px;
    white-space: nowrap;
    flex: 1;
    max-width: 100px;
    min-width: 80px;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .mobile-edit-btn {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 4px;
  }
  
  .mobile-csv-btn {
    background-color: rgba(34, 197, 94, 0.1);
    color: var(--success, #22c55e);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 4px;
  }
  
  .mobile-delete-btn {
    background-color: rgba(244, 67, 54, 0.1);
    color: var(--danger);
    border: 1px solid rgba(244, 67, 54, 0.3);
    border-radius: 4px;
  }
}

/* 8.4 Breakpoint XSmall (380px) - Petits écrans mobiles */
@media screen and (max-width: 380px) {
  .battle-actions-container {
    padding: 0 5px;
    gap: 5px;
  }
  
  .mobile-edit-btn,
  .mobile-csv-btn,
  .mobile-delete-btn {
    font-size: 11px;
    min-width: 70px;
    padding: 4px 0;
  }
}

/* 8.5 Breakpoint XXSmall (320px) - Très petits écrans */
@media screen and (max-width: 320px) {
  .battle-item .battle-content {
    padding-bottom: 80px;
  }
  
  .battle-actions-container {
    flex-wrap: wrap;
  }
  
  .mobile-edit-btn,
  .mobile-csv-btn,
  .mobile-delete-btn {
    min-width: 90px;
    margin-bottom: 5px;
  }
}