/*──────────────────────────────────────────────────────────────
  main.css – ZonaRepuestera
  Última actualización: 2025-10-XX
──────────────────────────────────────────────────────────────*/

/*──────────────────────────────────────────────────────────────
  0. Variables globales
──────────────────────────────────────────────────────────────*/
:root {
  --zr-orange: #f47a20;
  /* color corporativo */
  --zr-font-family: 'Inter', sans-serif;
  --zr-text-color: #111;
}

html,
body {
  font-family: var(--zr-font-family);
  color: var(--zr-text-color);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--zr-text-color);
}

/*──────────────────────────────────────────────────────────────
  1. Utilidades
──────────────────────────────────────────────────────────────*/
.text-orange {
  color: var(--zr-orange) !important;
}

/*──────────────────────────────────────────────────────────────
  2. Barra de categorías – diseño moderno con celdas
──────────────────────────────────────────────────────────────*/
.categories-menu {
  width: 100%;
  background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%);
  border-bottom: 2px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  z-index: 1030;
  position: relative;
  overflow: visible;
}

/* Contenedor principal - sin scroll, solo layout */
.categories-scroll-wrapper {
  width: 100%;
  position: relative;
  display: flex;
  align-items: stretch;
  overflow: visible;
}

/* =========================================
   CATEGORIES MENU (SUBMENU)
   ========================================= */
.categories-menu {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  position: relative;
  z-index: 1020;
  height: 50px;
  /* Altura fija compacta */
}

/* Ocultar en móvil */
@media (max-width: 991px) {
  .categories-menu {
    display: none !important;
  }
}

.categories-scroll-wrapper {
  position: relative;
  width: 100%;
  /* Ocupar todo el ancho */
  margin: 0;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0;
  /* Sin padding lateral */
  background: #fff;
}

.categories-inner-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE/Edge */
  height: 100%;
  display: flex;
  align-items: center;
  width: 100%;
}

.categories-inner-scroll::-webkit-scrollbar {
  display: none;
}

#categories-list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  height: 100%;
  align-items: center;
  width: 100%;
  justify-content: space-between;
  /* Distribuir uniformemente */
}

#categories-list .nav-item {
  height: 100%;
  display: flex;
  align-items: center;
  flex: 1;
  /* Que todos ocupen el mismo espacio si es posible */
  justify-content: center;
  border-right: none;
  /* SIN separador vertical */
}

#categories-list .nav-item:last-child {
  border-right: none;
}

/* Estilos para los enlaces del menú de categorías */
#categories-list .nav-item .nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  /* Gap mínimo */
  padding: 0 0.1rem;
  /* Padding mínimo */
  color: #F47A20 !important;
  font-weight: 700;
  font-size: 0.7rem;
  /* Texto más pequeño */
  text-decoration: none;
  height: 100%;
  width: 100%;
  transition: all 0.2s ease;
  white-space: nowrap;
}

/* Estado Hover y Focus - SIN FONDO NI BORDES */
#categories-list .nav-item .nav-link:hover,
#categories-list .nav-item .nav-link:focus,
#categories-list .nav-item .nav-link:active {
  color: #d85a0a !important;
  background-color: transparent !important;
  /* Sin fondo */
  outline: none !important;
  /* Sin borde azul */
  box-shadow: none !important;
}

/* Estilos para Iconos (Siempre negros) */
#categories-list .nav-item .nav-link i,
#categories-list .nav-item .nav-link img {
  font-size: 0.85rem;
  /* Icono más pequeño */
  color: #000000 !important;
  width: 14px;
  /* Ancho reducido */
  text-align: center;
}

/* Asegurar que el icono no cambie de color al hover si no se desea */
#categories-list .nav-item .nav-link:hover i {
  color: #000000 !important;
}

.category-nav-btn:active {
  background: linear-gradient(135deg, #d65a00 0%, #b84800 100%);
}

.category-nav-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  background: linear-gradient(to right, rgba(243, 244, 246, 0.8) 0%, rgba(229, 231, 235, 0.8) 100%);
}

#categories-list {
  display: inline-flex;
  align-items: stretch;
  justify-content: center;
  flex-wrap: nowrap !important;
  gap: 0;
  padding: 0;
  margin: 0 auto;
  list-style: none;
  min-width: 100%;
  width: max-content;
  overflow: visible;
}

/* Scrollbar para el contenedor de categorías */
.categories-scroll-wrapper::-webkit-scrollbar {
  height: 4px;
}

.categories-scroll-wrapper::-webkit-scrollbar-track {
  background: #f3f4f6;
}

.categories-scroll-wrapper::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

.categories-scroll-wrapper::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

