/* ============================================================
   Marsella Properties Plugin — public.css
   ============================================================ */

/* ── GRID DE PROPIEDADES ── */
.mp-props-grid {
  display: grid;
  gap: 20px;
}
.mp-props-grid--3col { grid-template-columns: repeat(3, 1fr); }
.mp-props-grid--2col { grid-template-columns: repeat(2, 1fr); }
.mp-props-grid--1col { grid-template-columns: 1fr; }
.mp-props-grid--4col { grid-template-columns: repeat(4, 1fr); }

/* ── CARD PROPIEDAD ── */
.mp-prop-card { position: relative; }
.mp-prop-card-link { text-decoration: none; display: block; }
.mp-prop-card-img-placeholder {
  height: 210px;
  background: #EDE8E3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: #C9B8D4;
}
.mp-prop-badge-premium {
  position: absolute;
  top: 12px;
  right: 48px;
  background: #C8A96E;
  color: #412402;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}

/* ── BUSCADOR ── */
.mp-buscador-wrap {
  width: 100%;
}

.mp-buscador-filtros {
  background: #F7F4F2;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 28px;
  border: 0.5px solid #E8E3DE;
}

.mp-filtros-inner { width: 100%; }

.mp-filtro-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: #fff;
  border: 0.5px solid #E8E3DE;
  border-radius: 8px;
  padding: 4px;
  width: fit-content;
}

.mp-tab {
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: #7A7370;
  transition: all 0.2s;
}
.mp-tab.active {
  background: #7B3FA0;
  color: #fff;
}
.mp-tab:hover:not(.active) { background: #F3EBF9; color: #7B3FA0; }

.mp-filtros-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 120px 100px auto;
  gap: 12px;
  align-items: flex-end;
}

.mp-filtro-group { display: flex; flex-direction: column; gap: 5px; }
.mp-filtro-group--btn { display: flex; flex-direction: column; gap: 6px; }

.mp-filtro-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7A7370;
}

.mp-filtro-select,
.mp-filtro-input {
  padding: 9px 12px;
  border: 1px solid #D5CEC8;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.82rem;
  color: #2D2D2D;
  background: #fff;
  width: 100%;
  transition: border-color 0.2s;
}
.mp-filtro-select:focus,
.mp-filtro-input:focus {
  outline: none;
  border-color: #7B3FA0;
  box-shadow: 0 0 0 3px rgba(123,63,160,0.1);
}
.mp-filtro-select--sm { width: auto; }

