/* ═══════════════════════════════════════════════════
   REX Kiosco — Catálogo
   Design: Urban · Bold · Mobile-first
   Palette: #E8341A (red) · #FF6500 (orange) · #FFCC00 (yellow) · #111 (dark)
   Fonts: Rubik (headings) · Nunito Sans (body)
   ═══════════════════════════════════════════════════ */

/* ─── Tokens ──────────────────────────────────────── */
:root {
  /* Brand */
  --rex-red:     #E8341A;
  --rex-orange:  #FF6500;
  --rex-yellow:  #FFCC00;
  --rex-dark:    #111111;
  --rex-dark-2:  #1C1C1C;

  /* Superficies */
  --bg:          #DDDDE3;   /* más oscuro para que las cards blancas destaquen */
  --surface:     #FFFFFF;
  --border:      #E0E0E6;
  --border-light:#EBEBEF;

  /* Texto */
  --text:        #111111;
  --text-2:      #4A4A52;
  --text-muted:  #9A9AA8;

  /* Precio */
  --precio:      #16A34A;

  /* Radios */
  --r-sm:  8px;
  --r-md:  14px;
  --r-lg:  20px;
  --r-pill:999px;

  /* Sombras */
  --sh-sm:   0 2px 8px rgba(0,0,0,.13);
  --sh-md:   0 4px 16px rgba(0,0,0,.13);
  --sh-hover:0 8px 24px rgba(0,0,0,.18);

  /* Layout */
  --header-h: 92px;

  /* Tipografía */
  --f-head: 'Rubik',       system-ui, sans-serif;
  --f-body: 'Nunito Sans', system-ui, sans-serif;

  /* Transición */
  --t: 200ms ease;
}

/* ─── Reset / Base ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--f-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Pattern en gris puro — elemento dedicado para poder aplicar filter: grayscale */
.bg-pattern {
  position: fixed;
  inset: -200px;
  z-index: -1;
  background-image: url('logo.png');
  background-size: 110px auto;
  background-repeat: repeat;
  filter: grayscale(1);
  opacity: .09;
  pointer-events: none;
  transform: rotate(-12deg);
}

img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font: inherit; }
a { text-decoration: none; color: inherit; }

/* Para que el atributo hidden funcione aunque otra regla declare display */
[hidden] { display: none !important; }

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ─── Header ──────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--rex-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  overflow: hidden;
}

/* Pattern de logos repetidos — fondo del header */
.site-header::before {
  content: '';
  position: absolute;
  inset: -30px;
  background-image: url('logo.png');
  background-size: 100px auto;
  background-repeat: repeat;
  opacity: .16;
  transform: rotate(-12deg);
  pointer-events: none;
}

/* Línea de gradiente al borde inferior */
.site-header::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: linear-gradient(90deg, var(--rex-red), var(--rex-orange), var(--rex-yellow));
  z-index: 2;
}

.logo-link {
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1;              /* encima del pattern */
}

@keyframes logoIn {
  0%   { opacity: 0; transform: scale(.72) translateY(-8px); }
  65%  { transform: scale(1.06) translateY(2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.site-logo {
  height: 148px;
  margin-top: -31px;
  margin-bottom: -25px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 10px rgba(0,0,0,.85));
  animation: logoIn .65s cubic-bezier(.34,1.56,.64,1) both;
}

/* ─── Desktop: header amplio ─────────────────────── */
@media (min-width: 768px) {
  :root { --header-h: 130px; }

  .site-logo {
    height: 148px;
    margin-top: -28px;
    margin-bottom: -28px;
  }

  /* Inset grande para que la rotación cubra esquinas en pantallas anchas */
  .site-header::before {
    inset: -300px;
    background-size: 120px auto;
    opacity: .15;
  }
}

/* ─── Filter bar ─────────────────────────────────── */
.filter-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: var(--header-h);
  z-index: 90;
}

/* Mobile: flex-column, el container ya da el padding horizontal */
.filter-bar-inner {
  padding-top: 10px;
  padding-bottom: 0;
}

/* ─── Buscador ────────────────────────────────────── */
.search-section {
  padding-bottom: 4px;
}

.search-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border-radius: var(--r-pill);
  padding: 0 12px;
  height: 36px;
  border: 1.5px solid var(--border);
}

.search-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--f-body);
  font-size: 16px;
  color: var(--text);
  line-height: 1;
  min-width: 0;
}

.search-input::placeholder { color: var(--text-muted); }

