/* =============================================================
   INTERFACE UI - STYLES
   ============================================================= */

/* =============================================================
   STYLE COMPARISON DRAGGABLE HANDLE
   ============================================================= */

.style-comparison-handle {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 2000;
  width: 40px;
  height: 60px;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(20, 20, 30, 0.9));
  border: 2px solid rgba(100, 150, 255, 0.4);
  border-radius: 20px;
  cursor: grab;
  transition: background 0.3s ease, border-color 0.3s ease;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.style-comparison-handle:hover {
  background: linear-gradient(135deg, rgba(20, 20, 40, 0.9), rgba(40, 40, 60, 0.9));
  border-color: rgba(100, 150, 255, 0.6);
  transform: translateY(-50%) translateX(-2px);
}

.style-comparison-handle:active,
.style-comparison-handle.dragging {
  cursor: grabbing;
  background: linear-gradient(135deg, rgba(100, 150, 255, 0.3), rgba(80, 120, 200, 0.4));
  border-color: rgba(100, 150, 255, 0.8);
  transform: translateY(-50%) scale(1.05);
}

.handle-icon {
  font-size: 20px;
  color: rgba(255, 255, 255, 0.8);
  transition: all 0.3s ease;
  pointer-events: none;
}

.style-comparison-handle:hover .handle-icon {
  color: rgba(255, 255, 255, 1);
  transform: scale(1.1);
}

.style-comparison-handle.dragging .handle-icon {
  color: rgba(100, 150, 255, 1);
  transform: scale(1.2);
}

/* Responsive */
@media (max-width: 768px) {
  .style-comparison-handle {
    width: 35px;
    height: 50px;
  }
  
  .handle-icon {
    font-size: 16px;
  }
}

/* Conteneur principal de l'interface */
.game-ui-container {
  position: absolute;
  top: 50%;
  left: 15px;
  transform: translateY(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(20, 20, 30, 0.9));
  border-radius: 25px;
  backdrop-filter: blur(10px);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  animation: slideInLeftUI 0.5s ease-out;
}

/* Boutons de l'interface */
.ui-button {
  position: relative;
  width: 48px;
  height: 48px;
  background: linear-gradient(145deg, #2a2a3a, #1a1a2a);
  border: 2px solid rgba(100, 150, 255, 0.2);
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  /* overflow: hidden; RETIRÉ pour permettre aux badges de dépasser */
  display: flex;
  align-items: center;
  justify-content: center;
}

.ui-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, transparent 0%, rgba(100, 150, 255, 0.1) 100%);
  opacity: 0;
  transition: opacity 0.3s;
}

.ui-button:hover {
  /* PAS de transform pour éviter les sautillements */
  border-color: rgba(100, 150, 255, 0.5);
  box-shadow: 
    0 5px 20px rgba(100, 150, 255, 0.3),
    inset 0 0 20px rgba(100, 150, 255, 0.1);
}

.ui-button:hover::before {
  opacity: 1;
}

.ui-button:active {
  /* PAS de transform non plus pour le clic */
  opacity: 0.9;
}

/* Icônes des boutons */
.ui-button-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  transition: all 0.3s;
  position: relative;
  z-index: 2;
}

.ui-button:hover .ui-button-icon {
  filter: 
    drop-shadow(0 0 10px rgba(100, 150, 255, 0.6))
    drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5))
    brightness(1.2);
}

/* Effet de brillance animé - DÉSACTIVÉ
.ui-button::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 70%
  );
  transform: rotate(45deg) translate(-100%, -100%);
  transition: transform 0.6s;
  pointer-events: none;
  z-index: 1;
}

.ui-button:hover::after {
  transform: rotate(45deg) translate(100%, 100%);
}
*/

/* Labels des boutons (tooltips à droite) */
.ui-button-label {
  position: absolute;
  top: 50%;
  left: 70px;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0;
  transition: all 0.3s;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(100, 150, 255, 0.2);
  backdrop-filter: blur(10px);
}

.ui-button:hover .ui-button-label {
  opacity: 1;
  left: 80px;
}

/* Flèche pointant vers le bouton */
.ui-button-label::before {
  content: '';
  position: absolute;
  top: 50%;
  left: -6px;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 6px solid rgba(0, 0, 0, 0.9);
}

/* Badges de notification */
.ui-notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: linear-gradient(135deg, #ff4757, #ff3838);
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 10px !important;
  font-weight: bold;
  line-height: 1 !important;
  white-space: nowrap;
  text-align: center !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: 0 2px 8px rgba(255, 56, 56, 0.5);
  animation: pulse 2s infinite;
  z-index: 10000; /* Au-dessus du scan-panel (9999) */
}

/* Séparateur horizontal */
.ui-separator {
  width: 40px;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(100, 150, 255, 0.3) 50%, 
    transparent 100%
  );
  margin: 5px 0;
  align-self: center;
}

