/* =============================================================
   STYLES CLASSEUR DE CARTES À COLLECTIONNER
   ============================================================= */

/* Modal du classeur */
.cards-binder-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.cards-binder-modal.cards-binder-show {
  opacity: 1;
  visibility: visible;
}

/* Titre compact en une ligne */
.cards-header-compact {
  text-align: center;
  color: #f4e4bc;
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  z-index: 10002;
}

.cards-header-compact #cardsProgress {
  color: #d4af37;
}

/* Navigation en bas - Layout en 3 colonnes */
.cards-navigation-bottom {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-top: 15px;
  padding: 0 20px;
  min-height: 50px;
  gap: 20px;
  z-index: 10002;
}

/* Groupes de boutons */
.cards-nav-left-group {
  display: flex;
  gap: 8px;
  justify-self: start;
}

.cards-nav-right-group {
  display: flex;
  gap: 8px;
  justify-self: end;
}

.cards-navigation-bottom .cards-page-indicator {
  justify-self: center;
  color: #f4e4bc;
  font-size: 22px; /* 🔧 Agrandi de 16px à 22px */
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9); /* 🔧 Ombre plus visible */
  white-space: nowrap;
  padding: 8px 16px; /* 🔧 Plus d'espace autour du texte */
  background: rgba(0, 0, 0, 0.4); /* 🔧 Fond semi-transparent pour meilleure visibilité */
  border-radius: 8px;
  backdrop-filter: blur(5px); /* 🔧 Flou d'arrière-plan */
}

/* Boutons première/dernière page - Plus petits */
.cards-nav-first,
.cards-nav-last {
  padding: 10px 12px !important;
  font-size: 18px !important;
  min-width: auto !important;
}

