/* ═══════════════════════════════════════════════════════════
   LOTIZACIÓN CSS - Compatible iOS · Android · Desktop
   ═══════════════════════════════════════════════════════════ */

/* ─── Hotspot del plano en el suelo ─── */
.lotizacion-hotspot-container {
  position: relative;
  width: 1800px;
  height: 1274px;
  transform-origin: center center;
  /* Anti-aliasing suave */
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.lotizacion-plano-img {
  display: block;
  width: 100%;
  height: 100%;
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none;
}

.lotizacion-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: all;
}

/* ─── Manzanas en el SVG overlay ─── */
.manzana-group {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.lote-path {
  -webkit-tap-highlight-color: transparent;
  transition: fill 0.15s ease;
}

/* ─── Overlay oscuro (fondo panel) ─── */
#overlay-oscuro {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.55);
  z-index: 900;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

#overlay-oscuro.visible {
  display: block;
}

/* ─── Panel de manzana ─── */
#panel-manzana {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: 340px;
  height: 100%;
  background: linear-gradient(160deg, #0d1b2a 0%, #112233 100%);
  color: #fff;
  z-index: 1000;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.6);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex-direction: column;
  border-left: 1px solid rgba(0, 200, 100, 0.2);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#panel-manzana.visible {
  display: flex;
  transform: translateX(0);
}

/* Mobile: panel a pantalla completa */
@media (max-width: 500px) {
  #panel-manzana {
    width: 100%;
    top: auto;
    bottom: 0;
    height: 75%;
    border-left: none;
    border-top: 1px solid rgba(0, 200, 100, 0.3);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }
  #panel-manzana.visible {
    display: flex;
    transform: translateY(0);
  }
}

/* ─── Header del panel ─── */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 200, 100, 0.08);
  flex-shrink: 0;
}

.panel-header-info h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: #00ff88;
  letter-spacing: 0.5px;
}

#panel-manzana-total {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 2px;
  display: block;
}

.panel-cerrar {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.2s;
}

.panel-cerrar:hover {
  background: rgba(255, 60, 60, 0.3);
}

/* ─── Cuerpo del panel ─── */
.panel-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0;
}

/* ─── Preview SVG de la manzana ─── */
.panel-preview {
  width: 100%;
  aspect-ratio: 1.4 / 1;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-preview svg {
  max-width: 100%;
  max-height: 100%;
}

/* ─── Info del lote seleccionado ─── */
.panel-lote-info {
  margin: 10px 14px 0;
  padding: 10px 14px;
  background: rgba(0, 200, 100, 0.1);
  border: 1px solid rgba(0, 200, 100, 0.3);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.badge-disponible { color: #00ff88; font-weight: 700; }
.badge-reservado  { color: #FFB400; font-weight: 700; }
.badge-vendido    { color: #FF5555; font-weight: 700; }

/* ─── Leyenda ─── */
.panel-leyenda {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  flex-wrap: wrap;
}

.ley-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: rgba(255,255,255,0.75);
}

.ley-item::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.ley-disponible::before { background: rgba(0, 200, 100, 0.6);  border: 1px solid #00C864; }
.ley-reservado::before  { background: rgba(255, 180, 0, 0.6);  border: 1px solid #FFB400; }
.ley-vendido::before    { background: rgba(255, 60, 60, 0.6);   border: 1px solid #FF3C3C; }

/* ─── Lista de lotes ─── */
.panel-lista-lotes {
  padding: 0 14px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.lote-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.15s, border-color 0.15s;
  font-size: 12px;
}

.lote-item:hover,
.lote-item:active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

.lote-num {
  color: rgba(255,255,255,0.9);
  font-weight: 500;
}

.lote-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 5px;
  border-radius: 3px;
}

.estado-disponible .lote-badge {
  background: rgba(0, 200, 100, 0.25);
  color: #00ff88;
}

.estado-reservado .lote-badge {
  background: rgba(255, 180, 0, 0.25);
  color: #FFD700;
}

.estado-vendido .lote-badge {
  background: rgba(255, 60, 60, 0.25);
  color: #FF5555;
}

/* ─── Botón del plano ─── */
#plano-toggle-btn {
  position: fixed;
  bottom: 70px;
  right: 14px;
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(0, 200, 100, 0.5);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #00ff88;
  cursor: pointer;
  z-index: 500;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

#plano-toggle-btn:hover {
  background: rgba(0, 200, 100, 0.2);
  border-color: #00ff88;
  transform: scale(1.05);
}

#plano-toggle-btn:active {
  transform: scale(0.95);
}

#plano-toggle-btn svg {
  pointer-events: none;
}

/* Mobile adjustments */
@media (max-width: 500px) {
  #plano-toggle-btn {
    bottom: 80px;
    right: 10px;
    width: 44px;
    height: 44px;
  }
}

/* ─── Safe area para iOS (notch/home indicator) ─── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #panel-manzana {
    padding-bottom: env(safe-area-inset-bottom);
  }
  #plano-toggle-btn {
    bottom: calc(70px + env(safe-area-inset-bottom));
  }
}
