/* ═══════════════════════════════════════════════
   A + B + C + D + E — nuevas piezas de storefront
   (Stories, Recently, Best sellers, Cross-sell,
    Countdown, Custom badges, Locale switcher,
    Wholesale tiers, Related, Quick buy, Share)
   ═══════════════════════════════════════════════ */

/* ----- Locale switcher ----- */
.locale-switcher { position: absolute; top: 14px; right: 14px; z-index: 3; }
.locale-switcher__details summary {
  list-style: none; cursor: pointer; padding: 6px 10px;
  background: rgba(255,255,255,.85); backdrop-filter: blur(8px);
  border-radius: 20px; font-size: 12px; font-weight: 600; color: #0f172a;
}
.locale-switcher__details summary::-webkit-details-marker { display: none; }
.locale-switcher__panel {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 12px; min-width: 220px;
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
}
.locale-switcher__group { margin-bottom: 10px; }
.locale-switcher__group:last-child { margin-bottom: 0; }
.locale-switcher__group strong {
  display: block; font-size: 11px; text-transform: uppercase;
  letter-spacing: .06em; color: #64748b; margin-bottom: 6px;
}
.locale-switcher__group a {
  display: inline-block; padding: 4px 10px; margin: 2px 4px 2px 0;
  border-radius: 999px; background: #f1f5f9; font-size: 13px;
  color: #0f172a; text-decoration: none;
}
.locale-switcher__group a:hover { background: #e2e8f0; }
.locale-switcher__group a.is-active { background: #2563eb; color: #fff; }

/* ----- Stories strip ----- */
.stories-strip { padding: 14px 16px 6px; overflow-x: auto; max-width: var(--container-max); margin: 0 auto; }
.stories-strip__track { display: flex; gap: 14px; padding-bottom: 4px; }
.story-bubble {
  flex: 0 0 auto; background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  width: 72px;
}
.story-bubble__ring {
  width: 68px; height: 68px; border-radius: 50%; padding: 3px;
  background: conic-gradient(from 0deg, #f59e0b, #ec4899, #8b5cf6, #3b82f6, #f59e0b);
  display: flex; align-items: center; justify-content: center;
}
.story-bubble__ring img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  border: 2px solid #fff;
}
.story-bubble__placeholder {
  width: 100%; height: 100%; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #f1f5f9; border: 2px solid #fff; font-size: 24px;
}
.story-bubble__label {
  font-size: 11px; color: #0f172a; max-width: 72px;
  text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ----- Stories viewer (fullscreen dialog) ----- */
.story-viewer {
  border: 0; padding: 0; max-width: 100%; max-height: 100%;
  width: 100vw; height: 100vh; background: #000; color: #fff; overflow: hidden;
}
.story-viewer::backdrop { background: rgba(0,0,0,.94); }
.story-viewer__close {
  position: absolute; top: 16px; right: 16px;
  background: rgba(0,0,0,.4); color: #fff; border: 0;
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 24px; cursor: pointer; z-index: 10;
}
.story-viewer__progress {
  position: absolute; top: 8px; left: 10px; right: 50px;
  display: flex; gap: 4px; z-index: 5;
}
.story-viewer__progress span {
  flex: 1; height: 3px; background: rgba(255,255,255,.3);
  border-radius: 2px; overflow: hidden;
}
.story-viewer__progress span.done b { width: 100%; }
.story-viewer__progress span.active b { animation: sv-progress 6s linear forwards; }
.story-viewer__progress span b { display: block; width: 0; height: 100%; background: #fff; }
@keyframes sv-progress { to { width: 100%; } }
.story-viewer__media { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.story-viewer__media img, .story-viewer__media video {
  width: 100%; height: 100%; object-fit: cover;
}
.story-viewer__content {
  position: absolute; bottom: 24px; left: 20px; right: 20px; z-index: 3;
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
}
.story-viewer__title { margin: 0 0 6px; font-size: 20px; font-weight: 700; }
.story-viewer__caption { margin: 0 0 12px; font-size: 14px; opacity: .95; }
.story-viewer__cta {
  display: inline-block; padding: 10px 22px; background: #fff;
  color: #000; border-radius: 999px; font-weight: 700; text-decoration: none;
}
.story-viewer__nav {
  position: absolute; top: 0; bottom: 0; width: 40%;
  background: transparent; border: 0; cursor: pointer; z-index: 2;
}
.story-viewer__nav--prev { left: 0; }
.story-viewer__nav--next { right: 0; }

/* ----- Best sellers ----- */
.bestsellers-strip { padding: 16px 20px 6px; max-width: var(--container-max); margin: 0 auto; }
.bestsellers-strip__head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.bestsellers-strip__head h2 {
  font-size: 18px; font-weight: 800; margin: 0;
  background: linear-gradient(135deg, #dc2626, #ea580c);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.bestsellers-strip__track {
  display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: thin;
}
.bestsellers-strip__track::-webkit-scrollbar { height: 4px; }
.bestseller-card {
  flex: 0 0 auto; width: 150px; position: relative;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  overflow: hidden; text-decoration: none; color: #0f172a;
  transition: transform .15s;
}
.bestseller-card:hover {
  transform: translateY(-2px); border-color: #ea580c; text-decoration: none;
}
.bestseller-card img { width: 100%; height: 120px; object-fit: cover; display: block; }
.bestseller-card__img-empty { width: 100%; height: 120px; background: #fef3c7; }
.bestseller-card strong { display: block; padding: 8px 10px 0; font-size: 13px; }
.bestseller-card__price {
  display: block; padding: 2px 10px 10px;
  font-weight: 800; color: #0f172a; font-size: 14px;
}
.bestseller-card__rank {
  position: absolute; top: 8px; left: 8px;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; font-size: 13px;
}
.bestseller-card__rank--1 { background: linear-gradient(135deg, #fbbf24, #d97706); }
.bestseller-card__rank--2 { background: linear-gradient(135deg, #94a3b8, #64748b); }
.bestseller-card__rank--3 { background: linear-gradient(135deg, #f97316, #c2410c); }

/* ----- Recently viewed ----- */
.recent-strip { padding: 8px 20px; max-width: var(--container-max); margin: 0 auto; }
.recent-strip__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.recent-strip__head h2 { font-size: 15px; margin: 0; color: #475569; }
.recent-strip__clear {
  background: none; border: 0; color: #94a3b8; cursor: pointer;
  font-size: 12px; text-decoration: underline;
}
.recent-strip__track { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.recent-card {
  flex: 0 0 auto; width: 120px; background: #fff;
  border: 1px solid #e2e8f0; border-radius: 10px; padding: 6px;
  cursor: pointer; text-align: left;
}
.recent-card img { width: 100%; height: 80px; object-fit: cover; border-radius: 6px; }
.recent-card__img-empty { width: 100%; height: 80px; background: #f1f5f9; border-radius: 6px; }
.recent-card strong { display: block; font-size: 12px; margin: 4px 0 2px; color: #0f172a; }
.recent-card__price { display: block; font-size: 12px; color: #64748b; font-weight: 700; }

/* ----- Custom badges en product cards ----- */
.product-card__badge--custom {
  position: absolute; z-index: 2;
  padding: 3px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: .03em;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

/* ----- Countdown en product cards ----- */
.product-card__countdown {
  position: absolute; bottom: 8px; left: 8px; right: 8px;
  text-align: center; z-index: 2;
  background: rgba(15,23,42,.85); color: #fbbf24;
  padding: 4px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .03em;
}
.product-card__countdown.is-ended { color: #64748b; }

/* ----- pmodal: Quick buy + Share + Tiers + Related ----- */
.pmodal__quickbuy {
  width: 100%; margin-top: 8px;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff; border: 0; padding: 12px; border-radius: 10px;
  font-weight: 700; cursor: pointer; transition: transform .15s;
}
.pmodal__quickbuy:hover { transform: translateY(-1px); }
.pmodal__share {
  width: 100%; margin-top: 6px;
  background: #f8fafc; color: #334155; border: 1px solid #cbd5e1;
  padding: 10px; border-radius: 10px; cursor: pointer;
}
.pmodal__share:hover { background: #e2e8f0; }

.pmodal__tiers { margin: 10px 0; padding: 10px; background: #fef3c7; border-radius: 8px; }
.pmodal__tiers-title {
  display: block; font-size: 12px; font-weight: 700;
  color: #78350f; margin-bottom: 6px;
}
.tier-chip {
  display: inline-block; padding: 4px 10px; margin: 2px 4px 2px 0;
  background: #fff; border: 1px solid #fbbf24; border-radius: 999px;
  font-size: 12px; color: #78350f;
}
.tier-chip.is-active {
  background: #fbbf24; color: #fff; font-weight: 700;
  box-shadow: 0 2px 6px rgba(245, 158, 11, .4);
}

.pmodal__related { margin-top: 18px; padding-top: 14px; border-top: 1px solid #e2e8f0; }
.pmodal__related h3 { font-size: 14px; margin: 0 0 10px; color: #475569; }
.pmodal__related-track { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.pmodal__related-card {
  flex: 0 0 auto; width: 120px; background: #fff;
  border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden;
  cursor: pointer; text-align: left; padding: 0;
}
.pmodal__related-card:hover { border-color: #2563eb; }
.pmodal__related-card img { width: 100%; height: 90px; object-fit: cover; display: block; }
.pmodal__related-empty { width: 100%; height: 90px; background: #f1f5f9; }
.pmodal__related-name { display: block; padding: 6px 8px 0; font-size: 12px; color: #0f172a; line-height: 1.2; }
.pmodal__related-card strong { display: block; padding: 2px 8px 8px; font-size: 13px; }

/* ----- Cart cross-sell ----- */
.cart-crosssell { margin: 14px 0 4px; }
.cart-crosssell__track { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; }
.crosssell-card {
  flex: 0 0 auto; width: 140px; background: #f8fafc;
  border: 1px solid #e2e8f0; border-radius: 10px; padding: 6px;
}
.crosssell-card img { width: 100%; height: 80px; object-fit: cover; border-radius: 6px; }
.crosssell-card__img-empty { width: 100%; height: 80px; background: #f1f5f9; border-radius: 6px; }
.crosssell-card__body strong { display: block; font-size: 12px; margin: 4px 0 2px; color: #0f172a; }
.crosssell-card__body span { display: block; font-size: 13px; font-weight: 800; color: #0f172a; margin-bottom: 4px; }
.crosssell-card__add {
  width: 100%; border: 0; background: #2563eb; color: #fff;
  padding: 5px 8px; border-radius: 6px; font-size: 11px; font-weight: 700;
  cursor: pointer;
}
.crosssell-card__add:hover { background: #1d4ed8; }
