/* ============================================================================
   EXTRA — parche de utilidades faltantes del CSS compilado + toasts.
   El archivo base.css es el CSS compilado del diseño original; aquí solo se
   añade lo que la versión de código fuente necesita y no estaba en ese build.
   ========================================================================== */

/* Tipografía: la fuente Inter autoalojada (mismo nombre de variable que usa
   el original: --font-geist-sans). */
:root {
  --font-geist-sans: "Inter", ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-geist-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    monospace;
}

/* ------------------- Utilidades Tailwind faltantes ------------------------ */

.w-\[calc\(100\%-2rem\)\] {
  width: calc(100% - 2rem);
}
.max-w-\[calc\(100\%-2rem\)\] {
  max-width: calc(100% - 2rem);
}
.max-h-\(--radix-select-content-available-height\) {
  max-height: var(--radix-select-content-available-height, 16rem);
}
.h-\[var\(--radix-select-trigger-height\)\] {
  height: var(--radix-select-trigger-height, auto);
}
.min-w-\[var\(--radix-select-trigger-width\)\] {
  min-width: var(--radix-select-trigger-width, 8rem);
}

/* Ocultar la barra de scroll de la tira de categorías en navegadores webkit
   (igual que .catalog-scrollbar del original). */
.catalogo-scroll-x {
  scrollbar-width: thin;
  -ms-overflow-style: none;
}
.catalogo-scroll-x::-webkit-scrollbar {
  height: 6px;
}
.catalogo-scroll-x::-webkit-scrollbar-track {
  background: transparent;
}
.catalogo-scroll-x::-webkit-scrollbar-thumb {
  background-color: var(--muted-foreground);
  border-radius: 9999px;
}

/* ------------------------------- Toasts ---------------------------------- */
/* Reproduce el aspecto de los toasts de Sonner (posición inferior derecha,
   richColors, con botón de cerrar) usando los mismos colores que la librería. */
#raiz-toasts {
  position: fixed;
  z-index: 999999999;
  right: var(--toasts-offset, 16px);
  bottom: var(--toasts-offset, 16px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: var(--toasts-width, 356px);
  max-width: calc(100vw - 32px);
  margin: 0;
  padding: 0;
  list-style: none;
  outline: none;
  pointer-events: none;
}

.toast {
  position: relative;
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border-radius: 8px;
  border: 1px solid hsl(0 0% 92%);
  padding: 16px;
  box-shadow: 0 4px 12px hsl(0 0% 0% / 0.08), 0 10px 24px hsl(0 0% 0% / 0.12);
  background: hsl(0 0% 99%);
  color: hsl(0 0% 9%);
  font-size: 13px;
  animation: toast-entra 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  transition: opacity 0.25s, transform 0.25s;
}
.toast.toast-saliendo {
  opacity: 0;
  transform: translateY(8px);
}

@keyframes toast-entra {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast-icono {
  flex-shrink: 0;
  margin-top: 1px;
  display: inline-flex;
}
.toast-cuerpo {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.toast-titulo {
  font-weight: 500;
  line-height: 1.4;
  color: inherit;
}
.toast-descripcion {
  font-size: 12px;
  line-height: 1.5;
  color: hsl(0 0% 45%);
  overflow-wrap: anywhere;
}
.toast-cerrar {
  position: absolute;
  right: 4px;
  top: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
}
.toast-cerrar:hover {
  opacity: 1;
  background: hsl(0 0% 0% / 0.06);
}

/* Colores "rich" de Sonner (claro) */
.toast[data-tipo="success"] {
  background: hsl(143 85% 96%);
  border-color: hsl(145 92% 87%);
  color: hsl(140 100% 27%);
}
.toast[data-tipo="error"] {
  background: hsl(359 100% 97%);
  border-color: hsl(359 100% 94%);
  color: hsl(360 100% 45%);
}
.toast[data-tipo="info"] {
  background: hsl(208 100% 97%);
  border-color: hsl(221 91% 93%);
  color: hsl(210 92% 45%);
}
.toast[data-tipo="success"] .toast-descripcion,
.toast[data-tipo="error"] .toast-descripcion,
.toast[data-tipo="info"] .toast-descripcion {
  color: inherit;
  opacity: 0.9;
}

/* Modo oscuro (mismos valores de Sonner en tema oscuro) */
.dark .toast {
  background: hsl(0 0% 13%);
  border-color: hsl(0 0% 25%);
  color: hsl(0 0% 96%);
  box-shadow: 0 4px 12px hsl(0 0% 0% / 0.4), 0 10px 24px hsl(0 0% 0% / 0.5);
}
.dark .toast-descripcion {
  color: hsl(0 0% 91%);
}
.dark .toast[data-tipo="success"] {
  background: hsl(150 100% 6%);
  border-color: hsl(147 100% 12%);
  color: hsl(150 86% 65%);
}
.dark .toast[data-tipo="error"] {
  background: hsl(359 100% 7%);
  border-color: hsl(359 100% 14%);
  color: hsl(358 79% 71%);
}
.dark .toast[data-tipo="info"] {
  background: hsl(215 100% 6%);
  border-color: hsl(223 43% 17%);
  color: hsl(216 87% 65%);
}
.dark .toast[data-tipo="success"] .toast-descripcion,
.dark .toast[data-tipo="error"] .toast-descripcion,
.dark .toast[data-tipo="info"] .toast-descripcion {
  color: inherit;
  opacity: 0.9;
}
.dark .toast-cerrar:hover {
  background: hsl(0 0% 100% / 0.1);
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    animation: none;
    transition: none;
  }
}

/* En móvil los toasts ocupan casi todo el ancho (como Sonner). */
@media (max-width: 480px) {
  #raiz-toasts {
    left: 16px;
    right: 16px;
    width: auto;
    max-width: none;
  }
}