/* Conteneur de ressources (money) */
.ui-resources {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  background: linear-gradient(145deg, #2a2a3a, #1a1a2a);
  border: 2px solid rgba(255, 215, 0, 0.2);
  border-radius: 15px;
  margin-left: 10px;
}

/* Affichage d'argent autonome en haut à gauche */
.ui-resources-standalone {
  position: fixed;
  top: 95px;
  left: 20px;
  z-index: 1500;
  margin-left: 0;
  backdrop-filter: blur(10px);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 215, 0, 0.1);
  animation: slideInTopLeft 0.5s ease-out;
}

.ui-resources-icon {
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.5));
}

.ui-resources-amount {
  color: #ffd700;
  font-size: 16px;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
  min-width: 60px;
}

.ui-houses-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid rgba(100, 150, 255, 0.2);
}

.ui-houses-title {
  color: #6495ff;
  font-size: 20px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.ui-houses-count {
  font-size: 14px;
  opacity: 0.7;
  margin-left: 8px;
  font-weight: normal;
}

.ui-houses-close {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  color: white;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ui-houses-close:hover {
  background: rgba(255, 100, 100, 0.3);
  border-color: rgba(255, 100, 100, 0.5);
  transform: scale(1.1);
}

/* Panneau de mes maisons */
.ui-houses-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 90%;
  max-width: 1200px;
  height: 80%;
  max-height: 700px;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(20, 20, 30, 0.95));
  border-radius: 20px;
  padding: 25px;
  backdrop-filter: blur(15px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(100, 150, 255, 0.3);
  z-index: 1000;
  display: none;
  transition: all 0.3s ease-out;
  opacity: 0;
}

.ui-houses-panel.active {
  display: block;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.ui-houses-list {
  height: calc(100% - 80px);
  overflow-y: auto;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  padding: 20px !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.ui-houses-counter {
  grid-column: 1 / -1;
  background: rgba(100, 150, 255, 0.1);
  color: #6495ff;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid rgba(100, 150, 255, 0.2);
}

/* === CARTE COMPACTE DE MAISON === */
.ui-house-item-compact {
  background: rgba(40, 40, 60, 0.7) !important;
  border: 2px solid rgba(100, 150, 255, 0.2) !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  cursor: pointer !important;
  backdrop-filter: blur(10px) !important;
}

.ui-house-item-compact:hover {
  background: rgba(50, 50, 70, 0.8) !important;
  border-color: rgba(100, 150, 255, 0.4) !important;
  box-shadow: 0 4px 15px rgba(100, 150, 255, 0.15) !important;
}

/* Vue compacte (toujours visible) */
.ui-house-compact-view {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 12px 15px !important;
  cursor: pointer !important;
  user-select: none !important;
}

.ui-house-icon {
  font-size: 32px !important;
  flex-shrink: 0 !important;
}

.ui-house-info-compact {
  flex: 1 !important;
  min-width: 0 !important;
}

.ui-house-name-compact {
  font-size: 16px !important;
  font-weight: 700 !important;
  color: white !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
  word-wrap: break-word !important;
  line-height: 1.3 !important;
  margin-bottom: 6px !important;
}

.ui-house-meta-compact {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  font-size: 12px !important;
}

/* Badges */
.capacity-badge, .location-badge {
  padding: 4px 8px !important;
  border-radius: 6px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
}

.capacity-badge.capacity-ok {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.2)) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
}

.capacity-badge.capacity-warning {
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.2), rgba(249, 115, 22, 0.2)) !important;
  color: #fb923c !important;
  border: 1px solid rgba(251, 146, 60, 0.3) !important;
}

.capacity-badge.capacity-full {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.2)) !important;
  color: #ef4444 !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
}

.location-badge {
  background: rgba(100, 150, 255, 0.15) !important;
  color: rgba(255, 255, 255, 0.8) !important;
  border: 1px solid rgba(100, 150, 255, 0.2) !important;
}

/* Flèche */
.expand-arrow {
  flex-shrink: 0 !important;
  color: rgba(255, 255, 255, 0.6) !important;
  transition: transform 0.3s ease !important;
}

.expand-arrow svg {
  display: block !important;
  transition: transform 0.3s ease !important;
}

/* Vue détaillée */
.ui-house-expanded-view {
  padding: 0 15px 15px 15px !important;
  display: none !important;
  overflow: hidden !important;
  max-height: 0 !important;
  opacity: 0 !important;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out !important;
}

.ui-house-item-compact.expanded {
  overflow: visible !important;
}

.ui-house-item-compact.expanded .ui-house-expanded-view {
  display: block !important;
  max-height: 500px !important;
  opacity: 1 !important;
}

.ui-house-details-section {
  background: rgba(0, 0, 0, 0.2) !important;
  border-radius: 10px !important;
  padding: 12px !important;
  margin-bottom: 12px !important;
  border: 1px solid rgba(100, 150, 255, 0.1) !important;
}

.ui-house-detail-item {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 8px 0 !important;
  color: rgba(255, 255, 255, 0.9) !important;
  font-size: 13px !important;
}

.ui-house-detail-item:not(:last-child) {
  border-bottom: 1px solid rgba(100, 150, 255, 0.1) !important;
}

.detail-icon {
  font-size: 16px !important;
  flex-shrink: 0 !important;
}

.detail-text {
  flex: 1 !important;
  word-wrap: break-word !important;
}

