/* =============================================================
   PLAYER SEARCH MODAL - Recherche de maisons de joueurs
   ============================================================= */

/* Conteneur principal de la modal */
.custom-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999999999;
  display: none;
  align-items: center;
  justify-content: center;
}

.custom-modal.active {
  display: flex !important;
}

/* Overlay sombre */
.custom-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1;
}

/* Contenu de la modal */
.custom-modal-content {
  position: relative;
  z-index: 2;
  border-radius: 20px;
  overflow: hidden;
  animation: slideUpModal 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Header de la modal */
.custom-modal-header {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(20, 20, 30, 0.95));
  color: white;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid rgba(100, 150, 255, 0.3);
}

.custom-modal-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  color: white;
}

/* Bouton de fermeture */
.custom-modal-close {
  background: rgba(255, 100, 100, 0.2);
  border: 2px solid rgba(255, 100, 100, 0.3);
  color: white;
  font-size: 28px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  line-height: 1;
  padding: 0;
}

.custom-modal-close:hover {
  background: rgba(255, 100, 100, 0.4);
  border-color: rgba(255, 100, 100, 0.6);
  transform: rotate(90deg);
}

/* Body de la modal */
.custom-modal-body {
  padding: 24px;
}

/* Animation */
@keyframes slideUpModal {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Contenu spécifique à la recherche de joueurs */
.player-search-modal-content {
  width: 95%;
  max-width: 1200px;
  max-height: 85vh;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.95), rgba(20, 20, 30, 0.98));
  border: 2px solid rgba(100, 150, 255, 0.3);
  backdrop-filter: blur(20px);
}

/* Onglets */
.search-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid rgba(100, 150, 255, 0.2);
}

.search-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 14px 20px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-bottom: 3px solid transparent;
  position: relative;
  bottom: -2px;
}

.search-tab:hover {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(100, 150, 255, 0.1);
}

.search-tab.active {
  color: white;
  border-bottom-color: rgba(100, 150, 255, 1);
  background: rgba(100, 150, 255, 0.15);
}

.tab-icon {
  font-size: 18px;
}

.tab-label {
  font-weight: 600;
}

/* Contenu de recherche */
.search-content {
  position: relative;
}

.search-panel {
  display: none;
  margin-bottom: 24px;
}

.search-panel.active {
  display: block;
}

/* Groupe d'input */
.search-input-group {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}

/* Filtres */
.search-filters {
  padding: 12px 0;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.filter-checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #667eea;
}

.checkbox-label {
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-weight: 500;
}

/* Wrapper pour l'autocomplétion */
.autocomplete-wrapper {
  flex: 1;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(100, 150, 255, 0.3);
  border-radius: 12px;
  color: white;
  font-size: 15px;
  transition: all 0.3s ease;
  outline: none;
}

.search-input:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(100, 150, 255, 0.6);
  box-shadow: 0 0 20px rgba(100, 150, 255, 0.3);
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* Autocomplétion */
.autocomplete-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.95), rgba(20, 20, 30, 0.98));
  border: 2px solid rgba(100, 150, 255, 0.3);
  border-radius: 12px;
  max-height: 250px;
  overflow-y: auto;
  display: none;
  z-index: 1000;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.autocomplete-results.active {
  display: block;
}

.autocomplete-item {
  padding: 12px 16px;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid rgba(100, 150, 255, 0.1);
  font-size: 14px;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
  background: rgba(100, 150, 255, 0.2);
  color: white;
}

.autocomplete-item-main {
  font-weight: 600;
  margin-bottom: 4px;
}

.autocomplete-item-details {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.autocomplete-loading {
  padding: 16px;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

.search-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: 2px solid rgba(100, 150, 255, 0.4);
  border-radius: 12px;
  color: white;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.search-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(100, 150, 255, 0.4);
}

.search-btn:disabled {
  background: rgba(80, 80, 100, 0.5);
  cursor: not-allowed;
  opacity: 0.6;
}

.search-btn-icon {
  font-size: 20px;
}

/* Container des résultats */
.player-search-results {
  min-height: 300px;
  max-height: 450px;
  overflow-y: auto;
  padding-right: 8px;
  display: block !important;
  position: relative !important;
}

/* Scrollbar personnalisée */
.player-search-results::-webkit-scrollbar {
  width: 8px;
}

.player-search-results::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.player-search-results::-webkit-scrollbar-thumb {
  background: rgba(100, 150, 255, 0.3);
  border-radius: 4px;
}

.player-search-results::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 150, 255, 0.5);
}

/* État loading */
.search-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 20px;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(100, 150, 255, 0.2);
  border-top-color: rgba(100, 150, 255, 0.8);
  border-radius: 50%;
  animation: spinLoader 1s linear infinite;
}

@keyframes spinLoader {
  to { transform: rotate(360deg); }
}

.search-loading p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 16px;
  margin: 0;
}

/* État error */
.search-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
  text-align: center;
}

.error-icon {
  font-size: 48px;
}

.search-error p {
  color: rgba(255, 100, 100, 0.9);
  font-size: 16px;
  margin: 0;
}

/* État empty */
.search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 12px;
  text-align: center;
}

.empty-icon {
  font-size: 64px;
  opacity: 0.5;
}

.search-empty p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.search-empty small {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
}

/* Header des résultats */
.search-results-header {
  background: rgba(100, 150, 255, 0.15);
  border: 1px solid rgba(100, 150, 255, 0.3);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
}

.search-results-header strong {
  color: rgba(100, 150, 255, 1);
  font-weight: 700;
}

/* Liste des résultats */
.search-results-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

/* Item de résultat */
.search-result-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(100, 150, 255, 0.2);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.search-result-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(100, 150, 255, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(100, 150, 255, 0.2);
}

.result-icon {
  width: 100%;
  height: 60px;
  flex-shrink: 0;
  background: rgba(100, 150, 255, 0.1);
  border: 2px solid rgba(100, 150, 255, 0.3);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.result-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.result-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.result-house-name {
  font-size: 13px;
  font-weight: 700;
  color: white;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-owner {
  font-size: 11px;
  color: rgba(100, 200, 255, 0.9);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-address {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-residents {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  gap: 4px;
}

.result-actions {
  flex-shrink: 0;
  width: 100%;
  margin-top: auto;
}

/* Bouton "Y aller" */
.btn-go-to-house {
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  border: 2px solid rgba(76, 175, 80, 0.5);
  border-radius: 8px;
  padding: 8px 12px;
  color: white;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  width: 100%;
}

.btn-go-to-house:hover {
  background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.btn-go-to-house .btn-icon {
  font-size: 16px;
}

/* Responsive */
@media (max-width: 768px) {
  .player-search-modal-content {
    width: 95%;
    max-height: 90vh;
  }

  .search-input-container {
    flex-direction: column;
  }

  .search-btn {
    width: 100%;
    justify-content: center;
  }

  .search-result-item {
    flex-direction: column;
    text-align: center;
  }

  .result-icon {
    width: 80px;
    height: 80px;
  }

  .result-info {
    align-items: center;
  }

  .btn-go-to-house {
    width: 100%;
    justify-content: center;
  }
}
