/* ==========================================================================
   JELS - ESTILOS GLOBALES DEL CATÁLOGO Y COMPONENTES
   ========================================================================== */

body, h1, h2, h3, h4, h5, h6, p, span, a, div, button, input, select, textarea {
  font-family: 'Montserrat', sans-serif !important;
}

/* Buscador Integrado en la Navbar Central */
.nav-search-wrapper {
  flex-grow: 1;
  max-width: 480px;
  margin: 0 20px;
}

.nav-search-input {
  width: 100%;
  padding: 7px 18px;
  font-size: 0.88em;
  border: 1px solid #cbd5e1;
  border-radius: 50px;
  outline: none;
  background-color: #f8fafc;
  transition: all 0.2s ease;
  color: #0f172a;
}

.nav-search-input:focus {
  background-color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.catalog-section { padding-top: 120px; padding-bottom: 80px; position: relative; min-height: 100vh; }
.catalog-container { max-width: 1400px; margin: 0 auto; position: relative; z-index: 2; }

/* Estilo del Banner de Serie */
.serie-banner-wrap {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 25px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  border: 1px solid #e2e8f0;
  background: #ffffff;
  line-height: 0;
}
.serie-banner-img {
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: cover;
  display: block;
}

/* Header de Subfamilia (Texto alternativo sin banner) */
.header-subfamily { 
  background: #ffffff; 
  padding: 20px 25px; 
  border-radius: 8px; 
  border: 1px solid #e2e8f0; 
  margin-bottom: 20px; 
  box-shadow: 0 2px 4px rgba(0,0,0,0.05); 
  text-align: left; 
}
.header-subfamily h1 { 
  color: #0f172a; 
  margin: 0; 
  font-size: 1.8em; 
  font-weight: 700; 
  text-transform: uppercase; 
  letter-spacing: 0.5px; 
}

/* ==========================================================================
   BARRA Y BOTONES DE PAGINACIÓN DE CATÁLOGO
   ========================================================================== */
.pagination-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #ffffff;
  padding: 14px 24px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  margin-bottom: 25px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
  flex-wrap: wrap;
  gap: 12px;
}
.pagination-info { 
  font-size: 0.9em; 
  color: #475569; 
  font-weight: 600; 
}
.pagination-limit-wrap { 
  display: flex; 
  align-items: center; 
  gap: 8px; 
  font-size: 0.88em; 
  color: #334155; 
  font-weight: 600; 
}
.pagination-limit-wrap select {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background-color: #f8fafc;
  font-weight: 700;
  color: #0f172a;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}
.pagination-limit-wrap select:focus {
  border-color: #0284c7;
}

.pagination-controls { 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  gap: 6px; 
  flex-wrap: wrap; 
  margin-top: 25px; 
  margin-bottom: 30px; 
}
.page-btn {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  padding: 8px 14px !important;
  border-radius: 6px !important;
  font-size: 0.88em !important;
  font-weight: 700 !important;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.page-btn:hover:not(:disabled) { 
  background-color: #0284c7 !important; 
  color: #ffffff !important; 
  border-color: #0284c7 !important; 
}
.page-btn.active { 
  background-color: #0284c7 !important; 
  color: #ffffff !important; 
  border-color: #0284c7 !important; 
}
.page-btn:disabled { 
  opacity: 0.4; 
  cursor: not-allowed; 
}

/* ==========================================================================
   CUADRÍCULA Y TARJETAS DE PRODUCTO
   ========================================================================== */
.catalog-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 30px; }

.product-card { 
  background: #ffffff; 
  border: 1px solid #cbd5e1; 
  border-radius: 8px; 
  padding: 12px; 
  display: flex; 
  flex-direction: column; 
  justify-content: space-between; 
  transition: transform 0.2s, box-shadow 0.2s; 
  text-align: left; 
}
.product-card:hover { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(0,0,0,0.12); }

.product-img-wrap { 
  width: 100%; 
  height: 210px; 
  background-color: #f8fafc; 
  border-radius: 6px; 
  margin-bottom: 12px; 
  overflow: hidden; 
  padding: 6px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  cursor: pointer; 
}
.product-img-wrap img { transition: transform 0.2s; max-width: 100%; max-height: 100%; object-fit: contain; }
.product-img-wrap:hover img { transform: scale(1.03); }
.product-img { max-width: 100%; max-height: 100%; object-fit: contain; object-position: center; }

.product-ref { font-size: 0.8em; color: #0284c7; font-weight: 700; margin-bottom: 4px; }
.product-title { font-size: 0.88em; color: #0f172a; font-weight: 700; text-align: left; margin-bottom: 10px; line-height: 1.3; display: block; overflow: visible; }

/* Precios unificados para todas las tarjetas del catálogo */
.product-price {
  font-size: 1.15em !important;
  font-weight: 700 !important;
  color: #16a34a !important;
  margin-top: 6px;
  margin-bottom: 10px;
}
.product-price .pvp-label {
  font-size: 0.7em !important;
  font-weight: 600 !important;
  color: #64748b !important;
  background-color: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}

/* Precios de soporte / Caja de precios anterior */
.product-price-box { margin-bottom: 10px; font-size: 0.9em; }
.pvp-original { font-size: 0.85em; color: #0284c7; text-decoration: line-through; font-weight: 600; margin-right: 4px; }
.pvp-text-label { font-size: 0.75em; color: #0284c7; font-weight: 600; text-transform: uppercase; }
.neto-price { font-size: 1.05em; color: #16a34a; font-weight: 800; }
.dto-badge-card { background-color: #dcfce7; color: #15803d; font-size: 0.7em; padding: 2px 6px; border-radius: 4px; font-weight: 700; display: inline-block; margin-top: 3px; }

.cart-controls { display: flex; align-items: center; gap: 6px; width: 100%; margin-top: auto; }
.qty-input { width: 45px; padding: 5px 2px; text-align: center; border: 1px solid #cbd5e1; border-radius: 4px; font-weight: 600; font-size: 0.85em; }
.btn-add-cart { flex-grow: 1; background-color: #0284c7; color: #ffffff; border: none; padding: 6px 10px; border-radius: 4px; font-size: 0.85em; font-weight: 700; cursor: pointer; transition: background-color 0.2s; }
.btn-add-cart:hover { background-color: #0369a1; }

.login-prompt-msg { font-size: 0.78em; color: #64748b; font-style: italic; margin-top: auto; padding-top: 8px; border-top: 1px dashed #e2e8f0; text-align: center; }

/* ==========================================================================
   RESULTADOS DE BÚSQUEDA GLOBAL
   ========================================================================== */
.search-results-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-top: 20px; }
.product-card-compact { background: #ffffff; border: 1px solid #cbd5e1; border-radius: 8px; padding: 10px; display: flex; flex-direction: column; justify-content: space-between; text-align: left; }
.product-img-wrap-compact { width: 100%; height: 130px; background-color: #f8fafc; border-radius: 6px; margin-bottom: 8px; overflow: hidden; padding: 4px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.product-img-compact { max-width: 100%; max-height: 100%; object-fit: contain; }
.product-ref-compact { font-size: 0.78em; color: #0284c7; font-weight: 700; margin-bottom: 2px; }
.product-title-compact { font-size: 0.84em; color: #0f172a; font-weight: 700; margin-bottom: 8px; line-height: 1.25; }
.neto-price-compact { font-size: 0.95em; color: #16a34a; font-weight: 800; }
.cart-controls-compact { display: flex; align-items: center; gap: 6px; width: 100%; margin-top: auto; }
.qty-input-compact { width: 40px; padding: 4px 2px; text-align: center; border: 1px solid #cbd5e1; border-radius: 4px; font-size: 0.82em; }
.btn-add-cart-compact { flex-grow: 1; background-color: #0284c7; color: #ffffff; border: none; padding: 6px 8px; border-radius: 4px; font-size: 0.8em; font-weight: 700; cursor: pointer; }
.login-prompt-msg-compact { font-size: 0.75em; color: #64748b; font-style: italic; margin-top: auto; padding-top: 6px; border-top: 1px dashed #e2e8f0; text-align: center; }

/* ==========================================================================
   MODAL FLOTANTE DE DETALLE DE PRODUCTO
   ========================================================================== */
#productModalOverlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(15, 23, 42, 0.75); z-index: 99999; display: none; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px); }
.product-modal-card { background: #ffffff; border-radius: 12px; max-width: 650px; width: 100%; padding: 30px; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2); position: relative; text-align: left; max-height: 90vh; overflow-y: auto; }
.modal-close-btn { position: absolute; top: 15px; right: 20px; background: #f1f5f9; border: none; font-size: 1.2em; font-weight: 800; color: #0f172a; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.modal-main-img-wrap { width: 100%; height: 280px; background: #f8fafc; border-radius: 8px; border: 1px solid #e2e8f0; display: flex; align-items: center; justify-content: center; margin-bottom: 15px; padding: 8px; overflow: hidden; }
.modal-main-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.modal-thumbnails-grid { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.modal-thumb { width: 60px; height: 60px; border: 2px solid #cbd5e1; border-radius: 6px; object-fit: contain; background: #f8fafc; cursor: pointer; padding: 2px; }
.modal-thumb:hover, .modal-thumb.active-thumb { border-color: #0284c7; }

/* ==========================================================================
   NAVBAR LINKS Y COMPONENTES
   ========================================================================== */
.nav-login-link { display: inline-flex !important; align-items: center; justify-content: center; background-color: #f1f5f9; padding: 6px 14px !important; border-radius: 50px; font-size: 13px !important; font-weight: 600; text-decoration: none !important; color: #0f172a !important; }
.nav-cart-link { display: inline-flex !important; align-items: center; justify-content: center; background-color: #f1f5f9; padding: 6px 14px !important; border-radius: 50px; position: relative; font-size: 13px !important; text-decoration: none !important; }
.cart-icon-large { font-size: 1.2em; line-height: 1; }
.cart-badge-nav { background-color: #0284c7; color: white; padding: 2px 8px; border-radius: 50px; font-size: 0.8em; font-weight: 800; margin-left: 6px; }
#menu-desplegable-cuenta { position: absolute !important; top: 100% !important; right: 0 !important; margin-top: 5px !important; min-width: 220px; z-index: 1000; background-color: #ffffff; border-radius: 8px; border: 1px solid rgba(0,0,0,0.08); padding: 8px 0; }
#menu-desplegable-cuenta .dropdown-item { padding: 8px 16px; font-size: 13px !important; }

#toast-notification { position: fixed; bottom: 25px; right: 25px; background-color: #0f172a; color: #ffffff; padding: 12px 20px; border-radius: 8px; z-index: 99999; font-size: 0.85em; border-left: 4px solid #0284c7; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, transform 0.3s ease; transform: translateY(20px); }
#toast-notification.show { opacity: 1; visibility: visible; transform: translateY(0); }

/* ==========================================================================
   TAMAÑO Y ALINEACIÓN DE ICONOS EN LA NAVBAR
   ========================================================================== */
.navbar-nav .nav-link .mbr-iconfont {
  font-size: 1.5em !important;
  vertical-align: middle !important;
  margin-right: 6px !important;
  display: inline-block !important;
}

/* ==========================================================================
   DISEÑO ADAPTATIVO (MEDIA QUERIES)
   ========================================================================== */
@media (max-width: 1400px) { 
  .search-results-grid { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 1200px) { 
  .catalog-grid { grid-template-columns: repeat(3, 1fr); } 
  .search-results-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 991px) {
  .pagination-toolbar { flex-direction: column; text-align: center; }
}
@media (max-width: 768px) { 
  .catalog-grid { grid-template-columns: repeat(1, 1fr); } 
  .search-results-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; } 
}

/* ==========================================================================
   ETIQUETA DE UNIDADES POR CAJA (ESTILO AZULADO UNIFICADO)
   ========================================================================== */
.box-units-badge {
  display: inline-flex;
  align-items: center;
  background-color: #f0f9ff;
  color: #0369a1;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75em;
  font-weight: 600;
  margin: 6px 0 10px 0;
  border: 1px solid #bae6fd;
}
.box-units-badge svg {
  width: 20px;
  height: 20px;
  margin-right: 5px;
  flex-shrink: 0;
  color: #0284c7;
}

/* Versión compacta para resultados de búsqueda global */
.box-units-badge-compact {
  display: inline-flex;
  align-items: center;
  background-color: #f0f9ff;
  color: #0369a1;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7em;
  font-weight: 600;
  margin: 4px 0 8px 0;
  border: 1px solid #bae6fd;
}
.box-units-badge-compact svg {
  width: 14px;
  height: 14px;
  margin-right: 4px;
  flex-shrink: 0;
  color: #0284c7;
}