/* ============================================================
   CASA HACIENDA LAS PALMERAS — modal.css
   Modal para Bungalows y Galería
   ============================================================ */

/* ── OVERLAY BASE ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(20, 5, 8, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ── BOTÓN CERRAR ── */
.modal-close {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  width: 44px;
  height: 44px;
  background: rgba(214, 197, 176, 0.12);
  border: 1px solid rgba(214, 197, 176, 0.25);
  color: var(--beige);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  line-height: 1;
  transition: background 0.2s, transform 0.2s;
  z-index: 10;
  flex-shrink: 0;
}
.modal-close:hover {
  background: rgba(214, 197, 176, 0.25);
  transform: rotate(90deg);
}

/* ════════════════════════════════════════
   MODAL BUNGALOWS
   ════════════════════════════════════════ */
#modalBungalow .modal-box {
  position: relative;
  background: var(--cream);
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  transform: translateY(28px) scale(0.97);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  scrollbar-width: thin;
  scrollbar-color: var(--beige-dark) transparent;
}
#modalBungalow.active .modal-box {
  transform: translateY(0) scale(1);
}

/* Galería de fotos izquierda */
.modal-gallery {
  background: var(--guindo-dark);
  position: relative;
  min-height: 480px;
  display: flex;
  flex-direction: column;
}

.modal-gallery-main {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 320px;
}
.modal-gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.35s ease;
}

/* Flechas galería */
.modal-gallery-prev,
.modal-gallery-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(20, 5, 8, 0.55);
  border: 1px solid rgba(214, 197, 176, 0.2);
  color: var(--beige);
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  z-index: 5;
  transition: background 0.2s;
}
.modal-gallery-prev { left: 0.8rem; }
.modal-gallery-next { right: 0.8rem; }
.modal-gallery-prev:hover,
.modal-gallery-next:hover { background: var(--guindo); }

/* Thumbnails */
.modal-gallery-thumbs {
  display: flex;
  gap: 0.4rem;
  padding: 0.6rem;
  background: rgba(20, 5, 8, 0.4);
  overflow-x: auto;
  scrollbar-width: none;
}
.modal-gallery-thumbs::-webkit-scrollbar { display: none; }
.modal-thumb {
  width: 60px;
  height: 45px;
  object-fit: cover;
  cursor: pointer;
  opacity: 0.5;
  border: 2px solid transparent;
  flex-shrink: 0;
  transition: opacity 0.2s, border-color 0.2s;
}
.modal-thumb.active {
  opacity: 1;
  border-color: var(--beige);
}

/* Placeholder cuando no hay imagen */
.modal-img-placeholder {
  width: 100%;
  height: 100%;
  min-height: 320px;
  background: linear-gradient(135deg, #5a0c17, #3a0810);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-img-placeholder span {
  font-family: var(--font-display);
  color: var(--beige);
  font-style: italic;
  opacity: 0.3;
  font-size: 1rem;
}

/* Contenido derecho */
.modal-content {
  padding: 2.5rem 2.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  overflow-y: auto;
}

.modal-badge {
  display: inline-block;
  background: var(--guindo);
  color: var(--white);
  font-size: 0.52rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  align-self: flex-start;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 300;
  font-style: italic;
  color: var(--text-dark);
  line-height: 1.15;
}

.modal-divider {
  width: 2rem;
  height: 1px;
  background: var(--guindo);
  opacity: 0.4;
}

.modal-desc {
  font-size: 0.88rem;
  line-height: 1.9;
  color: var(--text-mid);
  font-weight: 300;
}

/* Features */
.modal-features {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.3rem;
}
.modal-feat {
  background: var(--beige-light);
  color: var(--guindo);
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 0.35rem 0.85rem;
  font-weight: 600;
}

/* Precio / capacidad info */
.modal-meta {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: rgba(122, 16, 32, 0.04);
  border-left: 3px solid var(--guindo);
  padding: 1rem 1.2rem;
  margin-top: 0.3rem;
}
.modal-meta-item {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.modal-meta-label {
  font-size: 0.55rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-mid);
  opacity: 0.7;
  font-weight: 600;
  white-space: nowrap;
}
.modal-meta-value {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text-dark);
  font-style: italic;
}

