/* Styles spécifiques pour la page "Mon Île" */

/* === LAYOUT PRINCIPAL === */
.island-manager {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* === HEADER === */
.island-header {
  flex-shrink: 0;
}

/* === VIEWER PRINCIPAL === */
.island-viewer {
  flex: 1;
  min-height: 0; /* Important pour le flex */
  position: relative;
}

#bluemap-container {
  position: absolute;
  inset: 0;
}

#bluemap-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* === PANEL BÂTIMENTS === */
.building-panel {
  flex-shrink: 0;
}

/* Scrollbar personnalisé pour le panel */
.buildings-grid::-webkit-scrollbar {
  height: 8px;
}

.buildings-grid::-webkit-scrollbar-track {
  background: rgba(88, 28, 135, 0.3);
  border-radius: 4px;
}

.buildings-grid::-webkit-scrollbar-thumb {
  background: linear-gradient(to right, #7c3aed, #a855f7);
  border-radius: 4px;
}

.buildings-grid::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to right, #8b5cf6, #c084fc);
}

/* === CARTES BÂTIMENTS === */
.building-card {
  transition: all 0.2s ease;
}

.building-card.selected {
  border-color: #a855f7 !important;
  background: rgba(139, 92, 246, 0.3) !important;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
}

.building-card:active {
  transform: scale(0.95);
}

/* === PREVIEW BÂTIMENT (Three.js) === */
.building-preview-valid {
  background: rgba(34, 197, 94, 0.5);
  border: 2px solid #22c55e;
}

.building-preview-invalid {
  background: rgba(239, 68, 68, 0.5);
  border: 2px solid #ef4444;
}

/* === GRILLE MOCK (mode développement) === */
.mock-viewer .mock-grid-cell {
  transition: all 0.15s ease;
}

.mock-viewer .mock-grid-cell:hover {
  transform: scale(1.1);
  z-index: 10;
}

.mock-viewer .mock-grid-cell.preview {
  animation: pulse-preview 1s ease-in-out infinite;
}

@keyframes pulse-preview {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.7);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(168, 85, 247, 0);
  }
}

/* === TOAST NOTIFICATIONS === */
.toast {
  min-width: 300px;
}

.toast.success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
}

.toast.error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.toast.info {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: white;
}

.toast.visible {
  transform: translateX(0);
  opacity: 1;
}

/* === ANIMATIONS === */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.animate-fade-in-up {
  animation: fadeInUp 0.3s ease forwards;
}

.animate-fade-out-down {
  animation: fadeOutDown 0.3s ease forwards;
}

/* === LOADING OVERLAY === */
.loading-overlay {
  transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* === BOUTONS D'ACTION === */
.placement-actions button {
  transition: all 0.2s ease;
}

.placement-actions button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.placement-actions button:active {
  transform: translateY(0);
}

/* === ONGLETS CATÉGORIES === */
.category-tabs .tab {
  transition: all 0.2s ease;
}

.category-tabs .tab:not(.active):hover {
  background: rgba(124, 58, 237, 0.3);
}

.category-tabs .tab.active {
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .island-header {
    padding: 0 1rem;
  }

  .island-header h1 {
    font-size: 1rem;
  }

  .island-header .island-rank {
    font-size: 0.75rem;
    padding: 2px 8px;
  }

  .building-panel {
    height: 160px;
  }

  .building-card {
    width: 100px;
    padding: 8px;
  }

  .building-card .building-icon {
    height: 36px;
    font-size: 1.5rem;
  }

  .building-card .building-name {
    font-size: 0.65rem;
  }

  .placement-actions {
    bottom: 180px;
    flex-direction: column;
  }

  .placed-buildings {
    display: none;
  }
}

@media (max-width: 480px) {
  .island-header {
    flex-direction: column;
    height: auto;
    padding: 0.5rem 1rem;
    gap: 0.5rem;
  }

  .category-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .category-tabs .tab {
    flex-shrink: 0;
    font-size: 0.75rem;
    padding: 6px 12px;
  }
}

/* === BlueMap Override === */
/* Cache les contrôles BlueMap par défaut si besoin */
.bluemap-app .controls {
  /* display: none; */
}

/* S'assurer que le canvas BlueMap prend toute la place */
.bluemap-app {
  width: 100% !important;
  height: 100% !important;
}
