/* === MODAL DECK SELECTION === */

/* === FIX URGENTE - FORZA VISIBILITÀ MODAL === */
#deckModalOverlay {
  display: none !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
  background: rgba(0, 0, 0, 0.95) !important;
  backdrop-filter: blur(8px) !important;
}

#deckModalOverlay.show {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

/* Container principale */
.deck-modal-container {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 20px;
  padding: 2rem;
  max-width: 1400px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.1);
  position: relative;
  pointer-events: auto;  /* ← IMPORTANTE: container deve ricevere click */
}

/* Header */
.deck-modal-header {
  text-align: center;
  margin-bottom: 2rem;
}

.deck-modal-header h2 {
  font-size: 2.5rem;
  color: #fff;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.deck-modal-header p {
  color: #aaa;
  font-size: 1.1rem;
}

/* Grid deck */
.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

/* Singola carta deck */
.deck-card {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 1.5rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: visible;  /* ← CAMBIATO da hidden */
  z-index: 1;
}

.deck-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.05));
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;  /* ← IMPORTANTE: non bloccare click */
}

.deck-card:hover {
  transform: translateY(-8px);
  border-color: var(--deck-color);
  box-shadow: 0 8px 24px var(--deck-color);
  z-index: 5;
}

.deck-card:hover::before {
  opacity: 1;
}

/* Header carta deck */
.deck-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.deck-icon {
  font-size: 2rem;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.deck-card-title h3 {
  font-size: 1.4rem;
  color: #fff;
  margin: 0 0 0.3rem 0;
  font-weight: 700;
}

.deck-card-title p {
  font-size: 0.9rem;
  color: #999;
  margin: 0;
}

/* Stats deck */
.deck-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
}

.deck-stat {
  text-align: center;
}

.deck-stat-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.deck-stat-label {
  display: block;
  font-size: 0.75rem;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Preview carte */
.deck-preview {
  margin: 1.5rem 0;
}

.deck-preview-label {
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.deck-preview-cards {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ⭐ CORREZIONE: Preview card piccole */
.deck-preview-card {
  width: 60px;
  height: 84px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.deck-preview-card:hover {
  transform: scale(1.15);
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.deck-preview-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;  /* ← CORRETTO: contain invece di cover */
  display: block;
}

/* Bottone seleziona */
.deck-select-btn {
  width: 100%;
  padding: 1rem;
  background: var(--deck-color);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer !important;  /* ← FORZATO */
  pointer-events: auto !important;  /* ← FORZATO */
  margin-top: 1rem;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  z-index: 10;  /* ← ASSICURA CHE SIA SOPRA */
}

.deck-select-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 20px var(--deck-color);
  filter: brightness(1.1);
  cursor: pointer !important;  /* ← FORZATO ANCHE SU HOVER */
}

.deck-select-btn:active {
  transform: scale(0.98);
}

/* Sezione custom deck builder */
.deck-custom-section {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.deck-custom-btn {
  padding: 1rem 2rem;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: not-allowed;
  opacity: 0.5;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
}

.deck-custom-btn.enabled {
  cursor: pointer;
  opacity: 1;
}

.deck-custom-btn.enabled:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.deck-custom-badge {
  display: inline-block;
  background: #f59e0b;
  color: #000;
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  margin-left: 0.5rem;
  font-weight: 700;
}

/* Bottone chiudi */
.deck-modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.deck-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .deck-modal-container {
    padding: 1.5rem;
    max-height: 95vh;
  }
  
  .deck-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .deck-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
  
  .deck-modal-header h2 {
    font-size: 1.8rem;
  }
  
  .deck-preview-cards {
    gap: 0.4rem;
  }
  
  .deck-preview-card {
    width: 50px;
    height: 70px;
  }
  
  .deck-icon {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
  }
  
  .deck-card-title h3 {
    font-size: 1.2rem;
  }
}

/* Animazioni */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.deck-card {
  animation: slideUp 0.4s ease backwards;
}

.deck-card:nth-child(1) { animation-delay: 0.1s; }
.deck-card:nth-child(2) { animation-delay: 0.2s; }
.deck-card:nth-child(3) { animation-delay: 0.3s; }
.deck-card:nth-child(4) { animation-delay: 0.4s; }

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
