/* === DirectoPropiedades v2 === */

* { box-sizing: border-box; }

html, body {
  overscroll-behavior-y: contain;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #fafafa;
  color: #1a1a1a;
}

a { color: inherit; text-decoration: none; }

/* === HEADER === */
.dp-header {
  position: sticky; top: 0; z-index: 50;
  background: #fff;
  border-bottom: 1px solid #ececec;
  min-height: 66px;
  padding: 12px 24px 12px 200px;
  display: flex; align-items: center; justify-content: flex-end;
  gap: 16px;
  color: #1a1a1a;
}
.dp-logo {
  font-family: 'gotham_bookregular', Arial, Helvetica, sans-serif;
  margin: 0;
  padding: 0;
  font-size: 100%;
  vertical-align: baseline;
  text-decoration: none;
  outline: none;
  border: none;
  background: url(../images/logo.png) no-repeat center / contain;
  height: 40px;
  left: 20px;
  overflow: hidden;
  position: absolute;
  text-indent: -999px;
  top: 13px;
  width: 160px;
}

/* "Compre sin comisión" flotante sobre el contenido */
.dp-sincom {
  position: fixed;
  top: 70px; left: 24px;
  z-index: 99999;
  background-color: #FF5722;
  color: #fffdfd;
  padding: 10px 14px;
  border-radius: 5px;
  opacity: 0.9;
  font-family: 'gotham_bookregular', Arial, Helvetica, sans-serif;
  font-size: 13px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s;
}
.dp-sincom:hover { opacity: 1; }