/* CTA */
.modal-cta {
  margin-top: auto;
  padding-top: 1rem;
}
.modal-cta a {
  display: inline-block;
  background: var(--guindo);
  color: var(--white);
  padding: 0.95rem 2rem;
  font-family: var(--font-body);
  font-size: 0.62rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
  width: 100%;
  text-align: center;
}
.modal-cta a:hover { background: var(--guindo-dark); }

/* ════════════════════════════════════════
   MODAL GALERÍA (ampliar foto slider)
   ════════════════════════════════════════ */
#modalGaleria .modal-box {
  position: relative;
  max-width: 880px;
  width: 100%;
  max-height: 90vh;
  background: var(--text-dark);
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
#modalGaleria.active .modal-box {
  transform: scale(1);
}

.modal-galeria-img-wrap {
  position: relative;
  flex: 1;
  overflow: hidden;
  min-height: 300px;
  max-height: 72vh;
  background: #0d0306;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-galeria-img-wrap img {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  display: block;
}

.modal-galeria-caption {
  padding: 1.2rem 1.8rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-style: italic;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

/* Flechas galería modal */
.modal-galeria-prev,
.modal-galeria-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(20, 5, 8, 0.6);
  border: 1px solid rgba(214, 197, 176, 0.2);
  color: var(--beige);
  width: 46px;
  height: 46px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  z-index: 5;
  transition: background 0.2s;
}
.modal-galeria-prev { left: 1rem; }
.modal-galeria-next { right: 1rem; }
.modal-galeria-prev:hover,
.modal-galeria-next:hover { background: var(--guindo); }

/* Contador */
.modal-galeria-counter {
  position: absolute;
  bottom: 0.8rem;
  right: 1.2rem;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.35);
  font-family: var(--font-body);
}

/* ════════════════════════════════════════
   RESPONSIVE MODAL
   ════════════════════════════════════════ */
@media (max-width: 768px) {
  .modal-overlay { padding: 0; align-items: flex-end; }

  /* Bungalow modal: columna única, desliza desde abajo */
  #modalBungalow .modal-box {
    grid-template-columns: 1fr;
    max-height: 92vh;
    border-radius: 0;
    transform: translateY(100%);
  }
  #modalBungalow.active .modal-box { transform: translateY(0); }

  .modal-gallery { min-height: 260px; }
  .modal-gallery-main { min-height: 220px; }
  .modal-content { padding: 1.8rem 1.2rem; }
  .modal-title { font-size: 1.6rem; }
  .modal-close { top: 0.8rem; right: 0.8rem; }

  /* Galería modal: centrado, más pequeño */
  #modalGaleria .modal-box {
    max-width: 100%;
    max-height: 88vh;
    border-radius: 0;
    transform: scale(0.98) translateY(8px);
  }
  #modalGaleria.active .modal-box { transform: scale(1) translateY(0); }
  .modal-galeria-prev { left: 0.4rem; width: 38px; height: 38px; }
  .modal-galeria-next { right: 0.4rem; width: 38px; height: 38px; }
}

@media (max-width: 480px) {
  .modal-gallery { min-height: 200px; }
  .modal-gallery-main { min-height: 180px; }
  .modal-content { padding: 1.4rem 1rem; }
  .modal-title { font-size: 1.4rem; }
  .modal-cta a { padding: 0.85rem 1.2rem; font-size: 0.58rem; }
}

.modal-thumb--video {
  width: 60px;
  height: 45px;
  background: rgba(122, 16, 32, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.2s, border-color 0.2s;
}
.modal-thumb--video.active {
  opacity: 1;
  border-color: var(--beige);
}