/* ═══════════════════════════════════════════════════
   UDRINK · Mis favoritos · Propuesta B v2
   CSS externo — solo lo que Tailwind no cubre:
   gradientes complejos, animaciones, pseudo-elementos,
   sombras de filtro y efectos de marca propios.
   ═══════════════════════════════════════════════════ */

/* ── Tokens ── */
:root {
  --ud-primary:       #1152D4;
  --ud-primary-hover: #0F4BC4;
  --ud-primary-soft:  #E7EBF3;
  --ud-secondary:     #2A344D;
  --ud-inverted:      #0D121B;
  --ud-surface:       #FFFFFF;
  --ud-background:    #F6F7F8;
  --ud-border:        #E7EBF3;
  --ud-border-strong: #CFDBE7;
  --ud-text:          #0D121B;
  --ud-muted:         #4C739A;
  --ud-soft:          #7A8BA0;
  --ud-danger:        #C03030;
  --ud-success:       #059669;
  --ud-shadow:        0 2px 8px rgba(13,18,27,.06), 0 1px 2px rgba(13,18,27,.04);
  --ud-shadow-md:     0 8px 24px rgba(13,18,27,.08), 0 2px 6px rgba(13,18,27,.05);
  --ud-shadow-blue:   0 10px 28px rgba(17,82,212,.28), 0 2px 6px rgba(17,82,212,.12);
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--ud-background);
  color: var(--ud-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; }

/* ── BG decoración ── */
.bg-deco {
  position: fixed; inset: 0;
  z-index: 0; pointer-events: none; overflow: hidden;
}
.blob {
  position: absolute; border-radius: 50%; filter: blur(80px);
}
.blob-1 {
  width: 560px; height: 560px;
  background: radial-gradient(circle, rgba(17,82,212,.22), transparent 70%);
  top: -180px; right: -140px;
  animation: blob-float 20s ease-in-out infinite;
}
.blob-2 {
  width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(251,191,36,.14), transparent 70%);
  bottom: -160px; left: -140px;
  animation: blob-float 26s ease-in-out infinite reverse;
}
.grid-pattern {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(13,18,27,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13,18,27,.025) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 40%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 40%, transparent 85%);
}
@keyframes blob-float {
  0%, 100% { transform: translate(0,0) scale(1); }
  50%       { transform: translate(40px,-40px) scale(1.06); }
}

/* ── Header glassmorphism ── */
.ud-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--ud-border);
}

/* ── Logo ── */
.ud-logo {
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.35), transparent 55%),
    linear-gradient(135deg, var(--ud-primary), var(--ud-secondary));
  box-shadow: 0 6px 16px rgba(17,82,212,.3);
}

/* ── Back link ── */
.ud-back {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px;
  font-size: 12px; font-weight: 600;
  color: var(--ud-muted);
  background: var(--ud-surface);
  border: 1px solid var(--ud-border);
  text-decoration: none;
  transition: color .15s, border-color .15s;
}
.ud-back:hover { color: var(--ud-text); border-color: var(--ud-border-strong); }

/* ── Hero title accent (gradient text) ── */
.hero-accent {
  background: linear-gradient(110deg, var(--ud-danger) 0%, #EF4444 40%, #F97316 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ── Category filter ── */
.cats-bar { scrollbar-width: none; }
.cats-bar::-webkit-scrollbar { display: none; }

.cat {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 15px;
  background: var(--ud-surface);
  border: 1.5px solid var(--ud-border);
  border-radius: 13px;
  font-size: 13px; font-weight: 600;
  color: var(--ud-text);
  white-space: nowrap;
  cursor: pointer;
  transition: all .18s ease;
}
.cat:hover {
  border-color: var(--ud-border-strong);
  transform: translateY(-1px);
}
.cat.is-active {
  background: var(--ud-primary);
  border-color: var(--ud-primary);
  color: white;
  box-shadow: var(--ud-shadow-blue);
}
.cat__icon { width: 15px; height: 15px; flex-shrink: 0; }
.cat__count {
  padding: 1px 7px;
  background: var(--ud-primary-soft);
  color: var(--ud-primary);
  border-radius: 999px;
  font-size: 11px; font-weight: 700;
  line-height: 1.5;
}
.cat.is-active .cat__count { background: rgba(255,255,255,.25); color: white; }

/* ── Grid responsivo: cada card máximo 200px aunque haya solo 1 ── */
.prod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 200px));
  justify-content: start;
}
@media (min-width: 640px) {
  .prod-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 210px)); }
}