#categories-list>li {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  flex-shrink: 0;
  border-right: 1px solid #e5e7eb;
  overflow: visible;
}

#categories-list>li:first-child {
  border-left: 1px solid #e5e7eb;
}

/* Puente invisible para mantener el dropdown visible durante el hover */
#categories-list>li::after {
  content: "";
  position: absolute;
  left: 0;
  top: 100%;
  width: 100%;
  height: 8px;
  background: transparent;
  z-index: 12999;
}

/* Celda de categoría - toda la celda es clickeable y tiene hover */
#categories-list .nav-link {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 1.2rem !important;
  min-height: 52px;
  border: none;
  background: transparent;
  font-weight: 600;
  font-size: clamp(12px, 0.95vw, 14px);
  color: #374151 !important;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.3;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  width: 100%;
}

/* Indicador de hover inferior */
#categories-list .nav-link::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--zr-orange);
  transform: scaleX(0);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover en toda la celda */
#categories-list>li:hover .nav-link {
  background: linear-gradient(to bottom, #fff5ed 0%, #ffe8d8 100%);
  color: var(--zr-orange) !important;
  transform: translateY(-1px);
}

#categories-list>li:hover .nav-link::before {
  transform: scaleX(1);
}

/* Iconos de categoría */
#categories-list .nav-link img.category-icon {
  width: clamp(18px, 1.5vw, 22px);
  height: clamp(18px, 1.5vw, 22px);
  object-fit: contain;
  filter: grayscale(0.3);
  transition: all 0.25s ease;
}

#categories-list>li:hover .nav-link img.category-icon {
  filter: grayscale(0);
  transform: scale(1.1);
}

/* Icono de flecha (chevron) */
#categories-list .nav-link .bi-chevron-down {
  font-size: 0.7em;
  opacity: 0.6;
  transition: all 0.25s ease;
  margin-left: 0.15rem;
}

#categories-list>li:hover .nav-link .bi-chevron-down {
  opacity: 1;
  transform: translateY(2px);
}

/*──────────────────────────────────────────────────────────────
  2.1 Subcategorías – Bootstrap dropdown estilizado
──────────────────────────────────────────────────────────────*/
#categories-list .dropdown-menu,
#categories-list ul.dropdown-menu {
  min-width: 280px !important;
  max-width: 320px !important;
  padding: 0.5rem 0 !important;
  border-radius: 0 !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
  max-height: 350px !important;
  /* Altura aumentada para ver más items */
  overflow-y: scroll !important;
  /* SIEMPRE scroll vertical */
  overflow-x: hidden !important;
}

/* Cuando está abierto, mantener configuración de scroll */
#categories-list .dropdown-menu.show,
#categories-list ul.dropdown-menu.show {
  position: fixed !important;
  max-height: 350px !important;
  overflow-y: scroll !important;
}

/* Efecto de fade eliminado - causaba problemas de visibilidad */

/* Items del dropdown */
#categories-list .dropdown-item {
  padding: 0.65rem 1rem;
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 0.9rem;
  color: #374151;
  border-left: 3px solid transparent;
}

#categories-list .dropdown-item:hover,
#categories-list .dropdown-item:focus {
  background: linear-gradient(to right, #fff5ed 0%, #ffffff 100%);
  border-left-color: var(--zr-orange);
  color: var(--zr-orange);
  padding-left: 1.25rem;
}

#categories-list .dropdown-item img {
  transition: transform 0.2s ease;
  width: 50px;
  /* Iconos ajustados */
  height: 50px;
  object-fit: contain;
  margin-right: 12px;
}

#categories-list .dropdown-item:hover img {
  transform: scale(1.1);
}

/* Scrollbar moderno y minimalista para el dropdown */
#categories-list .dropdown-menu {
  scrollbar-width: thin;
  /* Firefox delgado */
  scrollbar-color: #000000 #f1f1f1;
}

/* WebKit scrollbar - diseño delgado y negro */
#categories-list .dropdown-menu::-webkit-scrollbar {
  width: 3px;
  /* ULTRA Delgada */
  background: transparent;
}

#categories-list .dropdown-menu::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
  margin: 4px 0;
}

#categories-list .dropdown-menu::-webkit-scrollbar-thumb {
  background: #000000;
  /* Negro sólido */
  border-radius: 4px;
  border: none;
  min-height: 40px;
}

#categories-list .dropdown-menu::-webkit-scrollbar-thumb:hover {
  background: #333333;
  /* Gris oscuro al hover */
}

#categories-list .dropdown-menu::-webkit-scrollbar-thumb:active {
  background: #d65a00;
  /* Naranja más oscuro al hacer clic */
  transform: scaleX(1);
}

