/* ============================================================
   detalle.css — Ficha de propiedad (detalle.php)
   Complementa styles.css + propiedades.css
   Integrado con sistema de temas dark/light
   ============================================================ */

/* ────────────────────────────────────────────────────────────
   BREADCRUMB
   ──────────────────────────────────────────────────────────── */
.detalle-breadcrumb {
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 0;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color .15s;
}
.breadcrumb a:hover { color: var(--rojo-principal); }

.breadcrumb [aria-current="page"] {
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

/* ────────────────────────────────────────────────────────────
   GALERÍA
   ──────────────────────────────────────────────────────────── */
.galeria {
  padding: 24px 0 0;
}

.galeria__featured {
  position: relative;
  width: 100%;
  height: 480px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-surface-3);
  cursor: pointer;
  transition: background-color 0.35s;
}

@media (max-width: 767px) {
  .galeria__featured { height: 260px; border-radius: 10px; }
}

.galeria__img-main {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: opacity .25s ease;
  display: block;
}

.galeria__img-main.galeria__img-main--fade {
  opacity: 0;
}

/* Badges sobre la imagen */
.galeria__over-badges {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Contador de fotos */
.galeria__counter {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,.60);
  backdrop-filter: blur(8px);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  transition: background .18s;
}
.galeria__counter:hover { background: rgba(0,0,0,.80); }

/* Flechas prev/next */
.galeria__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: background .15s, box-shadow .15s, color .15s;
  z-index: 5;
}
.galeria__nav:hover { background: var(--bg-surface-2); box-shadow: var(--shadow-lg); }
.galeria__nav--prev { left: 16px; }
.galeria__nav--next { right: 16px; }

/* Botones media (video / tour) */
.galeria__media-btns {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  gap: 8px;
}

.galeria__media-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(0,0,0,.60);
  backdrop-filter: blur(8px);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.galeria__media-btn:hover { background: rgba(0,0,0,.82); color: #fff; }

/* Thumbnails */
.galeria__thumbs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}
.galeria__thumbs::-webkit-scrollbar { height: 4px; }
.galeria__thumbs::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.galeria__thumb {
  flex-shrink: 0;
  width: 80px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  background: var(--bg-surface-3);
  transition: border-color .15s, opacity .15s;
  opacity: .7;
}
.galeria__thumb:hover    { opacity: 1; border-color: var(--border-color); }
.galeria__thumb--active  { border-color: var(--rojo-principal); opacity: 1; }

.galeria__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ────────────────────────────────────────────────────────────
   CABECERA: título + precio
   ──────────────────────────────────────────────────────────── */
.detalle-cabecera {
  padding: 28px 0 0;
}

.detalle-cabecera__inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.detalle-cabecera__info { flex: 1; min-width: 0; }

.detalle-cabecera__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.detalle-tipo-inm {
  font-family: var(--font-display);
  font-size: 0.70rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.detalle-tipo-op {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 100px;
}
.detalle-tipo-op--venta    { background: rgba(173,0,37,.1); color: var(--rojo-principal); }
.detalle-tipo-op--alquiler { background: var(--badge-bg-alt); color: var(--text-primary); border: 1px solid var(--border-color); }

.detalle-badge-credito {
  font-family: var(--font-display);
  font-size: 0.70rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 100px;
  background: #e8f5e9;
  color: #2e7d32;
  letter-spacing: .04em;
}

.detalle-titulo {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 3vw, 2rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.25;
  margin: 0 0 10px;
}

.detalle-ubicacion {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
}
.detalle-ubicacion svg { flex-shrink: 0; opacity: .65; }

/* Precio */
.detalle-precio-box {
  text-align: right;
  flex-shrink: 0;
}

.detalle-precio {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.1;
  margin: 0;
}
.detalle-precio--consultar {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 600;
}

.detalle-moneda {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  text-align: right;
  margin: 4px 0 0;
}

/* ────────────────────────────────────────────────────────────
   LAYOUT PRINCIPAL (2 columnas)
   ──────────────────────────────────────────────────────────── */
.detalle-layout {
  padding: 32px 0 72px;
}

.detalle-layout__inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}

@media (min-width: 1024px) {
  .detalle-layout__inner {
    grid-template-columns: 1fr 380px;
    align-items: start;
  }
}

/* ────────────────────────────────────────────────────────────
   CONTENIDO IZQUIERDO
   ──────────────────────────────────────────────────────────── */
.detalle-content {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.detalle-section-titulo {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-color);
}

/* ── Características ── */
.feat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.feat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--bg-surface-2);
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.feat-pill strong {
  font-weight: 700;
  color: var(--text-primary);
}

.feat-pill svg {
  flex-shrink: 0;
  color: var(--rojo-principal);
  opacity: .85;
}

.feat-pill--green {
  background: #f1f8f2;
  border-color: #a5d6a7;
  color: #2e7d32;
}
.feat-pill--green svg { color: #2e7d32; }

/* ── Descripción ── */
.detalle-descripcion__texto {
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text-secondary);
  max-height: 260px;
  overflow: hidden;
  position: relative;
  transition: max-height .4s ease;
}

.detalle-descripcion__texto::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(transparent, var(--bg-body));
  transition: opacity .3s;
}

.detalle-descripcion__texto.expanded {
  max-height: 9999px;
}
.detalle-descripcion__texto.expanded::after {
  opacity: 0;
  pointer-events: none;
}

.detalle-descripcion__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  background: none;
  border: none;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--rojo-principal);
  cursor: pointer;
  padding: 0;
  transition: gap .18s;
}
.detalle-descripcion__toggle:hover { gap: 10px; }
.detalle-descripcion__toggle svg { transition: transform .25s; }
.detalle-descripcion__toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