/* Conteneur principal du classeur - Maximisé */
.cards-binder-container {
  position: relative;
  width: 98vw;
  max-width: 1800px;
  height: 80vh;
  max-height: 900px;
  background: linear-gradient(145deg, #580870, #633579);
  border: 3px solid #87138b;
  border-radius: 15px;
  box-shadow: 
    0 0 30px rgba(114, 31, 190, 0.5),
    inset 0 0 20px rgba(0, 0, 0, 0.3);
  padding: 15px;
  display: flex;
  flex-direction: column;
  transform: scale(0.8);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.cards-binder-modal.cards-binder-show .cards-binder-container {
  transform: scale(1);
}

/* Bouton de fermeture */
.cards-binder-close {
  position: absolute;
  top: 15px;
  right: 20px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10001;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.cards-binder-close:hover {
  background: #c82333;
  transform: scale(1.1);
}

/* Anciens styles de titre et navigation (conservés pour compatibilité) */
.cards-binder-title {
  text-align: center;
  color: #f4e4bc;
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 8px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  line-height: 1.2;
}

.cards-binder-progress {
  font-size: 14px;
  color: #d4af37;
  margin-top: 3px;
}

/* Navigation (ancienne version) */
.cards-binder-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding: 0 15px;
  flex-shrink: 0;
}

.cards-nav-btn {
  background: linear-gradient(145deg, #444, #333);
  color: #f0f0f0;
  border: 2px solid #555;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

.cards-nav-btn:hover:not(:disabled) {
  background: linear-gradient(145deg, #555, #444);
  transform: translateY(-2px);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.6);
  border-color: #666;
}

.cards-nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Ancien style - remplacé par .cards-navigation-bottom .cards-page-indicator */

/* Contenu du classeur - parfaitement centré */
.cards-binder-content {
  flex: 1;
  position: relative;
  padding: 5px 10px; /* Padding réduit */
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
}

/* Animation de tournage de page */
.cards-binder-content.page-turn-left {
  transform: rotateY(-10deg);
}

.cards-binder-content.page-turn-right {
  transform: rotateY(10deg);
}

/* Pages du classeur - StPageFlip compatible */
.cards-page {
  background: linear-gradient(145deg, #2a2a2a, #1e1e1e);
  border: 3px solid #444;
  border-radius: 10px;
  padding: 15px;
  box-shadow: 
    0 5px 15px rgba(0, 0, 0, 0.5),
    inset 0 0 10px rgba(68, 68, 68, 0.3);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  box-sizing: border-box;
}

.cards-page::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(90deg, transparent 49.5%, rgba(255, 255, 255, 0.05) 50%, transparent 50.5%),
    linear-gradient(0deg, transparent 49.5%, rgba(255, 255, 255, 0.02) 50%, transparent 50.5%);
  background-size: 40px 40px;
  pointer-events: none;
}

/* Reliure centrale */
.cards-binder-spine {
  width: 30px;
  background: linear-gradient(145deg, #654321, #8b4513);
  border: 2px solid #4a2c17;
  border-radius: 5px;
  position: relative;
  box-shadow: 
    inset 0 0 10px rgba(0, 0, 0, 0.5),
    0 0 10px rgba(0, 0, 0, 0.3);
}

.cards-binder-spine::before,
.cards-binder-spine::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  background: #2c1810;
  border-radius: 50%;
  box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.8);
}

.cards-binder-spine::before {
  top: 20%;
}

.cards-binder-spine::after {
  bottom: 20%;
}

/* Numéros de page externes - coins de la couverture */
.cards-page-numbers {
  position: absolute;
  bottom: 15px;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 10;
}

.cards-page-number-left {
  position: absolute;
  bottom: 0;
  left: 15px;
  color: #888;
  font-size: 14px;
  font-weight: bold;
  opacity: 0.7;
}

.cards-page-number-right {
  position: absolute;
  bottom: 0;
  right: 15px;
  color: #888;
  font-size: 14px;
  font-weight: bold;
  opacity: 0.7;
}

/* Anciens numéros de page dans les pages - cachés */
.cards-page-number {
  display: none;
}

/* Grille de cartes - 4x3 taille normale */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 15px;
  flex: 1;
  padding: 5px 15px 15px 15px; /* Moins de padding haut, plus de padding bas */
  height: 100%;
  min-height: 500px; /* Plus de hauteur pour vraie taille cartes */
}

/* Emplacement de carte */
.card-slot {
  aspect-ratio: 596/841;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  width: 100%;
  height: 100%;
  z-index: 10; /* Au-dessus des contrôles StPageFlip */
}

/* Cartes possédées - isolation des clics */
.card-slot.card-owned {
  pointer-events: auto;
  position: relative;
  z-index: 15; /* Priorité sur StPageFlip */
}

.card-slot:hover {
  transform: scale(1.05);
  z-index: 10;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
}

/* Carte possédée */
.card-slot.card-owned {
  background: #fff;
  border: 3px solid #d4af37;
  cursor: pointer;
  transition: all 0.3s ease;
}

.card-slot.card-owned:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
  border-color: #ffd700;
}

.card-slot.card-owned .card-image {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.card-slot.card-owned .card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Badge numéro de carte */
.card-number-badge {
  position: absolute;
  top: 5px;
  left: 5px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 10px;
  border: 1px solid #333;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  z-index: 2;
}

.card-slot.card-owned .card-info {
  display: none;
}

.card-slot.card-owned .card-name {
  display: none;
}

/* Emplacement vide */
.card-slot.card-empty {
  background: rgba(255, 255, 255, 0.1);
  border: 3px dashed;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-slot.card-empty.card-rarity-common {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.card-slot.card-empty.card-rarity-uncommon {
  border-color: #28a745;
  background: rgba(40, 167, 69, 0.1);
}

.card-slot.card-empty.card-rarity-rare {
  border-color: #007bff;
  background: rgba(0, 123, 255, 0.1);
}

.card-slot.card-empty.card-rarity-epic {
  border-color: #6f42c1;
  background: rgba(111, 66, 193, 0.1);
}

.card-slot.card-empty.card-rarity-mythic {
  border-color: #dc3545;
  background: rgba(220, 53, 69, 0.1);
}

.card-placeholder {
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
}

.card-number {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 8px;
}

/* Raretés - Cachées pour les cartes possédées */
.card-slot.card-owned .card-rarity {
  display: none;
}

.card-rarity {
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  padding: 2px 4px;
  border-radius: 3px;
}

.card-rarity-common {
  background: #ffffff;
  color: #000;
}

.card-rarity-uncommon {
  background: #28a745;
  color: #fff;
}

.card-rarity-rare {
  background: #007bff;
  color: #fff;
}

.card-rarity-epic {
  background: #6f42c1;
  color: #fff;
}

.card-rarity-mythic {
  background: #dc3545;
  color: #fff;
}

/* Responsive */
@media (max-height: 900px) {
  .cards-binder-container {
    height: 75vh;
    max-height: 650px;
    padding: 10px;
  }
  
  .cards-header-compact {
    font-size: 18px;
    margin-bottom: 8px;
  }
  
  .cards-navigation-bottom {
    margin-top: 10px;
    padding: 0 15px;
    gap: 15px;
  }
  
  .cards-nav-left-group,
  .cards-nav-right-group {
    gap: 6px;
  }
  
  .cards-navigation-bottom .cards-page-indicator {
    font-size: 18px; /* 🔧 Agrandi même en responsive */
    padding: 6px 12px;
  }
  
  .cards-binder-content {
    gap: 10px;
    padding: 5px;
  }
  
  .cards-page {
    padding: 10px;
  }
  
  .cards-grid {
    gap: 10px;
    padding: 8px;
  }
}

@media (max-width: 1200px) {
  .cards-binder-container {
    width: 98vw;
    height: 75vh;
    max-height: 600px;
    padding: 12px;
  }
  
  .cards-header-compact {
    font-size: 18px;
  }
  
  .cards-navigation-bottom {
    gap: 15px;
  }
  
  .cards-nav-left-group,
  .cards-nav-right-group {
    gap: 6px;
  }
  
  .cards-navigation-bottom .cards-page-indicator {
    font-size: 18px; /* 🔧 Agrandi même en responsive */
    padding: 6px 12px;
  }
  
  .cards-grid {
    gap: 10px;
    padding: 8px;
  }
  
  .cards-page {
    padding: 12px;
  }
}

@media (max-width: 768px) {
  .cards-binder-container {
    height: 70vh;
    max-height: 500px;
  }
  
  .cards-header-compact {
    font-size: 16px;
    margin-bottom: 8px;
  }
  
  .cards-navigation-bottom {
    padding: 0 10px;
    margin-top: 10px;
    gap: 10px;
  }
  
  .cards-nav-left-group,
  .cards-nav-right-group {
    gap: 4px;
  }
  
  .cards-nav-first,
  .cards-nav-last {
    padding: 6px 8px !important;
    font-size: 14px !important;
  }
  
  .cards-navigation-bottom .cards-page-indicator {
    font-size: 16px; /* 🔧 Agrandi même sur mobile */
    padding: 5px 10px;
  }
  
  .cards-nav-btn {
    padding: 6px 12px;
    font-size: 14px;
  }
  
  .cards-grid {
    gap: 8px;
    padding: 6px;
  }
  
  .cards-page {
    padding: 8px;
  }
  
  .cards-binder-spine {
    width: 20px;
  }
}