.search-clear {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--t);
}
.search-clear svg { width: 13px; height: 13px; color: var(--text-2); }
.search-clear:hover { background: #d5d5d8; }

/* ─── Categorías ──────────────────────────────────── */
.categories-section {
  overflow: hidden;  /* evita desborde horizontal */
}

.categories-track {
  display: flex;
  width: fit-content;   /* se dimensiona al contenido */
  max-width: 100%;      /* no desborda cuando hay muchos pills */
  margin: 0 auto;       /* se centra como bloque */
  gap: 8px;
  padding: 4px 0 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.categories-track::-webkit-scrollbar { display: none; }

/* ─── Desktop: una sola línea, ancho de grilla ──── */
@media (min-width: 768px) {
  .filter-bar-inner {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 20px;
    padding-top: 10px;
    padding-bottom: 10px;
    margin: 0 auto;
  }

  .search-section {
    flex-shrink: 0;
    width: 280px;
    padding-bottom: 0;
  }

  .categories-section {
    flex: 1;
    min-width: 0;
  }

  .categories-track {
    width: 100%;
    margin: 0;
    justify-content: flex-start;
    padding: 0;
  }
}

/* Pill base */
.cat-pill {
  flex-shrink: 0;
  scroll-snap-align: start;
  padding: 6px 11px;
  border-radius: var(--r-pill);
  font-family: var(--f-body);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  transition: all var(--t);
  border: 2px solid transparent;

  /* Colores del tema — sobreescritos por inline style o .is-active */
  background: var(--pill-bg, #E8E8EB);
  color:      var(--pill-color, var(--text));
}

.cat-pill:focus-visible {
  outline: 3px solid var(--rex-orange);
  outline-offset: 2px;
}

/* "Todos" — siempre oscuro */
.cat-pill.cat-all {
  background: var(--rex-dark-2);
  color: rgba(255,255,255,.65);
  border-color: var(--rex-dark-2);
}

/* "Todos" activo */
.cat-pill.cat-all.is-active {
  background: var(--rex-dark);
  color: #fff;
  border-color: var(--rex-dark);
}

/* Categoría activa — rojo de marca */
.cat-pill.is-active:not(.cat-all) {
  background: var(--rex-red) !important;
  color: #fff !important;
  border-color: var(--rex-red) !important;
  box-shadow: 0 2px 8px rgba(232,52,26,.35);
}

/* ─── Contenido principal ─────────────────────────── */
.main-content {
  flex: 1;
  padding: 16px 0 40px;
}

.results-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 14px;
  min-height: 18px;
}

/* ─── Grid de productos ───────────────────────────── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 480px) {
  .products-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 768px) {
  .products-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
}

@media (min-width: 1100px) {
  .products-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ─── Card ────────────────────────────────────────── */
.product-card {
  background: var(--surface);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--sh-sm);   /* solo sombra, sin border — evita el "borde blanco" */
  display: flex;
  flex-direction: column;
  animation: fadeUp .35s ease both;
  transition: box-shadow var(--t), transform var(--t);
}

/* Stagger de entrada */
.product-card:nth-child(1)  { animation-delay:   0ms; }
.product-card:nth-child(2)  { animation-delay:  35ms; }
.product-card:nth-child(3)  { animation-delay:  70ms; }
.product-card:nth-child(4)  { animation-delay: 105ms; }
.product-card:nth-child(5)  { animation-delay: 140ms; }
.product-card:nth-child(6)  { animation-delay: 175ms; }
.product-card:nth-child(n+7){ animation-delay: 200ms; }

@media (hover: hover) {
  .product-card:hover {
    box-shadow: var(--sh-hover);
    transform: translateY(-3px);
  }
}

/* Imagen */
.card-img-wrap {
  background: #FFFFFF;   /* igual al fondo blanco de las fotos de producto */
  padding: 12px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Cuerpo */
.card-body {
  padding: 10px 11px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Fila superior: marca · medida */
.card-meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
  overflow: hidden;
}

.card-marca {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.card-medida {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.card-modelo {
  font-family: var(--f-head);
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
}

.card-precio {
  font-family: 'Oswald', var(--f-head);
  font-size: 22px;
  font-weight: 700;
  color: #1E293B;
  margin-top: auto;
  padding-top: 6px;
  letter-spacing: .2px;
  line-height: 1;
}

/* Footer de la card — franja de categoría con badges */
.card-footer-strip {
  padding: 7px 11px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 34px;
}

.branch-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .2px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: rgba(0,0,0,.20);  /* oscuro sobre el strip de color vibrante */
  white-space: nowrap;
  line-height: 1.5;
  color: inherit;               /* hereda el blanco del .card-footer-strip */
}

/* ─── Skeleton ────────────────────────────────────── */
.card-skeleton {
  border-radius: var(--r-md);
  overflow: hidden;
  background: linear-gradient(90deg, #e8e8eb 25%, #f2f2f5 50%, #e8e8eb 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  /* Simula el aspecto de una card real:
     aspect-ratio 1:1 imagen + ~100px contenido */
  min-height: 260px;
}

/* ─── Estado vacío ────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px 80px;
  text-align: center;
  gap: 10px;
}

.empty-icon {
  width: 64px;
  height: 64px;
  color: var(--border);
  margin-bottom: 8px;
}

.empty-title {
  font-family: var(--f-head);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.empty-body {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.btn-reset {
  margin-top: 10px;
  padding: 11px 28px;
  background: var(--rex-red);
  color: #fff;
  border-radius: var(--r-pill);
  font-family: var(--f-body);
  font-size: 14px;
  font-weight: 700;
  transition: background var(--t), transform var(--t);
}

.btn-reset:hover { background: #c4281a; }
.btn-reset:active { transform: scale(.97); }

/* ─── Footer ──────────────────────────────────────── */
.site-footer {
  background: var(--rex-dark);
  padding: 22px 0 20px;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-copy {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,.45);
}

.footer-social {
  display: flex;
  gap: 18px;
}

.footer-social a {
  font-size: 18px;
  color: rgba(255,255,255,.55);
  transition: color var(--t);
}

.footer-social a:hover { color: #fff; }

/* ─── Footer right (WhatsApp + social) ───────────── */
.footer-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ─── WhatsApp FAB ────────────────────────────────── */
/* Mobile: círculo con solo el ícono */
.whatsapp-fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #25D366;
  color: #fff;
  text-decoration: none;
  font-size: 0;           /* oculta texto en mobile */
  box-shadow: 0 3px 10px rgba(37,211,102,.40);
  transition: background var(--t), transform var(--t), box-shadow var(--t);
  flex-shrink: 0;
}
.whatsapp-fab i { font-size: 17px; }
.whatsapp-label { display: none; }

.whatsapp-fab:hover {
  background: #1ebe5b;
  transform: scale(1.08);
  box-shadow: 0 5px 16px rgba(37,211,102,.55);
}
.whatsapp-fab:active { transform: scale(.92); }

/* Desktop: pill con texto */
@media (min-width: 768px) {
  .whatsapp-fab {
    width: auto;
    height: auto;
    border-radius: var(--r-pill);
    padding: 9px 18px;
    gap: 8px;
    font-family: var(--f-body);
    font-size: 14px;
    font-weight: 700;
  }
  .whatsapp-label { display: inline; }
}

.footer-update {
  margin-top: 14px;
  font-size: 11px;
  color: rgba(255,255,255,.25);
  font-weight: 500;
}

/* ─── Animaciones ─────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0%   { background-position: -800px 0; }
  100% { background-position:  800px 0; }
}

/* ─── Desktop: whiskys.html ──────────────────────── */
@media (min-width: 1024px) {
  /* Header más alto */
  :root { --header-h: 180px; }

  .site-logo {
    height: 200px;
    margin-top: -42px;
    margin-bottom: -42px;
  }

  .site-header::before {
    inset: -120px;
    background-size: 160px auto;
  }

  /* Body pattern más grande */
  .bg-pattern {
    background-size: 160px auto;
  }

  /* Filter bar desktop */
  .filter-bar-inner {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .search-wrapper {
    height: 46px;
  }

  .search-input { font-size: 17px; }

  .cat-pill {
    padding: 8px 16px;
    font-size: 14px;
    min-height: 40px;
  }

  .categories-track {
    padding: 6px 16px 10px;
  }

  /* Cards más grandes */
  .card-img-wrap { height: 200px; }

  .card-marca { font-size: 13px; }
  .card-modelo { font-size: 16px; }
  .card-precio { font-size: 26px; }

  .branch-badge { font-size: 11px; padding: 3px 10px; }
  .card-footer-strip { padding: 9px 14px; min-height: 38px; }
  .card-body { padding: 12px 14px 12px; }

  /* Footer más grande */
  .site-footer { padding: 28px 0 26px; }
  .footer-copy { font-size: 15px; }
  .footer-social a { font-size: 22px; }
  .footer-social { gap: 22px; }
  .footer-right { gap: 20px; }
  .footer-update { font-size: 13px; }
}

/* ─── Reducción de movimiento ─────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
