/* ========================================
   MODAL TOURNOI - STYLES DÉDIÉS
   ======================================== */

/* Overlay */
.tournoi-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.tournoi-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Modal de base */
.tournoi-modal {
  position: fixed;
  background: white;
  display: flex;
  flex-direction: column;
  z-index: 10000;
  overflow: hidden;
}

/* Handle */
.modal-handle {
  width: 36px;
  height: 4px;
  background: #d0d0d0;
  border-radius: 4px;
  margin: 10px auto 6px;
  flex-shrink: 0;
}

/* Bouton fermer */
.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #f0f0f0;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  z-index: 10;
}

.modal-close:hover {
  background: #e0e0e0;
  color: #333;
}

/* Header */
.modal-header {
  padding: 0 16px 10px;
  flex-shrink: 0;
  text-align: center;
}

.modal-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #222;
  margin: 0 0 6px 0;
  line-height: 1.25;
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  font-size: 0.75rem;
  color: #777;
}

.modal-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.modal-meta i {
  color: #6B5BFF;
  font-size: 0.8rem;
}

/* Contenu scrollable */
.modal-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px 16px 20px;
  -webkit-overflow-scrolling: touch;
}

/* Carte */
.modal-map-container {
  width: 100%;
  height: 160px;
  border-radius: 12px;
  overflow: hidden;
  margin: 0 auto 12px auto;
}

.modal-map-container #modal-map {
  height: 100%;
  width: 100%;
}

/* Adresse */
.modal-address {
  background: #f8f9ff;
  padding: 12px 14px;
  border-radius: 10px;
  margin: 0 auto 12px auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}

.modal-address i {
  color: #6B5BFF;
  font-size: 1.2rem;
}

.modal-address-text {
  text-align: center;
}

.modal-address-text .address-main {
  font-weight: 600;
  color: #222;
  font-size: 0.95rem;
}

.modal-address-text .address-city {
  font-size: 0.85rem;
  color: #666;
  margin-top: 2px;
}

/* Affiche preview */
.modal-affiche {
  margin: 0 auto 12px auto;
}

.modal-affiche-preview {
  background: rgba(107, 91, 255, 0.06);
  border: 1.5px dashed #6B5BFF;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #6B5BFF;
  font-weight: 600;
  font-size: 0.85rem;
}

.modal-affiche-preview i {
  font-size: 1rem;
}

/* Description */
.modal-description {
  background: #fafafa;
  padding: 12px 14px;
  border-radius: 10px;
  color: #555;
  line-height: 1.5;
  font-size: 0.85rem;
  text-align: center;
  margin: 0 auto;
}

/* Actions */
.modal-actions {
  padding: 12px 20px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid #eee;
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  background: white;
}

.modal-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  flex: 1;
}

.modal-btn-primary {
  background: #6B5BFF;
  color: white;
}

.modal-btn-primary:hover {
  background: #5548d6;
}

.modal-btn-secondary {
  background: #f0f0f0;
  color: #333;
}

.modal-btn-secondary:hover {
  background: #e0e0e0;
}

/* ========================================
   MOBILE - Modal slide du bas
   ======================================== */
@media (max-width: 768px) {
  .tournoi-modal-overlay {
    display: flex;
    align-items: flex-end;
  }
  
  .tournoi-modal {
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    max-height: 75vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .tournoi-modal-overlay.active .tournoi-modal {
    transform: translateY(0);
  }
  
  .modal-handle {
    display: block;
  }
}

/* ========================================
   DESKTOP - Modal centrée
   ======================================== */
@media (min-width: 769px) {
  .tournoi-modal-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .tournoi-modal {
    position: relative;
    max-width: 480px;
    width: 90%;
    max-height: 85vh;
    border-radius: 16px;
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  }
  
  .tournoi-modal-overlay.active .tournoi-modal {
    transform: scale(1);
    opacity: 1;
  }
  
  .modal-handle {
    display: none;
  }
  
  .modal-close {
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
  }
  
  .modal-header {
    padding: 16px 20px 12px;
    text-align: center;
  }
  
  .modal-header h2 {
    font-size: 1.2rem;
  }
  
  .modal-meta {
    font-size: 0.8rem;
    gap: 12px;
  }
  
  .modal-content {
    padding: 12px 20px 16px;
  }
  
  .modal-map-container {
    height: 180px;
    margin-bottom: 12px;
    border-radius: 10px;
  }
  
  .modal-address {
    padding: 12px 14px;
    margin-bottom: 12px;
  }
  
  .modal-affiche {
    margin-bottom: 12px;
  }
  
  .modal-affiche-preview {
    padding: 12px;
    font-size: 0.85rem;
  }
  
  .modal-description {
    padding: 12px 14px;
    font-size: 0.85rem;
  }
  
  .modal-actions {
    padding: 12px 20px;
  }
  
  .modal-btn {
    padding: 12px 20px;
    font-size: 0.9rem;
  }
}