/* suprime caret default de Bootstrap */
.dropdown-toggle::after {
  display: none;
}

/*──────────────────────────────────────────────────────────────
  2.2 Responsive adjustments
──────────────────────────────────────────────────────────────*/
@media (max-width: 768px) {

  /* Oculta el menú de categorías en mobile */
  #categories-list,
  #catalog-cta {
    display: none !important;
  }
}

/* Mantener siempre en una fila - scroll horizontal en pantallas intermedias */
@media (max-width: 1100px) and (min-width: 769px) {
  #categories-list {
    justify-content: flex-start;
  }

  .categories-scroll-wrapper {
    padding: 0 0.5rem;
  }
}

/* Ajustes para pantallas grandes */
@media (max-width: 1400px) {
  #categories-list .nav-link {
    padding: 0.75rem 1rem !important;
    font-size: clamp(11px, 0.9vw, 13px);
  }
}

@media (max-width: 1200px) {
  #categories-list .nav-link {
    padding: 0.7rem 0.9rem !important;
    font-size: clamp(10px, 0.85vw, 12.5px);
  }
}

@media (max-width: 992px) {
  #categories-list .nav-link {
    padding: 0.65rem 0.8rem !important;
    font-size: clamp(10px, 0.8vw, 12px);
    min-height: 48px;
  }
}

/*──────────────────────────────────────────────────────────────
  3. Botón flotante WhatsApp
──────────────────────────────────────────────────────────────*/
.whatsapp-float {
  position: fixed !important;
  bottom: 20px !important;
  right: 20px !important;
  width: 60px;
  height: 60px;
  background: #25d366;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
  transition: background-color .3s;
  z-index: 900;
  /* por debajo de offcanvas/modales */
}

.whatsapp-float:hover {
  background: #1ebe57;
}

/*──────────────────────────────────────────────────────────────
  4. Footer
──────────────────────────────────────────────────────────────*/
.footer-dark {
  background: #0f1e28;
  color: #d1d1d1;
}

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

.footer-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: .4px;
}

.footer-dark .icon {
  font-size: 1.1rem;
}

.map-embed {
  width: 100%;
  height: 300px;
  border: 0;
  border-radius: .35rem;
}

.social-icons a {
  font-size: 1.6rem;
  color: #d1d1d1;
  margin-right: 1rem;
}

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

/*──────────────────────────────────────────────────────────────
  5. Hero (portada)
──────────────────────────────────────────────────────────────*/
.hero-full {
  position: relative;
  background: #000 center/cover no-repeat;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: .25rem;
  overflow: hidden;
}

.hero-full::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .6);
}

.hero-inner {
  position: relative;
  text-align: center;
  color: #fff;
  max-width: 700px;
  padding: 0 20px;
}

/*──────────────────────────────────────────────────────────────
  6. Cart dropdown – listado con scroll
──────────────────────────────────────────────────────────────*/
#cart-dropdown-items {
  max-height: 300px;
  overflow-y: auto;
  z-index: 9999;
}

.dropdown-menu[aria-labelledby="cartDropdownToggle"] {
  max-height: 400px;
  overflow-y: auto;
}

/*──────────────────────────────────────────────────────────────
  7. Espacio para otros estilos globales
──────────────────────────────────────────────────────────────*/
/* …añade aquí reglas adicionales según necesidad… */

/*──────────────────────────────────────────────────────────────
  8. Ajustes para menú compactado y elementos slim
──────────────────────────────────────────────────────────────*/
/* Navbar principal más baja */
.navbar {
  padding-top: 0.25rem !important;
  padding-bottom: 0.25rem !important;
}

.navbar-nav .nav-link {
  padding-top: 0.35rem !important;
  padding-bottom: 0.35rem !important;
  font-size: 0.9rem;
}

/* Logo también un poco más pequeño */
.navbar-brand img {
  height: 36px;
  /* antes 48px */
}

/* BUSCADOR GLOBAL: input y botón más delgados */
section.bg-dark .form-control-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.9rem;
  height: 2.5rem;
}

section.bg-dark .btn-secondary.btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.9rem;
  height: 2.5rem;
  line-height: 1.2;
}

/* Botón Administrador más delgado */
.navbar .btn-danger.btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.9rem;
  line-height: 1.2;
}

/*──────────────────────────────────────────────────────────────
  9. Ajustes responsivos
──────────────────────────────────────────────────────────────*/
#offcanvasCart {
  width: 500px;
}

@media (max-width: 576px) {
  #offcanvasCart {
    width: 100% !important;
  }

  .hero-full {
    min-height: 300px;
  }
}