/* ---------- Fuentes ---------- */
@font-face {
  font-family: "Hanson";
  src: url("../assets/fonts/Hanson-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root,
[data-theme="dark"] {
  --bg: #000000;
  --surface: #0e0e0e;
  --surface-2: #1a1a1a;
  --ink: #ffffff;
  --ink-soft: #b6b6b6;
  --muted: #6e6e6e;
  --line: rgba(255,255,255,0.12);
  --pill-active-bg: #ffffff;
  --pill-active-ink: #000000;
  --tabbar-bg: rgba(20,20,20,0.92);
  --tabbar-border: rgba(255,255,255,0.08);
  --tabbar-overlay-bg: #ffffff;
  --tabbar-overlay-ink: #000000;
  --tabbar-base-ink: #6e6e6e;
}

[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f5f5f5;
  --surface-2: #ececec;
  --ink: #0a0a0a;
  --ink-soft: #555555;
  --muted: #8e8e8e;
  --line: rgba(0,0,0,0.10);
  --pill-active-bg: #000000;
  --pill-active-ink: #ffffff;
  --tabbar-bg: rgba(255,255,255,0.92);
  --tabbar-border: rgba(0,0,0,0.08);
  --tabbar-overlay-bg: #000000;
  --tabbar-overlay-ink: #ffffff;
  --tabbar-base-ink: #888888;
}

:root {
  --accent: #ff3b3b;
  --pill-bg: transparent;
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.32, 0.72, 0.24, 1);
  --ease-bounce: cubic-bezier(0.34, 1.4, 0.64, 1);
  --font-display: "Hanson", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
  /* mobile: que el scroll sea fluido sin bounces del background */
  overscroll-behavior-y: none;
  /* color de la barra de status del navegador */
}

/* viewport seguro: que la barra superior del navegador no superponga */
@supports (height: 100dvh) {
  .app { min-height: 100dvh; }
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }

.app {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  /* padding bottom = altura del tabbar (~70) + gap (14) + safe area */
  padding:
    calc(20px + env(safe-area-inset-top, 0px))
    18px
    calc(120px + env(safe-area-inset-bottom, 0px));
  position: relative;
  overflow-x: hidden;
  animation: fadeIn 0.45s var(--ease) both;
}

/* Sin transform — un transform en .app rompería el position:fixed del tabbar */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---------- Morphing liquid text (header) ---------- */
.morph {
  position: relative;
  display: inline-block;
  line-height: 1;
  filter: url(#threshold) blur(0.6px);
  vertical-align: top;
}
.morph__sizer { visibility: hidden; white-space: nowrap; }
.morph__a, .morph__b {
  position: absolute;
  inset: 0;
  white-space: nowrap;
  font: inherit;
  color: inherit;
}

/* ---------- Header ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 2px 18px;
}

.greeting {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--ink);
  letter-spacing: 0.4px;
  line-height: 1;
}

.app-header__actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--ink);
  border-radius: 50%;
  transition: background 0.25s var(--ease), transform 0.18s var(--ease-bounce);
}
.icon-btn:hover { background: var(--surface); }
.icon-btn:active { transform: scale(0.92); }

.icon-btn__badge {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg);
}

/* ---------- Hero carrusel ---------- */
.hero { position: relative; }

.hero__track {
  display: flex;
  width: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-xl);
  gap: 0;
}
.hero__track::-webkit-scrollbar { display: none; }

.hero__slide {
  position: relative;
  flex: 0 0 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  border-radius: var(--radius-xl);
  overflow: hidden;
  aspect-ratio: 4 / 3.2;
  background: var(--surface);
}

.hero__media {
  position: absolute;
  inset: 0;
}

.hero__video,
.hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
}

.hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.1) 30%, rgba(0,0,0,0.85) 100%);
}

.hero__copy {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 22px;
  color: #fff;
}

.hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  line-height: 1;
  letter-spacing: 0.4px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.hero__subtitle {
  margin: 8px 0 0;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  opacity: 0.9;
  max-width: 92%;
  text-shadow: 0 1px 6px rgba(0,0,0,0.5);
}

.hero__dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}

.hero__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  transition: width 0.35s var(--ease), background 0.3s var(--ease);
  cursor: pointer;
}
.hero__dot.is-active {
  width: 20px;
  border-radius: 999px;
  background: #fff;
}

/* ---------- Filtros ---------- */
.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 16px 0 6px;
  scrollbar-width: none;
  scroll-behavior: smooth;
}
.filters::-webkit-scrollbar { display: none; }

.filter-pill {
  flex: 0 0 auto;
  padding: 9px 20px;
  border-radius: 999px;
  background: var(--pill-bg);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  border: 1.5px solid var(--line);
  transition: background 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease), transform 0.18s var(--ease-bounce);
}

.filter-pill.is-active {
  background: var(--pill-active-bg);
  color: var(--pill-active-ink);
  border-color: var(--pill-active-bg);
}

.filter-pill:active { transform: scale(0.94); }


/* ---------- Secciones ---------- */
.section { margin-top: 24px; }

.section__title {
  margin: 0 0 14px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 22px;
  color: var(--ink);
  letter-spacing: 0;
  line-height: 1.1;
}

/* ---------- Carrusel productos ---------- */
.carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 2px 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.carousel::-webkit-scrollbar { display: none; }

