/* [21-neighborhood-slots] Parcelles du quartier (losanges au sol) */
/* ==========================================================================
   PARCELLES DU QUARTIER (GROUND SLOTS DIRECTEMENT AU SOL)
   ========================================================================== */
.neighborhood-ground-slot {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
  pointer-events: auto !important;
  z-index: 15;
  transition: transform 0.18s ease, filter 0.18s ease;
}

/* 0. Terrain vague dessiné par le jeu sous la parcelle (quartiers en drawLots) */
.neighborhood-lot-ground {
  position: absolute;
  width: 112px;
  height: 76px;
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: none;
  user-select: none;
}

/* 1. Parcelles Isométriques au Sol (Losanges SVG) */
.neighborhood-ground-slot.slot-locked,
.neighborhood-ground-slot.slot-empty {
  width: 86px;
  height: 56px;
}

.ground-lot-surface.diamond-surface {
  /* Rotation et taille réglées par l'éditeur de cartes (variables posées par views/render.js) */
  rotate: var(--slot-rot, 0deg);
  scale: var(--slot-scale, 1);
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.slot-diamond-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.9));
  overflow: visible;
}

/* Losange Verrouillé */
.neighborhood-ground-slot.slot-locked .diamond-polygon {
  fill: rgba(13, 11, 9, 0.72);
  stroke: rgba(183, 133, 67, 0.65);
  stroke-width: 1.5;
  transition: all 0.2s ease;
}

.neighborhood-ground-slot.slot-locked:hover .diamond-polygon {
  fill: rgba(30, 24, 15, 0.88);
  stroke: var(--gold-bright);
  stroke-width: 2.2;
}

.neighborhood-ground-slot.slot-locked:hover .ground-lot-surface {
  transform: scale(1.06);
  filter: drop-shadow(0 0 14px rgba(207, 138, 48, 0.7));
}

/* Losange Vide Débloqué (+ BÂTIR) */
.neighborhood-ground-slot.slot-empty .diamond-polygon {
  fill: rgba(9, 8, 7, 0.45);
  stroke: rgba(207, 138, 48, 0.7);
  stroke-width: 1.8;
  stroke-dasharray: 5 3;
  transition: all 0.2s ease;
}

.neighborhood-ground-slot.slot-empty:hover .diamond-polygon {
  fill: rgba(207, 138, 48, 0.25);
  stroke: var(--gold-bright);
  stroke-width: 2.5;
  stroke-dasharray: none;
}

.neighborhood-ground-slot.slot-empty:hover .ground-lot-surface {
  transform: scale(1.08);
  filter: drop-shadow(0 0 16px rgba(207, 138, 48, 0.85));
}

/* Quartiers en lotTexture : le losange prend la texture d'un terrain vague peint */
.lot-textured .ground-lot-surface.diamond-surface::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--lot-texture) center / 121% 121% no-repeat;
  clip-path: polygon(50% 3%, 97% 50%, 50% 97%, 3% 50%);
  pointer-events: none;
}
.lot-textured .neighborhood-ground-slot.slot-empty .diamond-polygon { fill: rgba(9, 8, 7, 0.12); }
.lot-textured .neighborhood-ground-slot.slot-locked .diamond-polygon { fill: rgba(13, 11, 9, 0.42); }

/* Contenu centré dans le losange */
.slot-diamond-content {
  rotate: calc(-1 * var(--slot-rot, 0deg)); /* le texte reste droit quand le losange pivote */
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}

.slot-padlock-icon {
  font-size: 16px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.95));
  animation: lockGlow 2.5s infinite alternate;
}

@keyframes lockGlow {
  0% { transform: scale(1); filter: drop-shadow(0 2px 4px rgba(0,0,0,0.9)); }
  100% { transform: scale(1.08); filter: drop-shadow(0 0 8px rgba(207, 138, 48, 0.8)); }
}

.slot-req-text {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 9px;
  font-weight: 700;
  color: var(--gold-bright);
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px #000;
  margin-top: 2px;
}

.ground-lot-action {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 4px #000;
}

/* 3. Parcelle Occupée : Sprite isométrique sur la dalle */
.neighborhood-ground-slot.slot-occupied {
  width: calc(var(--building-size, 100px) * var(--slot-scale, 1));
  height: calc(var(--building-size, 100px) * var(--slot-scale, 1));
  transform: translate(-50%, -72%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.neighborhood-ground-slot.slot-occupied:hover {
  transform: translate(-50%, -72%) scale(1.08);
  z-index: 35;
}

.slot-building-sprite {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.85));
  transition: filter 0.2s ease;
}

/* Le bâtiment pivote avec sa parcelle (réglage de l'éditeur de cartes), autour du centre du losange, pour rester aligné sur le dessin */
.neighborhood-ground-slot.slot-occupied .slot-building-sprite {
  rotate: var(--slot-rot, 0deg);
  transform-origin: 50% calc(50% + var(--building-size, 100px) * var(--slot-scale, 1) * 0.22);
}

.neighborhood-ground-slot.slot-occupied:hover .slot-building-sprite {
  filter: drop-shadow(0 0 14px rgba(207, 138, 48, 0.8)) brightness(1.1);
}

/* Demeure peinte sur la carte du quartier : zone cliquable découpée sur le contour du domaine */
.neighborhood-mansion {
  position: absolute;
  z-index: 3;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.18s ease;
}
.neighborhood-mansion:hover { background: rgba(207, 138, 48, 0.14); }
/* Niveau de la villa : même badge que les bâtiments, posé sur le toit de la demeure */
.mansion-level-badge { right: auto; z-index: 4; width: 24px; height: 24px; font-size: 13px; }

/* Avant-plan peint (arbres) : copie de l'image au-dessus des parcelles et des bâtiments */
.neighborhood-foreground {
  position: absolute;
  inset: 0;
  z-index: 5000;
  pointer-events: none;
  background-repeat: no-repeat;
  background-position: 0 0;
}

/* Décors posés depuis l'éditeur de cartes (js/views/neighborhoodDecor.js) : au-dessus du fond, sous l'avant-plan peint */
.neighborhood-decor { position: absolute; pointer-events: none; user-select: none; }
.neighborhood-decor > svg, .neighborhood-decor > img { display: block; width: 100%; height: 100%; }

/* Bâtiment déjà peint sur la carte (slot « painted ») : pas de sprite, une zone cliquable sur le dessin avec son badge de niveau */
.neighborhood-ground-slot.slot-occupied.slot-painted { transform: translate(-50%, -50%); border-radius: 50%; }
.neighborhood-ground-slot.slot-occupied.slot-painted:hover { transform: translate(-50%, -50%); background: radial-gradient(closest-side, rgba(207, 138, 48, 0.28), rgba(207, 138, 48, 0) 85%); }
.neighborhood-ground-slot.slot-painted .slot-building-sprite { opacity: 0; }
.neighborhood-ground-slot.slot-painted .slot-level-badge { top: 50%; left: 50%; right: auto; transform: translate(-50%, -50%); }
.neighborhood-ground-slot.slot-painted:hover .slot-level-badge { transform: translate(-50%, -50%) scale(1.12); }