/* Actions compactes */
.ui-house-actions-compact {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 10px !important;
}

.ui-house-action-btn {
  background: rgba(100, 150, 255, 0.2) !important;
  color: white !important;
  border: 1px solid rgba(100, 150, 255, 0.3) !important;
  border-radius: 8px !important;
  padding: 10px 12px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  backdrop-filter: blur(10px) !important;
}

.ui-house-action-btn:hover {
  background: rgba(100, 150, 255, 0.35) !important;
  border-color: rgba(100, 150, 255, 0.5) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(100, 150, 255, 0.2) !important;
}

.ui-house-action-btn.goto {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.3);
}

.ui-house-action-btn.goto:hover {
  background: rgba(16, 185, 129, 0.3);
  border-color: rgba(16, 185, 129, 0.5);
  color: #6ee7b7;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.ui-house-action-btn.manage {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.3);
}

.ui-house-action-btn.manage:hover {
  background: rgba(245, 158, 11, 0.3);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fbbf24;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.ui-houses-loading, .ui-houses-empty, .ui-houses-error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 15px;
  background: rgba(40, 40, 60, 0.4);
  border: 2px dashed rgba(100, 150, 255, 0.2);
  border-radius: 16px;
}

.ui-houses-empty {
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.6;
  font-size: 14px;
}

.ui-houses-error {
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

/* Animations */
@keyframes slideUpUI {
  from {
    transform: translate(-50%, 100px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

@keyframes slideDownUI {
  from {
    transform: translate(-50%, -100px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

@keyframes slideDownLeftUI {
  from {
    transform: translate(-100px, -100px);
    opacity: 0;
  }
  to {
    transform: translate(0, 0);
    opacity: 1;
  }
}

@keyframes slideInLeftUI {
  from {
    transform: translate(-100px, -50%);
    opacity: 0;
  }
  to {
    transform: translateY(-50%);
    opacity: 1;
  }
}

@keyframes slideInTopLeft {
  from {
    transform: translate(-50px, -50px);
    opacity: 0;
  }
  to {
    transform: translate(0, 0);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(50px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* Effet de particules (optionnel) */
.ui-button.sparkle::before {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  background: white;
  border-radius: 50%;
  animation: sparkle 3s infinite;
  box-shadow: 
    10px 10px 0 rgba(255, 255, 255, 0.3),
    -10px -10px 0 rgba(255, 255, 255, 0.3),
    -10px 10px 0 rgba(255, 255, 255, 0.3),
    10px -10px 0 rgba(255, 255, 255, 0.3);
}

@keyframes sparkle {
  0%, 100% {
    opacity: 0;
    transform: scale(0);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .game-ui-container {
    bottom: 10px;
    padding: 12px;
    gap: 10px;
  }
  
  .ui-button {
    width: 50px;
    height: 50px;
  }
  
  .ui-button-icon {
    width: 32px;
    height: 32px;
  }
  
  .ui-resources {
    padding: 8px 12px;
  }
}

/* Mode sombre pour l'accessibilité */
@media (prefers-color-scheme: light) {
  .game-ui-container {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(240, 240, 250, 0.95));
  }
  
  .ui-button {
    background: linear-gradient(145deg, #ffffff, #f0f0f5);
    border-color: rgba(100, 150, 255, 0.3);
  }
  
  .ui-button-label {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
  }
}

.edit-mode-panel {
  position: fixed;
  top: 80px;
  right: 20px;
  width: 350px;
  max-height: 70vh;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  z-index: 1500;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.edit-mode-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: linear-gradient(135deg, #2196F3, #1976D2);
  color: white;
}

.edit-mode-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.edit-mode-header button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.edit-mode-header button:hover {
  background: rgba(255, 255, 255, 0.3);
}

.edit-mode-tabs {
  display: flex;
  gap: 0;
  background: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
}

.tab-btn {
  flex: 1;
  padding: 12px 16px;
  background: #e9ecef;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #6c757d;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tab-btn:hover {
  background: #dee2e6;
  color: #495057;
}

.tab-btn.active {
  background: white;
  color: #2196F3;
  border-bottom-color: #2196F3;
}

.edit-mode-info {
  padding: 12px 16px;
  background: #E3F2FD;
  border-bottom: 1px solid #BBDEFB;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.edit-mode-info p {
  margin: 0;
  font-size: 13px;
  color: #1565C0;
  flex: 1;
}

.remove-all-decorations-btn {
  padding: 8px 16px;
  background: #FF5722;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.remove-all-decorations-btn:hover {
  background: #E64A19;
}

.edit-mode-decorations-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.decoration-edit-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 8px;
  transition: background 0.2s;
}

.decoration-edit-item:hover {
  background: #e9ecef;
}

.decoration-edit-item img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 4px;
}

.decoration-edit-item span {
  flex: 1;
  font-size: 14px;
  color: #333;
}

.decoration-edit-actions {
  display: flex;
  gap: 6px;
}

.decoration-edit-actions button {
  background: white;
  border: 1px solid #dee2e6;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.decoration-edit-actions button:hover {
  background: #2196F3;
  border-color: #2196F3;
  transform: scale(1.05);
}