/* Reels de anuncios - Parque Berrío */
:root {
  --pbr-bg: #000;
  --pbr-ink: #fff;
  --pbr-muted: rgba(255, 255, 255, 0.78);
  --pbr-offer: #ffd400;
  --pbr-offer-ink: #111;
  --pbr-wa: #25d366;
  --pbr-safe-top: env(safe-area-inset-top, 0px);
  --pbr-safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body.pbr {
  height: 100%;
  margin: 0;
  background: var(--pbr-bg);
  color: var(--pbr-ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; }
a { color: inherit; }

.pbr-icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}
.pbr-icon-btn:focus-visible,
.pbr button:focus-visible,
.pbr a:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* ---------- Barra superior ---------- */
.pbr-top {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 480px);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(8px + var(--pbr-safe-top)) 12px 8px;
  pointer-events: none;
}
.pbr-top > * { pointer-events: auto; }
.pbr-top__title {
  flex: 1;
  font-weight: 700;
  font-size: 16px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pbr-top__count {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  font-variant-numeric: tabular-nums;
}
.pbr-top__count:empty { display: none; }

/* ---------- Feed vertical ---------- */
.pbr-feed {
  height: 100vh;
  height: 100dvh;
  width: min(100%, 480px);
  margin: 0 auto;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
  outline: none;
}
.pbr-feed::-webkit-scrollbar { display: none; }

.pbr-slide {
  position: relative;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: #111;
}

/* ---------- Fotos (deslizar en horizontal) ---------- */
.pbr-track {
  position: absolute;
  inset: 0;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  cursor: pointer;
}
.pbr-track::-webkit-scrollbar { display: none; }

.pbr-photo {
  position: relative;
  flex: 0 0 100%;
  height: 100%;
  scroll-snap-align: center;
  overflow: hidden;
}
.pbr-photo__blur {
  position: absolute;
  inset: -40px;
  background-size: cover;
  background-position: center;
  filter: blur(28px) brightness(0.55);
  transform: scale(1.1);
}
.pbr-photo img {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.pbr-photo--empty {
  display: grid;
  place-items: center;
  background: #1b1b1b;
  color: rgba(255, 255, 255, 0.4);
}

.pbr-dots {
  position: absolute;
  top: calc(64px + var(--pbr-safe-top));
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 5px;
  pointer-events: none;
}
.pbr-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transition: width 0.2s, background 0.2s;
}
.pbr-dots span.is-on { width: 16px; border-radius: 3px; background: #fff; }

/* ---------- Información del anuncio ---------- */
.pbr-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  padding: 72px 76px calc(18px + var(--pbr-safe-bottom)) 16px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.6) 55%, rgba(0, 0, 0, 0) 100%);
}

.pbr-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.pbr-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.pbr-badge--offer { background: var(--pbr-offer); color: var(--pbr-offer-ink); }
.pbr-badge--sponsored { background: #F4B400; color: #1B1600; font-weight: 700; }
.pbr-badge--premium { background: rgba(255, 255, 255, 0.16); color: #fff; font-weight: 700; }

.pbr-company {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.pbr-company[aria-disabled="true"] { cursor: default; }
.pbr-avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #333 center / cover no-repeat;
  font-weight: 800;
  font-size: 15px;
  text-transform: uppercase;
}
.pbr-company__name {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pbr-company__check { flex: 0 0 auto; color: #4cc2ff; }

.pbr-title {
  margin: 0 0 6px;
  font-size: 19px;
  line-height: 1.25;
  font-weight: 700;
}

.pbr-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 0 0 8px;
}
.pbr-price__now { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pbr-offer .pbr-price__now { color: var(--pbr-offer); }
.pbr-price__old { font-size: 15px; color: var(--pbr-muted); text-decoration: line-through; }

.pbr-desc {
  margin: 0;
  color: var(--pbr-muted);
  white-space: pre-line;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pbr-info.is-open .pbr-desc {
  display: block;
  max-height: 38vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.pbr-more {
  margin: 2px 0 0;
  padding: 4px 0;
  border: 0;
  background: none;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.pbr-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 8px 0 12px;
  font-size: 13px;
  color: var(--pbr-muted);
}
.pbr-meta span { display: inline-flex; align-items: center; gap: 4px; }

.pbr-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 999px;
  background: #fff;
  color: #111;
  font-weight: 800;
  text-decoration: none;
}

/* ---------- Acciones laterales ---------- */
.pbr-actions {
  position: absolute;
  right: 10px;
  bottom: calc(26px + var(--pbr-safe-bottom));
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}
.pbr-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  cursor: pointer;
}
.pbr-action__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
}
.pbr-action--wa .pbr-action__icon { background: var(--pbr-wa); }

/* ---------- Final y vacío ---------- */
.pbr-end {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: #111;
}
.pbr-end h2 { margin: 0; font-size: 22px; }
.pbr-end p { margin: 0; color: var(--pbr-muted); max-width: 30ch; }
.pbr-end .pbr-cta--ghost { background: transparent; color: #fff; border: 2px solid #fff; }

.pbr-loading {
  display: grid;
  place-items: center;
  color: var(--pbr-muted);
}
.pbr-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: pbr-spin 0.8s linear infinite;
}
@keyframes pbr-spin { to { transform: rotate(360deg); } }

/* ---------- Pista inicial ---------- */
.pbr-hint {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 20px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.62);
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}
.pbr-hint svg { animation: pbr-up 1.3s ease-in-out infinite; }
@keyframes pbr-up {
  0%, 100% { transform: translateY(6px); opacity: 0.6; }
  50% { transform: translateY(-6px); opacity: 1; }
}
.pbr-hint[hidden] { display: none; }

/* ---------- Escritorio: columna de celular centrada ---------- */
.pbr-desk-nav { display: none; }
@media (min-width: 768px) {
  body.pbr { background: #0b0b0b; }
  .pbr-feed { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06); }
  .pbr-desk-nav {
    position: fixed;
    top: 50%;
    left: calc(50% + 240px + 20px);
    transform: translateY(-50%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .pbr-desk-nav .pbr-icon-btn { background: rgba(255, 255, 255, 0.12); width: 48px; height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .pbr-feed, .pbr-track { scroll-behavior: auto; }
  .pbr-hint svg, .pbr-spinner { animation: none; }
  .pbr-dots span { transition: none; }
}