.mp-btn-limpiar {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.72rem;
  color: #7A7370;
  text-align: center;
  font-family: inherit;
  text-decoration: underline;
}
.mp-btn-limpiar:hover { color: #7B3FA0; }

/* Resultados header */
.mp-resultados-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.mp-resultados-count {
  font-size: 0.85rem;
  color: #7A7370;
}
.mp-resultados-count strong { color: #2D2D2D; font-weight: 600; }

/* Loader */
.mp-buscador-loader {
  text-align: center;
  padding: 40px;
  color: #7A7370;
  font-size: 0.85rem;
}
.mp-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #F3EBF9;
  border-top-color: #7B3FA0;
  border-radius: 50%;
  animation: mp-spin 0.7s linear infinite;
  margin: 0 auto 12px;
}
@keyframes mp-spin { to { transform: rotate(360deg); } }

/* No resultados */
.mp-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #7A7370;
  font-size: 0.9rem;
}
.mp-no-results i { font-size: 3rem; color: #D5CEC8; display: block; margin-bottom: 16px; }

/* Paginación */
.mp-paginacion {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
}
.mp-pag-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: 1px solid #D5CEC8;
  border-radius: 50px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: #2D2D2D;
  transition: all 0.2s;
}
.mp-pag-btn:hover:not([disabled]) { border-color: #7B3FA0; color: #7B3FA0; }
.mp-pag-btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.mp-pag-info { font-size: 0.8rem; color: #7A7370; }

/* UF info */
.mp-uf-info, .mp-ficha-uf-hoy {
  text-align: center;
  font-size: 0.72rem;
  color: #7A7370;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* ── FICHA DE PROPIEDAD ── */
.mp-ficha-wrap { max-width: 1200px; margin: 0 auto; padding: 0 32px; }

.mp-ficha-breadcrumb {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 0.75rem;
  color: #7A7370;
  margin: 16px 0 24px;
  flex-wrap: wrap;
}
.mp-ficha-breadcrumb a { color: #7A7370; }
.mp-ficha-breadcrumb a:hover { color: #7B3FA0; }
.mp-ficha-breadcrumb span { color: #D5CEC8; }

.mp-ficha-inner {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
  align-items: start;
}

/* Galería */
.mp-ficha-galeria { margin-bottom: 28px; }
.mp-galeria-principal { position: relative; border-radius: 16px; overflow: hidden; margin-bottom: 8px; }
.mp-galeria-main-img { width: 100%; height: 420px; object-fit: cover; display: block; cursor: pointer; }
.mp-galeria-badges { position: absolute; top: 14px; left: 14px; display: flex; gap: 8px; }
.mp-galeria-counter {
  position: absolute;
  bottom: 14px;
  right: 14px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mp-galeria-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.mp-galeria-thumb {
  flex-shrink: 0;
  width: 90px;
  height: 68px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  background: none;
  position: relative;
}
.mp-galeria-thumb.active { border-color: #7B3FA0; }
.mp-galeria-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mp-galeria-more {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mp-galeria-placeholder {
  height: 300px;
  background: #EDE8E3;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #B0A0BA;
  font-size: 0.85rem;
}
.mp-galeria-placeholder i { font-size: 3rem; }

/* Header ficha */
.mp-ficha-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.mp-ficha-titulo {
  font-size: clamp(1.2rem, 4vw, 2rem);
  margin-bottom: 6px;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
}
.mp-ficha-ubicacion { font-size: 0.85rem; color: #7A7370; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mp-ficha-codigo { background: #F3EBF9; color: #7B3FA0; font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 4px; }
.mp-action-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid #D5CEC8;
  background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: #7A7370; font-size: 15px; transition: all 0.2s; flex-shrink: 0;
}
.mp-action-btn:hover { border-color: #7B3FA0; color: #7B3FA0; }

/* Specs ficha */
.mp-ficha-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 0.5px solid #E8E3DE;
}
.mp-ficha-spec {
  background: #F7F4F2;
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
  min-width: 80px;
  flex: 0 0 auto;
}
.mp-ficha-spec-num {
  font-family: 'Cormorant', serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: #2D2D2D;
  line-height: 1;
  margin-bottom: 4px;
  display: block;
}
.mp-ficha-spec-icon {
  font-size: 1rem;
  color: #7B3FA0;
  margin: 2px 0 4px;
  display: block;
}
.mp-ficha-spec-label {
  font-size: 0.6rem;
  color: #7A7370;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: block;
  white-space: nowrap;
}

/* Secciones ficha */
.mp-ficha-section { margin-bottom: 28px; padding-bottom: 28px; border-bottom: 0.5px solid #E8E3DE; }
.mp-ficha-section:last-child { border-bottom: none; }
.mp-ficha-section-title { font-size: 1rem; font-weight: 600; font-family: inherit; margin-bottom: 14px; color: #2D2D2D; }
.mp-ficha-descripcion { font-size: 0.875rem; color: #7A7370; line-height: 1.85; }

/* Amenidades */
.mp-ficha-amenidades {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.mp-amenidad {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #F3EBF9;
  color: #5B2D7A;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
}
.mp-amenidad i { font-size: 13px; }

/* ── VIDEO — normal 16:9 y Shorts vertical 9:16 ── */
.mp-ficha-video {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
}
.mp-ficha-video iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100% !important;
  height: 100% !important;
  border: none;
  display: block;
}

/* YouTube Shorts — vertical 9:16 centrado */
.mp-ficha-video-short {
  display: flex;
  justify-content: center;
  width: 100%;
}
.mp-ficha-video-short iframe {
  width: 100%;
  max-width: 340px;
  height: 605px;
  border-radius: 16px;
  border: none;
  display: block;
}

/* Fix overflow global en iframes */
.mp-ficha-video iframe,
.mp-ficha-video-short iframe,
iframe[src*="youtube"],
iframe[src*="youtu.be"],
iframe[src*="vimeo"] {
  max-width: 100%;
}

/* Ficha inner colapsa en móvil */
@media (max-width: 768px) {
  .mp-ficha-inner {
    grid-template-columns: 1fr !important;
  }
  .mp-ficha-sidebar {
    position: static !important;
  }
  .mp-ficha-video-short iframe {
    max-width: 100%;
    height: calc((100vw - 32px) * 16 / 9);
  }
}



/* Sidebar */
.mp-ficha-sidebar { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 16px; }

.mp-ficha-precio-card {
  background: #fff;
  border: 0.5px solid #E8E3DE;
  border-radius: 16px;
  padding: 20px;
}
.mp-ficha-precio-principal {
  font-family: 'DM Sans', 'Raleway', sans-serif;
  font-size: 2rem;
  font-weight: 600;
  color: #2D2D2D;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}
.mp-ficha-precio-periodo { font-size: 1rem; color: #7A7370; }
.mp-ficha-precio-secundario { font-size: 0.85rem; color: #7A7370; margin-top: 4px; }
.mp-ficha-gastos { font-size: 0.75rem; color: #7A7370; margin-top: 8px; padding-top: 8px; border-top: 0.5px solid #E8E3DE; }
.mp-ficha-negociable { font-size: 0.78rem; color: #7B3FA0; font-weight: 500; margin-top: 8px; display: flex; align-items: center; gap: 6px; }

.mp-ficha-contacto-card {
  background: #fff;
  border: 0.5px solid #E8E3DE;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mp-ficha-agente { display: flex; gap: 12px; align-items: center; padding-bottom: 14px; border-bottom: 0.5px solid #E8E3DE; }
.mp-ficha-agente-foto { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.mp-ficha-agente-nombre { display: block; font-size: 0.9rem; font-weight: 600; color: #2D2D2D; }
.mp-ficha-agente-cargo { display: block; font-size: 0.72rem; color: #7A7370; }
.mp-ficha-agente-telefono { display: block; font-size: 0.78rem; color: #7B3FA0; font-weight: 500; }

.mp-ficha-wsp-btn { width: 100%; justify-content: center; }

.mp-ficha-form-wrap {}
.mp-ficha-form-title { font-size: 0.78rem; color: #7A7370; font-weight: 500; margin-bottom: 12px; text-align: center; }
.mp-ficha-form .mp-input {
  width: 100%; padding: 9px 12px; border: 1px solid #D5CEC8;
  border-radius: 8px; font-family: inherit; font-size: 0.8rem; margin-bottom: 8px;
}
.mp-ficha-form .mp-input:focus { outline: none; border-color: #7B3FA0; }
.mp-ficha-form-submit { width: 100%; justify-content: center; font-size: 0.78rem; }
.mp-form-msg { font-size: 0.78rem; text-align: center; margin-top: 8px; }
.mp-form-msg.success { color: #0F6E56; }
.mp-form-msg.error { color: #A32D2D; }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .mp-filtros-row { grid-template-columns: 1fr 1fr 1fr; }
  .mp-filtro-group--btn { grid-column: 1 / -1; flex-direction: row; align-items: center; }
  .mp-ficha-inner { grid-template-columns: 1fr; }
  .mp-ficha-sidebar { position: static; }
  .mp-props-grid--4col { grid-template-columns: repeat(2, 1fr); }
  .mp-props-grid--3col { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {

  /* ── Ficha: contenedor principal ── */
  .mp-ficha-wrap {
    padding: 0 16px;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  .mp-ficha-inner {
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: 100%;
  }
  .mp-ficha-main,
  .mp-ficha-sidebar {
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  .mp-ficha-sidebar { position: static; }

  /* ── Breadcrumb: wrap en vez de cortar ── */
  .mp-ficha-breadcrumb {
    font-size: 0.7rem;
    flex-wrap: wrap;
    gap: 4px;
  }

  /* ── Galería ── */
  .mp-galeria-main-img { height: 230px; }
  .mp-galeria-thumbs { gap: 6px; }
  .mp-galeria-thumb { width: 72px; height: 56px; }

  /* ── Título: nunca se corta ── */
  .mp-ficha-titulo {
    font-size: 1.15rem;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: calc(100vw - 32px);
  }

  /* ── Specs: GRID de 4 columnas iguales ── */
  .mp-ficha-specs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  .mp-ficha-spec {
    flex: none;
    width: auto;
    min-width: 0;
    padding: 10px 6px;
  }
  .mp-ficha-spec-num { font-size: 1rem; }
  .mp-ficha-spec-label { font-size: 0.5rem; }

  /* ── Formulario y botones ── */
  .mp-ficha-form .mp-input,
  .mp-ficha-form textarea,
  .mp-ficha-form-submit,
  .mp-ficha-wsp-btn {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .mp-ficha-wsp-btn { justify-content: center; }

  /* ── Buscador ── */
  .mp-filtros-row { grid-template-columns: 1fr; gap: 8px; }
  .mp-filtro-group--btn { flex-direction: column; }
  .mp-buscador-filtros { padding: 16px; }
  .mp-filtro-tabs { width: 100%; }
  .mp-tab { flex: 1; text-align: center; }
  .mp-filtro-select,
  .mp-filtro-input { width: 100%; box-sizing: border-box; }
  .mp-precio-label-row { margin-bottom: 5px; }

  /* ── Cards grilla ── */
  .mp-props-grid--3col,
  .mp-props-grid--2col { grid-template-columns: 1fr; }
  .mp-props-grid--4col { grid-template-columns: repeat(2, 1fr); }

  /* ── Resultados ── */
  .mp-resultados-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .mp-paginacion { gap: 10px; }
  .mp-pag-btn { padding: 8px 14px; font-size: 0.75rem; }
}

@media (max-width: 400px) {
  /* Specs: 3 columnas en pantallas muy pequeñas */
  .mp-ficha-specs {
    grid-template-columns: repeat(3, 1fr);
  }
  .mp-galeria-main-img { height: 200px; }
  .mp-props-grid--4col { grid-template-columns: 1fr; }
}

/* ── PRECIOS — Fuente DM Sans para números ordenados ── */
.mp-prop-price,
.mp-prop-price-alt {
  font-family: 'DM Sans', 'Raleway', sans-serif;
  font-variant-numeric: tabular-nums;
}
.mp-prop-price {
  font-size: 1.45rem;
  font-weight: 600;
  color: #2D2D2D;
  line-height: 1;
}
.mp-prop-price-alt {
  font-size: 0.79rem;
  color: #7A7370;
  margin: 3px 0 8px;
}
.mp-ficha-precio-secundario {
  font-family: 'DM Sans', 'Raleway', sans-serif;
  font-variant-numeric: tabular-nums;
}

/* ── SELECTOR MONEDA UF / CLP — integrado en label ── */
.mp-precio-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}
.mp-precio-label-row .mp-filtro-label {
  margin-bottom: 0;
}
.mp-moneda-toggle {
  display: flex;
  background: #EEEBEA;
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}
.mp-moneda-btn {
  padding: 3px 10px;
  border: none;
  border-radius: 4px;
  background: transparent;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  color: #7A7370;
  transition: all 0.18s;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.4;
}
.mp-moneda-btn.active {
  background: #fff;
  color: #7B3FA0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.10);
}
.mp-moneda-btn:hover:not(.active) {
  color: #7B3FA0;
}
