/* ============================================================
   css/styles.css — Estilos personalizados GSSP Mini Market
   Complementa Tailwind CSS con componentes y animaciones propias
   ============================================================ */

/* ── Variables CSS globales ─────────────────────────────── */
:root {
  --primary:       #2563EB;
  --primary-dark:  #1D4ED8;
  --accent:        #F97316;
  --accent-dark:   #EA580C;
  --whatsapp:      #25D366;
  --text:          #1E293B;
  --text-muted:    #64748B;
  --text-subtle:   #94A3B8;
  --bg:            #F0F4F8;
  --surface:       transparent;
  --border:        #afd0fc;
  --radius:        1rem;
  --shadow-card:   0 2px 8px rgba(30,58,138,0.08);
  --shadow-hover:  0 8px 24px rgba(30,58,138,0.14);
}

/* ── Reset y base ───────────────────────────────────────── */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Outfit', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* Quita la barra de scroll horizontal en la nav secundaria */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-style: none; }

/* Scrollbar global personalizada */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); }

/* Selección de texto */
::selection { background: #DBEAFE; color: #1E40AF; }

/* Focus accesible global */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ── Tipografía display ─────────────────────────────────── */
.font-display { font-family: 'Syne', system-ui, sans-serif; }

/* ── Hero Banner ────────────────────────────────────────── */
/* Gradiente principal del hero */
.hero-gradient {
  background: linear-gradient(90deg, #1b7cfc 25%, #4a8ee7 50%, #5995e2 75%);
}

/* Patrón de puntos del hero */
.hero-dots-pattern {
  background-image: radial-gradient(circle at 1.5px 1.5px, rgba(255,255,255,0.08) 1.5px, transparent 0);
  background-size: 28px 28px;
}

/* Subrayado decorativo SVG en "en Uruguay" */
.hero-underline {
  color: var(--accent);
  text-shadow: 0 0 24px rgba(249, 116, 22, 0.849);
}

/* Cards de trust en la fila inferior del hero */
.trust-card {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  transition: background 0.2s;
}
.trust-card:hover { background: rgba(255,255,255,0.14); }

/* ── Navegación (nav-link) ──────────────────────────────── */
.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0 0.25rem;
  height: 100%;
  display: inline-flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.nav-link:hover,
.nav-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── Grid de productos ──────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
@media (min-width: 640px)  { .product-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 768px)  { .product-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .product-grid { grid-template-columns: repeat(4, 1fr); } }

/* ── Skeleton Loader ────────────────────────────────────── */
/* Animación shimmer para el estado de carga */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.skeleton-block {
  background: linear-gradient(90deg, #5995e2 25%, #F1F5F9 50%, #E2E8F0 75%);
  background-size: 600px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: 6px;
}

/* ── Tarjeta de producto ────────────────────────────────── */
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: #BFDBFE; /* blue-200 */
}
/* Imagen de la tarjeta */
.product-card .card-img-wrap {
  position: relative;
  background: var(--bg);
  aspect-ratio: 1/1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.product-card .card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.625rem;
  transition: transform 0.3s ease;
}
.product-card:hover .card-img-wrap img {
  transform: scale(1.05);
}
/* Contenido de la tarjeta */
.product-card .card-body {
  padding: 0.875rem 1rem 1.125rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.5rem;
}
.product-card .card-title {
  font-size: 1rem;
  font-weight: 650;
  color: var(--text, --accent-dark);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4rem;
}
.product-card .card-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  margin-top: auto;
}
.product-card .card-price-label {
  font-size: 0.6875rem;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 0.125rem;
}

/* ── Botones ────────────────────────────────────────────── */
/* Botón WhatsApp verde */
.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--whatsapp);
  color: #fff;
  font-weight: 700;
  padding: 0.625rem 1.25rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.875rem;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(37,211,102,0.3);
  -webkit-tap-highlight-color: transparent;
}
.btn-whatsapp:hover  { background: #20b858; box-shadow: 0 4px 16px rgba(37,211,102,0.4); }
.btn-whatsapp:active { transform: scale(0.97); }

/* Botón naranja (acento) */
.btn-accent {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  padding: 0.625rem 1.25rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.875rem;
  transition: background 0.15s, transform 0.15s;
}
.btn-accent:hover  { background: var(--accent-dark); }
.btn-accent:active { transform: scale(0.97); }

/* Botón outline (azul) */
.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.625rem 1.25rem;
  border-radius: 0.75rem;
  border: 2px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  font-size: 0.875rem;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.btn-outline:hover  { border-color: var(--primary); color: var(--primary); background: #EFF6FF; }
.btn-outline:active { transform: scale(0.97); }

/* Botón "Agregar al carrito" dentro de la card */
.btn-add-cart {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  background: var(--whatsapp);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.6rem 0;
  border-radius: 0.625rem;
  border: none;
  cursor: pointer;
  margin-top: auto;
  transition: background 0.15s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-add-cart:hover  { background: #20b858; }
.btn-add-cart:active { transform: scale(0.97); }
/* Estado "añadido" momentáneo */
.btn-add-cart.added {
  background: var(--primary);
  pointer-events: none;
}

/* ── Badges ─────────────────────────────────────────────── */
.badge-accent {
  display: inline-block;
  background: #FFF7ED;
  color: var(--accent-dark);
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.2rem 0.625rem;
  border-radius: 99px;
  border: 1px solid #FED7AA;
}
.badge-blue {
  display: inline-block;
  background: #EFF6FF;
  color: #1D4ED8;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.2rem 0.625rem;
  border-radius: 99px;
  border: 1px solid #BFDBFE;
}

/* ── Cart badge animación ───────────────────────────────── */
@keyframes badge-bump {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.35); }
}
.badge-bump { animation: badge-bump 0.35s ease; }

/* ── Cart Drawer ────────────────────────────────────────── */
/* Backdrop blur */
#cart-overlay { backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }

/* Item del carrito */
.cart-item {
  display: flex;
  gap: 0.75rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 0.75rem;
}
.cart-item img {
  width: 3.5rem;
  height: 3.5rem;
  object-fit: contain;
  border-radius: 0.625rem;
  background: var(--bg);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.cart-item-name  { font-size: 0.8125rem; font-weight: 600; color: var(--text); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cart-item-price { font-size: 0.8125rem; font-weight: 700; color: var(--primary); margin-top: 0.25rem; }

/* Botones de cantidad */
.qty-btn {
  width: 1.625rem;
  height: 1.625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  border: 2px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  line-height: 1;
}
.qty-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ── Modal de Producto ──────────────────────────────────── */
/* Animación de entrada */
@keyframes modal-slide-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
#modal-content { animation: modal-slide-up 0.28s ease; }

/* Fade de imagen en galería */
@keyframes img-fade { from { opacity: 0; } to { opacity: 1; } }
.animate-fade { animation: img-fade 0.25s ease; }

/* ── Toast ──────────────────────────────────────────────── */
@keyframes toast-in  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; } }
.toast {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.75rem 1rem;
  border-radius: 0.875rem;
  box-shadow: var(--shadow-hover);
  animation: toast-in 0.25s ease;
  pointer-events: none;
  max-width: 280px;
}
.toast.success { border-color: #86EFAC; color: #15803D; }
.toast.error   { border-color: #FCA5A5; color: #B91C1C; }
.toast.hiding  { animation: toast-out 0.3s ease forwards; }

/* ── Banner mayoristas ──────────────────────────────────── */
.wholesale-banner {
  background: linear-gradient(to right, #FFF7ED, #FFFFFF, #FFF7ED);
  border: 2px solid rgba(249,115,22,0.25);
}

/* ── Contact cards ──────────────────────────────────────── */
.contact-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem 1rem;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.contact-card:hover { box-shadow: var(--shadow-hover); border-color: #BFDBFE; }

/* ── Botón WhatsApp flotante (pulso) ────────────────────── */
@keyframes wa-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(37,211,102,0.4); }
  50%      { box-shadow: 0 0 0 10px rgba(37,211,102,0); }
}
.wa-pulse { animation: wa-pulse 2.5s ease-in-out infinite; }

/* ── Imagen placeholder SVG ─────────────────────────────── */
/* Aplicado vía onerror en las <img> del modal y tarjetas */
img.img-error {
  padding: 2rem;
  background: var(--bg);
  object-fit: none;
}

/* ── Responsive extra ───────────────────────────────────── */
@media (max-width: 380px) {
  .product-grid { grid-template-columns: 1fr; }
  .product-card .card-title { font-size: 0.75rem; }
}

/* ── Utilidades varias ──────────────────────────────────── */
/* Smooth header shadow al hacer scroll (se activa con JS) */
#main-header.scrolled { box-shadow: 0 4px 16px rgba(30,58,138,0.1); }