/* ── Product card ── */
.prod {
  background: var(--ud-surface);
  border: 1.5px solid var(--ud-border);
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  display: flex; flex-direction: column;
  transition: all .28s cubic-bezier(.22,1,.36,1);
}
.prod:hover {
  border-color: var(--ud-border-strong);
  transform: translateY(-3px);
  box-shadow: var(--ud-shadow-md);
}
.prod.is-removing {
  opacity: 0;
  transform: scale(.93);
  transition: all .28s ease;
}

/* Media (image area) */
.prod__media {
  position: relative;
  aspect-ratio: 1.05 / 1;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  padding: 0;
}
.prod__media--destilados {
  background:
    radial-gradient(ellipse 100% 60% at 50% 110%, rgba(180,83,9,.26) 0%, transparent 65%),
    radial-gradient(ellipse at 28% 18%, #FFFBEB 0%, #FEF3C7 35%, #FBBF24 100%);
}
.prod__media--mixers {
  background:
    radial-gradient(ellipse 100% 60% at 50% 110%, rgba(14,116,144,.28) 0%, transparent 65%),
    radial-gradient(ellipse at 28% 18%, #ECFEFF 0%, #CFFAFE 35%, #22D3EE 100%);
}
.prod__media--snacks {
  background:
    radial-gradient(ellipse 100% 60% at 50% 110%, rgba(194,65,12,.26) 0%, transparent 65%),
    radial-gradient(ellipse at 28% 18%, #FFF7ED 0%, #FED7AA 35%, #FB923C 100%);
}
.prod__media::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 8%;
  height: 6px; margin: 0 14%;
  background: radial-gradient(ellipse at center, rgba(13,18,27,.28), transparent 70%);
  filter: blur(3px);
  pointer-events: none;
}

.prod__img {
  position: relative; z-index: 1;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .35s cubic-bezier(.22,1,.36,1);
}
.prod:hover .prod__img { transform: translateY(-4px) rotate(-2deg); }

/* Tag */
.prod__tag {
  position: absolute; top: 10px; left: 10px;
  padding: 4px 9px;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(6px);
  border-radius: 8px;
  font-size: 10px; font-weight: 800; letter-spacing: .03em;
  text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 4px;
  box-shadow: 0 2px 6px rgba(13,18,27,.1);
  z-index: 2; line-height: 1.2;
}
.prod__tag--pop { color: #C2410C; }
.prod__tag--rec { color: var(--ud-primary); }
.prod__tag--new { color: #0E7490; }

/* Remove button (filled heart — quitar de favoritos) */
.prod__remove {
  position: absolute; top: 8px; right: 8px;
  width: 34px; height: 34px;
  border-radius: 11px;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(8px);
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(13,18,27,.08);
  transition: all .2s;
  padding: 0;
}
.prod__remove:hover {
  background: #FEE2E2;
  transform: scale(1.1);
}
.prod__remove:hover svg { transform: scale(1.15); }
.prod__remove svg { transition: transform .2s; }

/* ── Card info section ── */
.prod__info {
  padding: 12px 12px 14px;
  display: flex; flex-direction: column;
  gap: 4px;
  flex: 1;
}
@media (min-width: 640px) { .prod__info { padding: 14px; } }

.prod__name {
  font-size: 13px; font-weight: 700;
  color: var(--ud-text); line-height: 1.28;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.56em;
}
@media (min-width: 640px) { .prod__name { font-size: 14px; } }
@media (max-width: 400px) { .prod__name { font-size: 12px; } }

.prod__meta {
  font-size: 11px; color: var(--ud-muted);
  margin: 0; line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (min-width: 640px) { .prod__meta { -webkit-line-clamp: 2; } }

.prod__price {
  font-size: 15px; font-weight: 800;
  color: var(--ud-text);
  letter-spacing: -.02em; line-height: 1;
  margin: 4px 0 0;
}
@media (min-width: 640px) { .prod__price { font-size: 17px; } }
@media (max-width: 400px) { .prod__price { font-size: 14px; } }

.prod__unit {
  font-size: 10px; color: var(--ud-soft);
  font-weight: 500; margin-top: 2px;
}

/* ── Agregar al carrito CTA ── */
.prod__add-btn {
  position: relative;
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--ud-primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  overflow: hidden;
  transition: all .22s cubic-bezier(.22,1,.36,1);
  letter-spacing: -.01em;
  box-shadow: 0 4px 10px rgba(17,82,212,.22);
}
@media (min-width: 640px) {
  .prod__add-btn { font-size: 13px; padding: 11px 14px; }
}
.prod__add-btn::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform .7s cubic-bezier(.22,1,.36,1);
  pointer-events: none;
}
.prod__add-btn:hover { background: var(--ud-primary-hover); transform: translateY(-1px); box-shadow: 0 6px 14px rgba(17,82,212,.35); }
.prod__add-btn:hover::before { transform: translateX(100%); }
.prod__add-btn:active { transform: translateY(0); }
.prod__add-btn.is-added {
  background: var(--ud-success);
  box-shadow: 0 4px 10px rgba(5,150,105,.28);
  animation: add-pop .35s cubic-bezier(.22,1,.36,1);
}
@keyframes add-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* ── Empty state ── */
.empty-fav {
  grid-column: 1 / -1;
  padding: 56px 20px;
  text-align: center;
  background: var(--ud-surface);
  border: 1.5px dashed var(--ud-border-strong);
  border-radius: 20px;
  display: none;
}
.empty-fav.is-visible { display: block; }
.empty-fav__heart {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  border-radius: 18px;
  background: #FEE2E2;
  display: flex; align-items: center; justify-content: center;
}
.empty-fav__cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px;
  background: var(--ud-primary);
  color: white;
  border-radius: 12px;
  font-size: 13px; font-weight: 700;
  text-decoration: none;
  border: none;
  box-shadow: var(--ud-shadow-blue);
  transition: all .2s;
}
.empty-fav__cta:hover { background: var(--ud-primary-hover); transform: translateY(-1px); }

/* ── Toast ── */
.toast {
  position: fixed;
  top: 82px; left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--ud-inverted);
  color: white;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 12px 30px rgba(13,18,27,.3);
  z-index: 100;
  opacity: 0;
  transition: all .32s cubic-bezier(.22,1,.36,1);
  pointer-events: none;
  display: flex; align-items: center; gap: 9px;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ud-success); flex-shrink: 0; }
.toast__dot--warn { background: #F59E0B; }

/* ── Float +1 ── */
.float-plus {
  position: fixed; pointer-events: none; z-index: 200;
  font-size: 18px; font-weight: 800;
  color: var(--ud-primary);
  animation: float-up .9s cubic-bezier(.22,1,.36,1) forwards;
  text-shadow: 0 4px 10px rgba(17,82,212,.35);
}
@keyframes float-up {
  0%   { opacity: 0; transform: translate(-50%,-50%) scale(.5); }
  25%  { opacity: 1; transform: translate(-50%,-70%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%,-150%) scale(1); }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* RN-11 · Badge "Sin stock" y bloqueo visual */
.prod.is-out-of-stock { opacity: .7; }
.prod.is-out-of-stock .prod__add-btn { cursor: not-allowed; opacity: .5; pointer-events: none; }
.prod__stock-badge {
  position: absolute; top: 8px; left: 8px;
  background: #C03030; color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: .3px;
  padding: 3px 8px; border-radius: 999px;
  z-index: 3;
}

/* RN-09 · Rollback: clase transitoria para fade-in al revertir (si fuera necesario) */
.prod:not(.is-removing)[data-removing="false"] { animation: none; }

/* Loader de página */
.prod-grid__loading {
  text-align: center; color: #4C739A; font-size: 14px; padding: 24px 0;
}
