/* =============================================================
   MODAL CORE - Éléments de base pour toutes les modales
   ============================================================= */

/* Animations de base */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Overlay de la modal */
.house-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-out;
}

.house-modal-overlay.active {
  display: flex;
}

/* Conteneur principal de la modal */
.house-modal {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(20, 20, 30, 0.95));
  border-radius: 20px;
  backdrop-filter: blur(15px);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  overflow: visible; /* Permet aux tooltips de dépasser */
  animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid rgba(100, 150, 255, 0.3);
  color: white;
}

/* Contenu des modales - texte lisible sur fond sombre */
.house-modal p,
.house-modal div,
.house-modal span,
.house-modal label {
  color: rgba(255, 255, 255, 0.9);
}

.house-modal h1,
.house-modal h2,
.house-modal h3,
.house-modal h4,
.house-modal h5,
.house-modal h6 {
  color: white;
}

/* Header de la modal */
.house-modal-header {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(20, 20, 30, 0.95));
  color: white;
  padding: 20px 25px;
  position: relative;
  backdrop-filter: blur(15px);
  border-bottom: 2px solid rgba(100, 150, 255, 0.3);
  border-radius: 20px 20px 0 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.house-modal-title-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.house-modal-title {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.house-modal-subtitle {
  margin: 5px 0 0 0;
  font-size: 14px;
  opacity: 0.9;
  font-weight: 300;
}

.house-modal-close {
  position: absolute;
  top: 20px;
  right: 25px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.house-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* Navigation par onglets */
.house-modal-tabs {
  display: flex;
  background: rgba(100, 150, 255, 0.05);
  border-bottom: 1px solid rgba(100, 150, 255, 0.1);
}

.house-modal-tab {
  flex: 1;
  padding: 15px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 3px solid transparent;
}

.house-modal-tab:hover {
  background: rgba(100, 150, 255, 0.08);
  color: #333;
}

.house-modal-tab.active {
  color: #667eea;
  background: rgba(100, 150, 255, 0.1);
  border-bottom-color: #667eea;
}

.house-modal-tab-icon {
  margin-right: 8px;
  font-size: 16px;
}

/* Contenu de la modal */
.house-modal-content {
  padding: 0;
  min-height: 400px;
  max-height: calc(85vh - 200px);
  overflow-y: auto;
}

.house-modal-tab-content {
  display: none;
  padding: 25px;
  animation: fadeInUp 0.3s ease-out;
}

.house-modal-tab-content.active {
  display: block;
}

/* Styles pour les inputs de renommage */
.house-rename-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s;
  color: white;
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  opacity: 0.8;
}

.house-rename-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
  opacity: 1;
  transform: scale(1.05);
}

.house-rename-input {
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 22px;
  font-weight: 600;
  color: #333;
  min-width: 250px;
  max-width: 350px;
  outline: none;
  transition: all 0.3s;
  text-shadow: none;
}

.house-rename-input:focus {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.4);
}

/* Scrollbar personnalisée pour les modales */
.house-modal-content::-webkit-scrollbar {
  width: 8px;
}

.house-modal-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.house-modal-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

.house-modal-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* États de chargement */
.modal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  color: rgba(255, 255, 255, 0.7);
}

.modal-loading::after {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 8px;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .house-modal {
    width: 95%;
    margin: 20px;
    max-height: 90vh;
  }
  
  .house-modal-header {
    padding: 12px 20px;
  }
  
  .house-modal-title {
    font-size: 18px;
  }
  
  .house-modal-close {
    top: 12px;
    right: 20px;
    width: 36px;
    height: 36px;
  }
  
  .house-modal-tab {
    padding: 12px 8px;
    font-size: 12px;
  }
  
  .house-modal-tab-content {
    padding: 20px;
  }
}