.card {
  flex: 0 0 44%;
  scroll-snap-align: start;
  background: transparent;
  transition: transform 0.25s var(--ease);
  animation: slideIn 0.45s var(--ease) both;
}
.card:active { transform: scale(0.97); }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card__img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-2);
}

.card__fallback,
.card__fallback svg,
.card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__img { z-index: 1; transition: transform 0.6s var(--ease); }
.card__fallback { z-index: 0; }

.card:hover .card__img { transform: scale(1.06); }

.card__fav {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  color: #fff;
  z-index: 3;
  transition: transform 0.2s var(--ease-bounce), background 0.25s var(--ease);
}
.card__fav:hover { background: rgba(0,0,0,0.6); }
.card__fav.is-active {
  background: var(--accent);
  color: #fff;
  transform: scale(1.08);
}
.card__fav.is-active svg { fill: currentColor; }

.card__body { padding: 8px 2px 0; }

.card__title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-body);
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__category {
  display: block;
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  margin-top: 1px;
}

.card__price {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 4px;
}

/* ---------- Card tienda ---------- */
.carousel--shops .shop-card {
  flex: 0 0 78%;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  scroll-snap-align: start;
  transition: transform 0.25s var(--ease);
  animation: slideIn 0.45s var(--ease) both;
  background: var(--surface-2);
}

.shop-card:active { transform: scale(0.98); }

.shop-card__img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.shop-card__fallback,
.shop-card__fallback svg,
.shop-card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.shop-card__img { z-index: 1; transition: transform 0.6s var(--ease); }
.shop-card__fallback { z-index: 0; }

.shop-card:hover .shop-card__img { transform: scale(1.05); }

.shop-card__body { padding: 10px 4px 6px; }

.shop-card__name {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  color: #fff;
}

.shop-card__meta {
  font-size: 11px;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}
.shop-card__meta svg { color: #fff; }

/* ---------- Tabbar inferior (Animated Tabs) ---------- */
.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  width: calc(100% - 28px);
  max-width: 402px;
  background: var(--tabbar-bg);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--tabbar-border);
  padding: 6px;
  border-radius: 999px;
  box-shadow: 0 14px 38px rgba(0,0,0,0.55);
  z-index: 100;
  /* prevenimos que el tabbar se mueva con scroll en iOS */
  will-change: transform;
  animation: dropIn 0.45s var(--ease) both 0.15s;
}

@keyframes dropIn {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* Base: tabs apagadas */
.tabbar__base {
  position: relative;
  display: flex;
  width: 100%;
  z-index: 1;
}

/* Overlay: capa blanca, recortada con clip-path al tab activo */
.tabbar__overlay {
  position: absolute;
  inset: 6px;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
  clip-path: inset(0 75% 0 0 round 999px);
  transition: clip-path 0.42s cubic-bezier(0.32, 0.72, 0.24, 1);
}

.tabbar__overlay-inner {
  display: flex;
  width: 100%;
  height: 100%;
  background: var(--tabbar-overlay-bg);
  border-radius: 999px;
}

.tab {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--tabbar-base-ink);
  padding: 8px 4px;
  border-radius: 999px;
  background: transparent;
  transition: transform 0.18s var(--ease-bounce);
}

.tab span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
  font-family: var(--font-body);
}

/* Tabs en la capa overlay: color que contrasta con el fondo */
.tabbar__overlay .tab {
  color: var(--tabbar-overlay-ink);
}

.tab:active { transform: scale(0.93); }

/* ---------- Timer Subasta ---------- */
.timer {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-family: "SF Mono", "Menlo", monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
  letter-spacing: 0.5px;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.timer__icon { color: #fff; opacity: 0.85; }
.timer__digit {
  display: inline-block;
  min-width: 18px;
  text-align: center;
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}
.timer__digit.flip {
  animation: digitFlip 0.4s var(--ease) both;
}
@keyframes digitFlip {
  0%   { transform: translateY(-6px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* ---------- Ripple ---------- */
.ripple-container { position: relative; overflow: hidden; }
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0);
  animation: rippleOut 0.6s linear forwards;
  pointer-events: none;
}
@keyframes rippleOut {
  to { transform: scale(2.5); opacity: 0; }
}

/* ---------- Heart explosion ---------- */
.heart-burst {
  position: absolute;
  pointer-events: none;
  width: 1px;
  height: 1px;
  color: var(--accent);
}
.heart-burst svg {
  position: absolute;
  top: 0; left: 0;
  width: 12px;
  height: 12px;
  transform: translate(-50%, -50%);
  animation: heartFly 0.7s ease-out forwards;
}
@keyframes heartFly {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(0.4); }
  60%  { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx, 0), var(--dy, -28px)) scale(1.1); }
}

/* ---------- Card favorite del shop ---------- */
.shop-card { position: relative; }
.shop-card__fav {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  color: #fff;
  z-index: 3;
  transition: transform 0.2s var(--ease-bounce), background 0.25s var(--ease);
}
.shop-card__fav:hover { background: rgba(0,0,0,0.7); }
.shop-card__fav.is-active {
  background: var(--accent);
  transform: scale(1.06);
}
.shop-card__fav.is-active svg { fill: currentColor; }

/* ---------- Desktop ---------- */
@media (min-width: 640px) {
  .app {
    margin-top: 24px;
    margin-bottom: 24px;
    min-height: calc(100vh - 48px);
    border-radius: 32px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  }
  .tabbar { bottom: 38px; }
}

/* ---------- Accesibilidad ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