/* ============================================================================
   ANIMACIONES — equivalentes CSS de las transiciones de framer-motion
   usadas por el original (tarjetas, paneles, modales, barras flotantes).
   ========================================================================== */

/* Tarjeta de producto: initial {opacity:0, y:12} → whileInView (0.3s). */
@keyframes catalogo-tarjeta-entra {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.anim-tarjeta {
  animation: catalogo-tarjeta-entra 0.3s ease-out both;
}

/* Tarjeta destacada: initial {opacity:0, x:20} → whileInView (0.3s). */
@keyframes catalogo-destacada-entra {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.anim-destacada {
  animation: catalogo-destacada-entra 0.3s ease-out both;
}

/* Visto recientemente: initial {opacity:0, y:6} (0.25s). */
@keyframes catalogo-visto-entra {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.anim-visto {
  animation: catalogo-visto-entra 0.25s ease-out both;
}

/* Banner de anuncio: height 0 → auto + fade (AnimatePresence). */
@keyframes catalogo-anuncio-entra {
  from { opacity: 0; max-height: 0; }
  to   { opacity: 1; max-height: 80px; }
}
.anim-anuncio {
  animation: catalogo-anuncio-entra 0.3s ease-out both;
}

/* Fondo (backdrop) de overlays: opacity 0 → 1 (0.2s). */
@keyframes catalogo-aparecer {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.anim-aparecer {
  animation: catalogo-aparecer 0.2s ease-out both;
}

/* Modales centrales: initial {opacity:0, scale:0.96, y:12}
   (0.22s, cubic-bezier(0.22, 1, 0.36, 1) — la curva de framer). */
@keyframes catalogo-modal-entra {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.anim-modal {
  animation: catalogo-modal-entra 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Paneles laterales (carrito/favoritos): x: 100% → 0 (tween 0.28s). */
@keyframes catalogo-panel-entra {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
.anim-panel {
  animation: catalogo-panel-entra 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Barra de comparación: initial {y:100, opacity:0} (spring).
   OJO: el elemento usa left-1/2 -translate-x-1/2 (propiedad `translate`
   de Tailwind v4), por eso la animación también usa `translate`. */
@keyframes catalogo-subir-entra {
  from { opacity: 0; translate: -50% 100px; }
  60%  { opacity: 1; translate: -50% -8px; }
  to   { opacity: 1; translate: -50% 0; }
}
.anim-subir {
  animation: catalogo-subir-entra 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Píldoras flotantes y volver arriba: scale 0.6 → 1 (0.2s). */
@keyframes catalogo-flotante-entra {
  from { opacity: 0; transform: scale(0.6) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.anim-flotante {
  animation: catalogo-flotante-entra 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Imagen ampliada (zoom): scale 0.92 → 1 (0.22s). */
@keyframes catalogo-zoom-entra {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
.anim-zoom {
  animation: catalogo-zoom-entra 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Panel de precio plegable (AnimatePresence height:0 → auto). */
.panel-precio {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.3s ease, opacity 0.3s ease;
}
.panel-precio > div {
  overflow: hidden;
  min-height: 0;
}
.panel-precio.panel-abierto {
  grid-template-rows: 1fr;
  opacity: 1;
}

/* Utilidades del original ausentes del build compilado. */
.text-destructive-foreground {
  color: var(--destructive-foreground, var(--destructive));
}
.hover\:text-destructive-foreground:hover {
  color: var(--destructive-foreground, var(--destructive));
}

/* Accesibilidad: sin animaciones si el usuario lo prefiere. */
@media (prefers-reduced-motion: reduce) {
  .anim-tarjeta,
  .anim-destacada,
  .anim-visto,
  .anim-anuncio,
  .anim-aparecer,
  .anim-modal,
  .anim-panel,
  .anim-subir,
  .anim-flotante,
  .anim-zoom {
    animation: none;
  }
  .panel-precio {
    transition: none;
  }
}