/* Filtros (ahora "ordenar") */
.dp-filter-panel {
  display: flex; align-items: center; gap: 10px;
}
.dp-filters {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.dp-filter-label {
  font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: 0.5px;
  margin-right: 6px;
}
.dp-filters select,
.dp-filters input {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  color: #1a1a1a;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23888' d='M0 0l5 6 5-6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.dp-filters input {
  background-image: none;
  padding-right: 12px;
  width: 110px;
}
.dp-filters select:focus,
.dp-filters input:focus { border-color: #1a1a1a; }
.dp-filters .dp-clear {
  background: transparent; color: #777; padding: 8px 6px;
  border: 0; cursor: pointer; font-size: 13px;
}
.dp-filters .dp-clear:hover { color: #1a1a1a; }

/* Burger (mobile) */
.dp-burger {
  display: none;
  background: transparent; border: 0; cursor: pointer;
  width: 36px; height: 36px; padding: 0;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 5px;
}
.dp-burger span {
  display: block; width: 22px; height: 2px; background: #1a1a1a;
  transition: transform 0.2s, opacity 0.2s;
}
.dp-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.dp-burger.open span:nth-child(2) { opacity: 0; }
.dp-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* === GRID === */
.dp-grid {
  max-width: 1280px;
  margin: 16px auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  grid-auto-flow: dense;
  gap: 6px;
}

.dp-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: #e0e0e0;
  transition: transform 0.18s ease;
}
.dp-card:hover { transform: translateY(-2px); }

/* Desktop: single thumbnail per card */
.dp-card-thumb {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
/* Mobile gallery track: hidden on desktop */
.dp-card-track { display: none; }

.dp-card.dp-featured {
  grid-column: span 2;
  grid-row: span 2;
}
.dp-card .dp-info {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 14px 16px 12px;
  color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.25) 60%, rgba(0,0,0,0) 100%);
  pointer-events: none;
}
.dp-info .dp-uf {
  font-size: 17px; font-weight: 700; letter-spacing: -0.3px;
}
.dp-info .dp-loc {
  font-size: 12px; opacity: 0.95; margin-top: 2px;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.dp-info .dp-meta {
  font-size: 11px; opacity: 0.85; margin-top: 2px;
}
.dp-card.dp-featured .dp-info { padding: 22px 24px 18px; }
.dp-card.dp-featured .dp-uf { font-size: 26px; }
.dp-card.dp-featured .dp-loc { font-size: 13px; }
.dp-badge-destacado {
  position: absolute; top: 10px; left: 10px;
  background: rgba(255,255,255,0.95); color: #1a1a1a;
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  padding: 4px 8px; border-radius: 4px;
  text-transform: uppercase;
  z-index: 2;
}

.dp-empty {
  grid-column: 1 / -1;
  text-align: center; padding: 60px 20px;
  color: #888;
}

/* "Ver el resto" banner cuando se filtra por codigo */
.dp-codigo-footer {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px 16px;
}
.dp-codigo-footer button {
  background: #1a1a1a; color: #fff;
  border: 0; border-radius: 8px;
  padding: 12px 22px; font-size: 14px; cursor: pointer;
  font-weight: 600;
}
.dp-codigo-footer button:hover { background: #000; }

/* === PANEL (Notion-style) === */
.dp-overlay {
  position: fixed; inset: 0;
  background: rgba(15,15,20,0.45);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 99;
}
.dp-overlay.show { opacity: 1; pointer-events: auto; }

.dp-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 62vw; max-width: 760px; min-width: 360px;
  background: #fff;
  box-shadow: -16px 0 60px rgba(0,0,0,0.18);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1);
  z-index: 100;
  overflow-y: auto;
}
.dp-panel.open { transform: translateX(0); }

.dp-panel-close {
  position: sticky; top: 0;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; border-bottom: 1px solid #eee;
  z-index: 5;
}
.dp-panel-close .dp-close-btn {
  background: transparent; border: 0; cursor: pointer;
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #555; font-size: 22px; line-height: 1;
}
.dp-panel-close .dp-close-btn:hover { background: #f3f3f3; color: #000; }
.dp-panel-close .dp-codigo { font-size: 12px; color: #888; }

.dp-panel-body { padding: 8px 28px 40px; }

.dp-gallery {
  margin: 8px -28px 24px;
  position: relative;
}
.dp-gallery-track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  gap: 0; scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.dp-gallery-track::-webkit-scrollbar { display: none; }
.dp-gallery-track { scrollbar-width: none; }
.dp-gallery-track img {
  width: 100%; flex: 0 0 100%; height: 420px;
  object-fit: cover; scroll-snap-align: center;
  background: #eee;
}
.dp-gallery-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.92); border: 0; cursor: pointer;
  font-size: 18px; line-height: 1; color: #1a1a1a;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  display: flex; align-items: center; justify-content: center;
}
.dp-gallery-nav:hover { background: #fff; }
.dp-gallery-nav.prev { left: 14px; }
.dp-gallery-nav.next { right: 14px; }
.dp-gallery-counter {
  position: absolute; bottom: 14px; right: 14px;
  background: rgba(0,0,0,0.6); color: #fff;
  padding: 4px 10px; border-radius: 12px;
  font-size: 11px;
}

.dp-panel h1 {
  font-size: 28px; line-height: 1.2; margin: 0 0 4px;
  font-weight: 700; letter-spacing: -0.5px;
}
.dp-panel .dp-sub {
  font-size: 14px; color: #666; margin: 0 0 24px;
}

.dp-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin: 24px 0;
}
.dp-stats .dp-stat {
  background: #f7f7f7; border-radius: 10px;
  padding: 14px; text-align: center;
}
.dp-stats .dp-num { font-size: 22px; font-weight: 700; }
.dp-stats .dp-lbl { font-size: 11px; color: #777; text-transform: uppercase; letter-spacing: 0.3px; margin-top: 2px; }

.dp-detail-grid {
  display: grid; grid-template-columns: 140px 1fr; gap: 8px 18px;
  margin: 24px 0; font-size: 14px;
}
.dp-detail-grid dt { color: #888; font-weight: 500; }
.dp-detail-grid dd { margin: 0; color: #1a1a1a; }

.dp-desc {
  margin: 24px 0; line-height: 1.6; font-size: 15px;
  color: #2a2a2a; white-space: pre-line;
}

.dp-cta-row {
  display: flex; gap: 10px; flex-wrap: wrap; margin: 24px 0;
}
.dp-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  border: 0; text-decoration: none;
}
.dp-btn-primary { background: #1a1a1a; color: #fff; }
.dp-btn-primary:hover { background: #000; }
.dp-btn-wa { background: #25D366; color: #fff; }
.dp-btn-wa:hover { background: #1ebe57; }
.dp-btn-ghost { background: #f3f3f3; color: #1a1a1a; }
.dp-btn-ghost:hover { background: #ececec; }

.dp-contact-card {
  margin-top: 28px; padding: 20px;
  background: #f7f7f7; border-radius: 12px;
}
.dp-contact-card h3 { margin: 0 0 10px; font-size: 16px; }
.dp-contact-card ul { list-style: none; padding: 0; margin: 0; font-size: 13px; line-height: 1.7; }

.dp-form { margin-top: 24px; }
.dp-form input, .dp-form textarea {
  width: 100%; padding: 10px 12px; margin: 6px 0;
  border: 1px solid #e0e0e0; border-radius: 8px;
  font-size: 14px; font-family: inherit; outline: none;
}
.dp-form input:focus, .dp-form textarea:focus { border-color: #888; }
.dp-form textarea { resize: vertical; min-height: 90px; }

/* === MOBILE: feed Instagram + acordeon + burger === */
@media (max-width: 768px) {
  .dp-header {
    padding: 10px 14px 10px 140px;
    flex-wrap: nowrap;
    min-height: 56px;
  }
  .dp-logo {
    top: 10px; left: 12px;
    height: 34px; width: 120px;
  }
  .dp-sincom {
    top: 62px; left: 12px;
    font-size: 11px; padding: 7px 10px;
  }

  .dp-burger { display: flex; }

  /* Filtros/ordenar se vuelven drawer */
  .dp-filter-panel {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: #fff;
    padding: 70px 20px 24px;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
    transform: translateY(-100%);
    transition: transform 0.3s cubic-bezier(.2,.8,.2,1);
    z-index: 40;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border-bottom: 1px solid #eee;
  }
  .dp-filter-panel.open { transform: translateY(0); }
  .dp-filter-label {
    color: #666; font-size: 10px; letter-spacing: 1px; margin-bottom: 4px;
  }
  .dp-filters {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
  }
  .dp-filters select,
  .dp-filters input {
    width: 100%;
    font-size: 15px;
    padding: 12px 14px;
  }
  .dp-filters input { width: 100%; }
  .dp-filters .dp-clear {
    text-align: center; padding: 14px;
    color: #888; border-top: 1px solid #eee; margin-top: 6px;
  }

  /* Grid: feed vertical */
  .dp-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
    gap: 1px;
    margin: 0;
    padding: 0;
    background: #e8e8e8;
  }
  .dp-grid::before { display: none; }
  .dp-card {
    aspect-ratio: 1 / 1;
    border-radius: 0;
    background: #ddd;
  }
  .dp-card.dp-featured {
    grid-column: span 1;
    grid-row: span 1;
  }

  /* Gallery horizontal scroll DENTRO de la tarjeta en mobile (swipe sin abrir) */
  .dp-card-thumb { display: none; }
  .dp-card-track {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%; height: 100%;
    overscroll-behavior-x: contain;
  }
  .dp-card-track::-webkit-scrollbar { display: none; }
  .dp-card-track img {
    flex: 0 0 100%;
    width: 100%; height: 100%;
    object-fit: cover;
    scroll-snap-align: center;
    display: block;
  }
  .dp-card-dots {
    position: absolute; bottom: 76px; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 4px;
    pointer-events: none;
    z-index: 2;
  }
  .dp-card-dots .dot {
    width: 5px; height: 5px; border-radius: 50%;
    background: rgba(255,255,255,0.6);
    transition: background 0.15s;
  }
  .dp-card-dots .dot.active { background: #fff; }

  /* Expanded / acordeon */
  .dp-card.dp-expanded {
    aspect-ratio: auto;
    cursor: default;
    background: #fff;
  }
  .dp-card.dp-expanded > .dp-card-track,
  .dp-card.dp-expanded > .dp-info,
  .dp-card.dp-expanded > .dp-badge-destacado,
  .dp-card.dp-expanded > .dp-card-dots { display: none; }

  .dp-mobile-detail {
    display: none;
    padding: 14px 16px 24px;
    background: #fff;
    color: #1a1a1a;
  }
  .dp-card.dp-expanded .dp-mobile-detail { display: block; }

  .dp-mobile-gallery {
    margin: -14px -16px 14px;
    display: flex; overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .dp-mobile-gallery::-webkit-scrollbar { display: none; }
  .dp-mobile-gallery img {
    flex: 0 0 100%; width: 100%; height: 320px;
    object-fit: cover; scroll-snap-align: center;
  }
  .dp-mobile-detail h2 {
    font-size: 22px; margin: 4px 0 4px; font-weight: 700;
  }
  .dp-mobile-detail .dp-sub {
    font-size: 13px; color: #666; margin: 0 0 14px;
  }
  .dp-mobile-detail .dp-stats { grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 14px 0; }
  .dp-mobile-detail .dp-stats .dp-stat { padding: 8px 4px; }
  .dp-mobile-detail .dp-stats .dp-num { font-size: 16px; }
  .dp-mobile-detail .dp-stats .dp-lbl { font-size: 9px; }
  .dp-mobile-detail .dp-desc { font-size: 14px; margin: 14px 0; }
  .dp-mobile-detail .dp-cta-row { gap: 8px; margin: 14px 0; }
  .dp-mobile-detail .dp-btn { font-size: 13px; padding: 9px 14px; }
  .dp-mobile-detail .dp-detail-grid { grid-template-columns: 110px 1fr; font-size: 13px; }

  .dp-collapse {
    margin-top: 16px; text-align: center;
    color: #888; font-size: 12px; padding: 10px;
    cursor: pointer;
  }
  .dp-collapse:hover { color: #1a1a1a; }

  .dp-panel, .dp-overlay { display: none !important; }
  .dp-gallery-nav { display: none; }
}