/* ── Video ── */
.detalle-video__wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}

.detalle-video__wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ── Mapa ── */
.detalle-mapa__dir {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0 0 14px;
}

.detalle-mapa__container {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  height: 380px;
}

.detalle-mapa__container iframe {
  width: 100%;
  height: 100%;
  display: block;
}

/* ────────────────────────────────────────────────────────────
   SIDEBAR: Formulario de contacto
   ──────────────────────────────────────────────────────────── */
.detalle-sidebar {
  /* sticky en desktop */
}

@media (min-width: 1024px) {
  .detalle-sidebar {
    position: sticky;
    top: 90px;
    align-self: start;
  }
}

.detalle-form-card {
  background: var(--card-bg);
  border-radius: 20px;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.detalle-form-card__header {
  background: #1a1a1a;
  color: #fff;
  padding: 28px 28px 24px;
}

.detalle-form-card__eyebrow {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.55);
  margin: 0 0 8px;
}

.detalle-form-card__titulo {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 8px;
}

.detalle-form-card__sub {
  font-size: 0.83rem;
  color: rgba(255,255,255,.65);
  margin: 0;
  line-height: 1.5;
}


/* Estado éxito / error */
.form-estado {
  padding: 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.form-estado--ok svg  { color: #2e7d32; }

.form-estado--ok h3   { font-family: var(--font-display); font-size: 1.1rem; font-weight: 800; color: var(--text-primary); margin: 0; }
.form-estado--ok p    { font-size: 0.875rem; color: var(--text-secondary); margin: 0; }

.form-estado--err {
  flex-direction: row;
  gap: 8px;
  padding: 12px 16px;
  background: #fff3f3;
  border-radius: 10px;
  font-size: 0.83rem;
  color: #b71c1c;
  text-align: left;
}
.form-estado--err svg { flex-shrink: 0; }

/* El atributo [hidden] DEBE ganarle al display:flex de .form-estado y
   .detalle-form. Sin esto, los estados de éxito/error se muestran SIEMPRE
   desde la carga (el display:flex anula el [hidden] del navegador). */
.form-estado[hidden],
.detalle-form[hidden] { display: none !important; }

/* Honeypot anti-bot: fuera de pantalla (no display:none, que algunos bots ignoran) */
.form-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Formulario */
.detalle-form {
  padding: 24px 28px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row--2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-campo {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-label {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.form-label span { color: var(--rojo-principal); }

.form-input {
  padding: 10px 14px;
  border: 1.5px solid var(--input-border);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--input-text);
  background: var(--input-bg);
  transition: border-color .18s, box-shadow .18s;
  width: 100%;
  box-sizing: border-box;
}
.form-input:focus {
  border-color: var(--rojo-principal);
  box-shadow: 0 0 0 3px rgba(173,0,37,.1);
  outline: none;
}
.form-input.form-input--error { border-color: #e53935; }
.form-input::placeholder { color: var(--placeholder); }

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-error {
  font-size: 0.72rem;
  color: #e53935;
  font-weight: 600;
  min-height: 1em;
}

.detalle-form__submit {
  width: 100%;
  justify-content: center;
  padding: 14px;
  font-size: 0.95rem;
  border-radius: 12px;
  position: relative;
}

.detalle-form__submit.loading {
  pointer-events: none;
  opacity: .7;
}
.detalle-form__submit.loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin .6s linear infinite;
  margin-left: 10px;
  vertical-align: middle;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

.detalle-form__nota {
  font-size: 0.72rem;
  color: var(--placeholder);
  text-align: center;
  margin: 6px 0 0;
}

/* WhatsApp CTA */
.detalle-form__wa {
  padding: 16px 28px 28px;
  border-top: 1px solid var(--border-color);
  margin-top: 12px;
}

.btn-wa {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px;
  background: #25d366;
  color: #fff;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 800;
  text-decoration: none;
  transition: background .18s, box-shadow .18s;
}
.btn-wa:hover {
  background: #1ebe5d;
  color: #fff;
  box-shadow: 0 4px 16px rgba(37,211,102,.35);
}

/* ────────────────────────────────────────────────────────────
   LIGHTBOX
   ──────────────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox[hidden] { display: none; }

.lightbox__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.92);
  cursor: pointer;
}

.lightbox__figure {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.lightbox__img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 60px rgba(0,0,0,.6);
}

.lightbox__caption {
  color: rgba(255,255,255,.65);
  font-size: 0.8rem;
  text-align: center;
}

.lightbox__close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  border: none;
  color: #fff;
  cursor: pointer;
  transition: background .15s;
}
.lightbox__close:hover { background: rgba(255,255,255,.22); }

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  border: none;
  color: #fff;
  cursor: pointer;
  transition: background .15s;
}
.lightbox__nav:hover  { background: rgba(255,255,255,.22); }
.lightbox__nav--prev  { left: 20px; }
.lightbox__nav--next  { right: 20px; }

/* Error state en detalle */
.detalle-error { padding: 60px 0; }

/* ────────────────────────────────────────────────────────────
   RESPONSIVE ADJUSTMENTS
   ──────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .detalle-cabecera__inner { flex-direction: column; }
  .detalle-precio-box      { text-align: left; }
  .detalle-precio          { font-size: 1.7rem; }
  .form-row--2             { grid-template-columns: 1fr; }
  .detalle-form-card__header { padding: 20px; }
  .detalle-form            { padding: 20px 20px 0; }
  .detalle-form__wa        { padding: 14px 20px 20px; }
  .lightbox__nav--prev     { left: 8px; }
  .lightbox__nav--next     { right: 8px; }
}
