/* ============================================
   TIREDOC - ESTILOS OPTIMIZADOS Y FUNCIONALES
   Compatible con index.html y tienda.html
   ============================================ */

:root {
  /* Colores basados en el logo TIRE DOC */
  --td-red: #CC0000; /* Rojo vibrante de "TIRE" */
  --td-blue-dark: #213A5E; /* Azul marino de "DOC" y neumático */
  --td-blue-light: #4A7DBA; /* Azul claro para acentos */
  --td-dark: #213A5E; /* Usar azul marino como color oscuro principal */
  --td-muted: #64748b;
  --td-bg: #f5f7fb;
  --td-card: #ffffff;
  --td-border: rgba(33, 58, 94, 0.08); /* Border con azul marino */
  --td-radius: 20px;
  --td-radius-lg: 28px;
  --td-shadow: 0 18px 55px rgba(33, 58, 94, 0.10); /* Sombra con azul marino */
  --td-shadow-soft: 0 12px 28px rgba(33, 58, 94, 0.08);
  --td-ring: 0 0 0 4px rgba(204, 0, 0, 0.15); /* Ring con rojo */
  
  /* Spacing system */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.18s ease;
  --transition-slow: 0.3s ease;
}

/* ============================================
   RESET Y BASE
   ============================================ */
* {
  box-sizing: border-box;
}

body {
  background: var(--td-bg);
  color: var(--td-blue-dark);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--td-red);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ============================================
   UTILIDADES
   ============================================ */
.muted {
  color: var(--td-muted);
}

.section-title {
  font-weight: 950;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.section-sub {
  color: var(--td-muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

section {
  padding: 96px 0;
}

@media (max-width: 992px) {
  section {
    padding: 72px 0;
  }
  
  .hero {
    min-height: auto;
    padding: 60px 0 40px;
  }
  
  .hero-card {
    margin-top: 2rem;
  }
}

@media (max-width: 768px) {
  section {
    padding: 48px 0;
  }
  
  .hero {
    padding: 40px 0 30px;
  }
  
  .hero-card .card-title {
    font-size: 24px;
  }
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--td-border);
  padding: 1rem 0;
  transition: background var(--transition-base), box-shadow var(--transition-base);
}

.navbar.scrolled {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--td-shadow-soft);
}

.nav-link {
  color: var(--td-blue-dark);
  font-weight: 600;
  transition: color var(--transition-base);
}

.nav-link:hover,
.nav-link:focus {
  color: var(--td-red);
}

.navbar .nav-link.active {
  color: var(--td-red) !important;
}

.navbar-brand img {
  transition: transform var(--transition-base);
}

.navbar-brand:hover img {
  transform: scale(1.05);
}

.navbar .btn.btn-danger {
  border-radius: 16px !important;
  box-shadow: 0 14px 26px rgba(204, 0, 0, 0.18);
  border: 0;
  transition: all var(--transition-base);
}

.navbar .btn.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 32px rgba(204, 0, 0, 0.25);
}

/* ============================================
   BOTONES
   ============================================ */
.btn-td {
  background: var(--td-red);
  color: #fff;
  border: 0;
  border-radius: 16px;
  padding: 14px 22px;
  font-weight: 900;
  letter-spacing: 0.2px;
  box-shadow: 0 16px 30px rgba(204, 0, 0, 0.18);
  transition: all var(--transition-base);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-td:hover {
  filter: brightness(0.96);
  transform: translateY(-1px);
  color: #fff;
  box-shadow: 0 20px 40px rgba(204, 0, 0, 0.25);
}

.btn-td:active {
  transform: translateY(0);
}

.btn-td:focus {
  box-shadow: var(--td-ring);
  outline: 0;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--td-border);
  color: var(--td-blue-dark);
  border-radius: 16px;
  padding: 14px 22px;
  font-weight: 900;
  transition: all var(--transition-base);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
  box-shadow: var(--td-shadow-soft);
}

.btn-outline-secondary {
  border-radius: 999px !important;
  border-color: rgba(33, 58, 94, 0.14) !important;
  transition: all var(--transition-base);
}

.btn-outline-secondary:hover {
  background: rgba(33, 58, 94, 0.06) !important;
  color: var(--td-blue-dark) !important;
  border-color: rgba(33, 58, 94, 0.22) !important;
}

/* ============================================
   FORMULARIOS
   ============================================ */
.form-control,
.form-select {
  border-radius: 14px;
  border: 1px solid rgba(33, 58, 94, 0.18);
  padding: 12px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.9);
  transition: all var(--transition-base);
  width: 100%;
}

.form-control:focus,
.form-select:focus {
  box-shadow: 0 0 0 4px rgba(33, 58, 94, 0.10);
  border-color: rgba(33, 58, 94, 0.22);
  outline: 0;
  background: #fff;
}

.form-label {
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: block;
}

/* ============================================
   HERO (index.html)
   ============================================ */
.hero {
  position: relative;
  min-height: 88vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 84px 0 64px;
  background: #fff;
  border-bottom: 1px solid var(--td-border);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.96) 0%,
      rgba(255, 255, 255, 0.82) 35%,
      rgba(255, 255, 255, 0.55) 60%,
      rgba(255, 255, 255, 0.22) 100%
    ),
    url("https://tiredoc.com.mx/wp-content/uploads/bodega.png") center/cover no-repeat;
  filter: saturate(1.05) contrast(0.98);
  transform: scale(1.02);
  z-index: 0;
}

.hero .content {
  position: relative;
  z-index: 1;
}

.hero-title {
  font-weight: 950;
  letter-spacing: -0.03em;
  line-height: 0.95;
  font-size: clamp(44px, 5.2vw, 86px);
  margin: 0;
}

.hero-title .red {
  color: var(--td-red);
}

.hero-title .blue {
  color: var(--td-blue-dark);
}

.hero-sub {
  font-size: clamp(18px, 1.5vw, 24px);
  color: var(--td-muted);
  font-style: italic;
  font-weight: 700;
  max-width: 560px;
}

.hero-card {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--td-radius-lg);
  box-shadow: var(--td-shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.hero-card .card-title {
  font-size: 32px;
  font-weight: 950;
  letter-spacing: -0.02em;
  text-align: center;
  margin-bottom: 8px;
}

.hero-card h6 {
  font-weight: 950 !important;
  letter-spacing: 0.2px;
}

/* ============================================
   CARDS BASE
   ============================================ */
.cardx {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius);
  box-shadow: var(--td-shadow-soft);
  transition: all var(--transition-base);
}

.cardx:hover {
  box-shadow: var(--td-shadow);
}

/* ============================================
   PRODUCTOS
   ============================================ */
.product-card {
  background: var(--td-card);
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius);
  box-shadow: var(--td-shadow-soft);
  overflow: hidden;
  height: 100%;
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
  position: relative;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--td-shadow);
  border-color: rgba(204, 0, 0, 0.2);
}

.product-card:hover .product-thumb img {
  transform: scale(1.05);
}

.product-thumb {
  width: 100%;
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #f7f9ff, #ffffff);
  position: relative;
  overflow: hidden;
}

.product-thumb img {
  width: 72%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 14px 22px rgba(33, 58, 94, 0.14));
  transition: transform var(--transition-base);
}

.product-card:hover .product-thumb img {
  transform: scale(1.03);
}

.product-badge {
  position: absolute;
  background: var(--td-red);
  color: #fff;
  font-weight: 900;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 12px;
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: pulse-badge 2s ease-in-out infinite;
}

/* Badge de descuento - esquina superior izquierda */
.product-badge-discount {
  top: 12px;
  left: 12px;
  right: auto;
}

/* Badge Top - esquina superior izquierda (debajo del descuento si existe, sino arriba) */
.product-badge-top {
  top: 56px;
  left: 12px;
  right: auto;
  background: #f59e0b;
}

/* Si no hay descuento, el Top va arriba */
.product-card:not(:has(.product-badge-discount)) .product-badge-top {
  top: 12px;
}

@keyframes pulse-badge {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.product-meta {
  font-size: 0.78rem;
  color: var(--td-muted);
  font-weight: 900;
}

.product-name {
  font-weight: 950;
  font-size: 0.95rem;
  line-height: 1.15;
  min-height: 2.35em;
  margin: 0.5rem 0;
}

.product-price {
  font-weight: 950;
  color: var(--td-red);
  font-size: 1.08rem;
}

.product-price s {
  color: #94a3b8;
  font-weight: 900;
  font-size: 0.86rem;
  margin-left: 0.4rem;
}

.product-old-price {
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: line-through;
}

.product-rating {
  color: #f59e0b;
  font-size: 0.85rem;
  margin: 0.5rem 0;
}

.product-rating .bi-star-fill,
.product-rating .bi-star-half {
  color: #f59e0b;
}

.product-rating .bi-star {
  color: #d1d5db;
}

/* ============================================
   WHY CARDS (index.html)
   ============================================ */
.why-wrap {
  background: #fff;
  border-top: 1px solid var(--td-border);
  border-bottom: 1px solid var(--td-border);
}

.why-card {
  background: #fff;
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius);
  box-shadow: var(--td-shadow-soft);
  height: 100%;
  transition: all var(--transition-base);
}

.why-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--td-shadow);
}

.why-ic {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(204, 0, 0, 0.10);
  color: var(--td-red);
  border: 1px solid rgba(204, 0, 0, 0.18);
  font-size: 1.25rem;
}

.why-card h6 {
  font-weight: 950;
  margin: 0.5rem 0 0.2rem;
}

.why-card p {
  color: var(--td-muted);
  font-size: 0.92rem;
  margin: 0;
}

/* ============================================
   BRAND STRIP (index.html)
   ============================================ */
.brand-strip {
  background: #fff;
  border-bottom: 1px solid var(--td-border);
}

.brand-logo {
  filter: grayscale(1);
  opacity: 0.78;
  transition: all var(--transition-base);
  max-width: 100%;
  height: auto;
}

.brand-logo:hover {
  filter: grayscale(0);
  opacity: 1;
  transform: translateY(-2px);
}

/* ============================================
   TESTIMONIOS (index.html)
   ============================================ */
.testi {
  position: relative;
  overflow: hidden;
  background: #fff;
  border-bottom: 1px solid var(--td-border);
}

.testi-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.97) 0%,
      rgba(255, 255, 255, 0.84) 40%,
      rgba(255, 255, 255, 0.55) 70%,
      rgba(255, 255, 255, 0.22) 100%
    ),
    url("https://images.unsplash.com/photo-1503376780353-7e6692767b70?auto=format&fit=crop&w=2100&q=70")
      center/cover no-repeat;
  filter: contrast(1.05) saturate(1.05);
  z-index: 0;
}

.testi .content {
  position: relative;
  z-index: 1;
}

.review-card {
  background: #fff;
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius);
  box-shadow: var(--td-shadow-soft);
  transition: all var(--transition-base);
}

.review-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--td-shadow);
}

.stars {
  color: #f59e0b;
}

/* ============================================
   GARANTÍA (index.html)
   ============================================ */
.g-card {
  background: #fff;
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius);
  box-shadow: var(--td-shadow-soft);
  height: 100%;
  text-align: center;
  transition: all var(--transition-base);
}

.g-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--td-shadow);
}

.g-ic {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(33, 58, 94, 0.08);
  border: 1px solid rgba(33, 58, 94, 0.14);
  color: var(--td-blue-dark);
  margin-bottom: 0.6rem;
  font-size: 1.35rem;
}

/* ============================================
   BLOG (index.html)
   ============================================ */
.blog-card {
  background: #fff;
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius);
  overflow: hidden;
  box-shadow: var(--td-shadow-soft);
  height: 100%;
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
}

.blog-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--td-shadow);
}

.blog-card img {
  width: 100%;
  height: 190px;
  object-fit: cover;
}

.blog-card h6 {
  font-weight: 950;
  margin: 0.15rem 0 0.35rem;
}

.blog-card p {
  color: var(--td-muted);
  font-size: 0.92rem;
  margin: 0 0 0.7rem;
}

/* ============================================
   BADGES
   ============================================ */
.badge-soft {
  background: rgba(204, 0, 0, 0.10);
  border: 1px solid rgba(204, 0, 0, 0.18);
  color: var(--td-red);
  font-weight: 950;
  padding: 0.25rem 0.75rem;
}

.badge-warranty {
  background: rgba(16, 185, 129, 0.10);
  border: 1px solid rgba(16, 185, 129, 0.18);
  color: #10b981;
  font-weight: 950;
  padding: 0.25rem 0.75rem;
}

/* ============================================
   MODAL (tienda.html)
   ============================================ */
.modal-content {
  border-radius: var(--td-radius);
  border: 1px solid var(--td-border);
  box-shadow: var(--td-shadow);
  animation: modalFadeIn 0.3s ease-out;
  max-height: 95vh;
  overflow-y: auto;
}

.modal-dialog {
  margin: 1rem auto; /* Centrar horizontalmente con auto */
  position: relative;
  width: auto;
  max-width: 800px; /* Asegurar que modal-lg funcione */
}

.modal-dialog-centered {
  display: flex;
  align-items: center;
  min-height: calc(100% - 2rem);
}

.modal-dialog-centered::before {
  display: block;
  height: calc(100vh - 2rem);
  content: "";
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-hero {
  border-radius: 14px;
  border: 1px solid var(--td-border);
  background: linear-gradient(180deg, #f7f9ff, #ffffff);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 200px;
  position: relative;
  width: 100%;
  aspect-ratio: 1/1;
  max-height: 500px;
}

.modal-hero img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 14px 22px rgba(33, 58, 94, 0.14));
  transition: transform 0.3s ease;
  padding: 1rem;
}

/* Galería de miniaturas */
.thumbnail-gallery-container {
  margin-top: 1rem;
  padding: 0.5rem 0;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.thumbnail-gallery {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.5rem 0;
  scrollbar-width: thin;
  scrollbar-color: var(--td-border) transparent;
  width: 100%;
  min-width: min-content;
}

.thumbnail-gallery::-webkit-scrollbar {
  height: 6px;
}

.thumbnail-gallery::-webkit-scrollbar-track {
  background: transparent;
}

.thumbnail-gallery::-webkit-scrollbar-thumb {
  background: var(--td-border);
  border-radius: 3px;
}

.thumbnail-gallery::-webkit-scrollbar-thumb:hover {
  background: var(--td-muted);
}

.thumbnail-item {
  min-width: 80px;
  width: 80px;
  height: 80px;
  border: 2px solid var(--td-border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  background: #f5f7fb;
  position: relative;
}

.thumbnail-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumbnail-item:hover {
  border-color: rgba(204, 0, 0, 0.5);
  transform: scale(1.05);
}

.thumbnail-item.active {
  border-color: var(--td-red);
  box-shadow: 0 0 0 2px rgba(204, 0, 0, 0.2);
}

.thumbnail-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--td-red);
}

/* Responsive para miniaturas */
@media (max-width: 768px) {
  .thumbnail-gallery-container {
    margin-top: 0.75rem;
    padding: 0.25rem 0;
  }
  
  .thumbnail-gallery {
    gap: 0.4rem;
    padding: 0.25rem 0;
  }
  
  .thumbnail-item {
    min-width: 60px;
    width: 60px;
    height: 60px;
  }
}

@media (max-width: 576px) {
  .thumbnail-gallery-container {
    margin-top: 0.5rem;
  }
  
  .thumbnail-item {
    min-width: 50px;
    width: 50px;
    height: 50px;
  }
  
  .thumbnail-gallery {
    gap: 0.3rem;
  }
}

/* ============================================
   FOOTER
   ============================================ */
footer,
.footer {
  background: #fff;
  border-top: 1px solid var(--td-border);
}

.foot-title {
  font-weight: 950;
  margin-bottom: 1rem;
}

.foot-link {
  color: var(--td-blue-dark);
  transition: color var(--transition-base);
  opacity: 0.8;
}

.foot-link:hover {
  color: var(--td-red);
}

/* ============================================
   IMÁGENES - OPTIMIZADAS
   ============================================ */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Las imágenes se muestran inmediatamente */
img[loading="lazy"] {
  opacity: 1;
  transition: opacity var(--transition-slow);
}

/* Solo ocultar si realmente no tiene src */
img:not([src]),
img[src=""] {
  opacity: 0.3;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite;
  min-height: 200px;
}

@keyframes loading-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

img.loaded {
  opacity: 1;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #fff;
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius);
  box-shadow: var(--td-shadow);
  padding: 16px 20px;
  min-width: 300px;
  max-width: 500px;
  z-index: 9999;
  opacity: 0;
  transform: translateY(20px);
  transition: all var(--transition-slow);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toast-message {
  flex: 1;
  font-weight: 600;
}

.toast-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--td-muted);
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.toast-close:hover {
  background: rgba(33, 58, 94, 0.08);
  color: var(--td-blue-dark);
}

.toast-success {
  border-left: 4px solid #10b981;
}

.toast-error {
  border-left: 4px solid #ef4444;
}

.toast-info {
  border-left: 4px solid #3b82f6;
}

/* ============================================
   ANIMACIONES
   ============================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.5s ease-out;
}

/* ============================================
   ACCESIBILIDAD
   ============================================ */
[aria-hidden="true"] {
  pointer-events: none;
}

*:focus-visible {
  outline: 2px solid var(--td-red);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Clase para usar azul claro del logo como acento */
.accent-blue {
  color: var(--td-blue-light);
}

.bg-accent-blue {
  background-color: var(--td-blue-light);
}

/* Skip link para accesibilidad */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--td-red);
  color: #fff;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 10000;
  border-radius: 0 0 4px 0;
}

.skip-link:focus {
  top: 0;
}

/* ============================================
   RESPONSIVE - MEJORAS
   ============================================ */
@media (max-width: 992px) {
  /* Modal responsive */
  .modal-dialog {
    margin: 0.5rem auto; /* Mantener centrado */
    max-width: calc(100% - 1rem);
  }
  
  .modal-dialog-centered {
    min-height: calc(100% - 1rem);
  }
  
  .modal-dialog-centered::before {
    height: calc(100vh - 1rem);
  }
  
  .modal-body .row {
    flex-direction: column;
  }
  
  .modal-body .col-lg-6 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
  }
  
  .modal-hero {
    min-height: 250px;
    max-height: 400px;
  }
  
  /* Precio y botón en móvil */
  .modal-body .cardx .d-flex {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 1rem !important;
  }
  
  .modal-body .cardx .btn-td {
    width: 100% !important;
    white-space: normal !important;
  }
  
  /* Precio responsive */
  .modal-body #mPrice {
    font-size: clamp(1.5rem, 5vw, 1.75rem) !important;
  }
}

@media (max-width: 768px) {
  .hero {
    min-height: auto;
    padding: 60px 0 40px;
  }

  .hero-title {
    font-size: clamp(32px, 8vw, 48px);
  }

  .product-card {
    margin-bottom: 1rem;
  }

  .toast {
    right: 10px;
    left: 10px;
    min-width: auto;
    max-width: none;
  }
  
  /* Modal en tablets */
  .modal-dialog {
    margin: 0.5rem;
  }
  
  .modal-hero {
    min-height: 200px;
    max-height: 350px;
  }
  
  .modal-body {
    padding: 1rem;
  }
  
  .modal-body .cardx {
    padding: 1rem !important;
  }
}

/* ============================================
   MOTION CONTROL
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================
   BREADCRUMBS
   ============================================ */
.breadcrumb-nav {
  background: #fff;
  border-bottom: 1px solid var(--td-border);
}

.breadcrumb {
  background: transparent;
  padding: 0;
  margin: 0;
  font-size: 0.9rem;
}

.breadcrumb-item a {
  color: var(--td-muted);
  text-decoration: none;
  transition: color var(--transition-base);
}

.breadcrumb-item a:hover {
  color: var(--td-red);
}

.breadcrumb-item.active {
  color: #0b1220;
  font-weight: 600;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "›";
  color: var(--td-muted);
  padding: 0 0.5rem;
}

/* ============================================
   TRUST BADGES
   ============================================ */
.trust-badges {
  padding: 1rem 0;
}

.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(204, 0, 0, 0.08);
  border: 1px solid rgba(204, 0, 0, 0.15);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--td-red);
  transition: all var(--transition-base);
}

.trust-badge i {
  font-size: 1rem;
}

.trust-badge:hover {
  background: rgba(204, 0, 0, 0.12);
  transform: translateY(-1px);
}

/* Vista toggle eliminado */

/* Asegurar que el grid funcione correctamente - Bootstrap row ya tiene display:flex */
#grid.row {
  display: flex !important;
  flex-wrap: wrap !important;
  margin-left: calc(var(--bs-gutter-x) * -0.5);
  margin-right: calc(var(--bs-gutter-x) * -0.5);
}

/* Asegurar que las columnas funcionen correctamente */
#grid.row > .col-6 {
  flex: 0 0 auto;
  width: 50%;
  padding-left: calc(var(--bs-gutter-x) * 0.5);
  padding-right: calc(var(--bs-gutter-x) * 0.5);
}

@media (min-width: 768px) {
  #grid.row > .col-md-4 {
    flex: 0 0 auto;
    width: 33.33333333%;
  }
}

@media (min-width: 992px) {
  #grid.row > .col-lg-4 {
    flex: 0 0 auto;
    width: 33.33333333%;
  }
}

/* En móviles muy pequeños, una columna */
@media (max-width: 400px) {
  #grid.row > .col-6 {
    width: 100%;
  }
}

/* Vista de lista eliminada - solo grid */

/* ============================================
   SKELETON LOADERS
   ============================================ */
.skeleton-card {
  background: var(--td-card);
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius);
  overflow: hidden;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-thumb {
  width: 100%;
  aspect-ratio: 1/1;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
}

.skeleton-line {
  height: 12px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  border-radius: 6px;
  animation: skeleton-shimmer 1.5s infinite;
  margin-bottom: 0.5rem;
}

.skeleton-button {
  height: 40px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  border-radius: 12px;
  animation: skeleton-shimmer 1.5s infinite;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@keyframes skeleton-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

/* ============================================
   COMPARADOR
   ============================================ */
.compare-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 2px solid var(--td-red);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  padding: 1rem;
  z-index: 1000;
  transform: translateY(100%);
  transition: transform var(--transition-base);
}

.compare-bar.show {
  transform: translateY(0);
}

.compare-items {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.compare-item {
  min-width: 120px;
  text-align: center;
  position: relative;
}

.compare-item img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 8px;
  border: 2px solid var(--td-border);
}

.compare-item-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--td-red);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
}

.product-card .compare-checkbox {
  position: absolute;
  top: 12px;
  left: 56px;
  width: 24px;
  height: 24px;
  z-index: 12;
  cursor: pointer;
  accent-color: var(--td-red);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 4px;
}

/* Si hay badge de descuento, el checkbox va a la derecha del badge */
.product-card:has(.product-badge-discount) .compare-checkbox {
  left: 80px;
}

/* ============================================
   WISHLIST
   ============================================ */
.wishlist-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--td-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  z-index: 15;
  color: var(--td-muted);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wishlist-btn:hover {
  background: #fff;
  color: var(--td-red);
  border-color: var(--td-red);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(214, 31, 44, 0.2);
}

.wishlist-btn.active {
  background: var(--td-red);
  color: #fff;
  border-color: var(--td-red);
}

/* ============================================
   MEJORAS DE PRODUCT CARD
   ============================================ */
.product-card {
  position: relative;
}

.product-card .product-badge {
  z-index: 5;
}

.product-stock-badge {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(16, 185, 129, 0.95);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 900;
  padding: 4px 8px;
  border-radius: 8px;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.product-stock-badge.out-of-stock {
  background: rgba(239, 68, 68, 0.95);
}

.product-rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  margin-top: 0.25rem;
}

/* ============================================
   FILTROS STICKY
   ============================================ */
@media (min-width: 992px) {
  aside.col-lg-3 {
    position: sticky;
    top: 100px;
    align-self: flex-start;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
  }
  
  aside.col-lg-3::-webkit-scrollbar {
    width: 6px;
  }
  
  aside.col-lg-3::-webkit-scrollbar-thumb {
    background: var(--td-border);
    border-radius: 3px;
  }
}

@media (max-width: 991px) {
  /* Filtros en tablets y móviles */
  aside.col-lg-3 {
    position: static;
    margin-bottom: 1.5rem;
  }
  
  /* Sidebar más compacto */
  .cardx {
    padding: 1rem !important;
  }
  
  /* Resultados en móvil */
  section.col-lg-9 {
    padding-top: 0 !important;
  }
}

/* ============================================
   PAGINACIÓN
   ============================================ */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
}

.pagination-btn {
  min-width: 40px;
  height: 40px;
  border: 1px solid var(--td-border);
  background: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  font-weight: 600;
}

.pagination-btn:hover:not(.disabled):not(.active) {
  border-color: var(--td-red);
  color: var(--td-red);
}

.pagination-btn.active {
  background: var(--td-red);
  color: #fff;
  border-color: var(--td-red);
}

.pagination-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   MEJORAS DE ESTADO VACÍO
   ============================================ */
#emptyState {
  padding: 4rem 2rem;
}

#emptyState .display-6 {
  font-size: 4rem;
  margin-bottom: 1rem;
}

/* ============================================
   MEJORAS DE MODAL
   ============================================ */
.modal-content {
  max-height: 90vh;
  overflow-y: auto;
}

.modal-hero {
  cursor: zoom-in;
  transition: transform var(--transition-base);
}

.modal-hero:hover {
  transform: scale(1.02);
}

.modal-hero.zoomed {
  cursor: zoom-out;
  transform: scale(1.5);
  z-index: 100;
}

/* ============================================
   UTILIDADES ADICIONALES
   ============================================ */
.text-center {
  text-align: center;
}

.mb-0 {
  margin-bottom: 0;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-3 {
  margin-top: 1rem;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-3 {
  margin-bottom: 1rem;
}

.w-100 {
  width: 100%;
}

.d-none {
  display: none !important;
}

.d-flex {
  display: flex !important;
}

.d-grid {
  display: grid !important;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 1rem;
}

.flex-grow-1 {
  flex-grow: 1;
}

/* ============================================
   MEJORAS DE FORMULARIOS
   ============================================ */
.form-control-sm {
  padding: 0.5rem;
  font-size: 0.875rem;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-check-input {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  accent-color: var(--td-red);
}

.form-check-label {
  cursor: pointer;
  user-select: none;
}

/* ============================================
   MEJORAS DE TABLA (COMPARADOR)
   ============================================ */
.table {
  margin-bottom: 0;
}

.table th {
  background: var(--td-bg);
  font-weight: 900;
  border-bottom: 2px solid var(--td-border);
  padding: 1rem;
}

.table td {
  padding: 1rem;
  vertical-align: middle;
}

.table-bordered {
  border: 1px solid var(--td-border);
}

.table-bordered th,
.table-bordered td {
  border: 1px solid var(--td-border);
}

/* ============================================
   SCROLLBAR PERSONALIZADO
   ============================================ */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--td-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--td-border);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--td-muted);
}

/* ============================================
   LOADING STATES
   ============================================ */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--td-red);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================
   KEYBOARD NAVIGATION
   ============================================ */
.keyboard-navigation *:focus {
  outline: 2px solid var(--td-red) !important;
  outline-offset: 2px !important;
}

/* ============================================
   FORM ENHANCEMENTS
   ============================================ */
.form-control.filled,
.form-select.filled {
  border-color: rgba(204, 0, 0, 0.3);
  background: rgba(204, 0, 0, 0.02);
}

.form-control.has-value {
  font-weight: 700;
}

/* ============================================
   RESPONSIVE IMPROVEMENTS
   ============================================ */
@media (max-width: 576px) {
  .trust-badge {
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
  }
  
  .trust-badge span {
    display: none;
  }
  
  .breadcrumb {
    font-size: 0.8rem;
  }
  
  .section-title {
    font-size: 1.5rem;
  }
  
  /* Modal en móviles pequeños */
  .modal-dialog {
    margin: 0.25rem auto; /* Mantener centrado */
    max-width: calc(100% - 0.5rem);
  }
  
  .modal-dialog-centered {
    min-height: calc(100% - 0.5rem);
    align-items: flex-start; /* En móvil, alinear arriba */
  }
  
  .modal-dialog-centered::before {
    height: calc(100vh - 0.5rem);
  }
  
  .modal-content {
    border-radius: 16px;
    max-height: 98vh;
  }
  
  .modal-header {
    padding: 1rem;
    flex-wrap: wrap;
  }
  
  .modal-title {
    font-size: 1.1rem;
    word-break: break-word;
    line-height: 1.3;
  }
  
  .modal-body {
    padding: 0.75rem;
    overflow-y: auto;
    max-height: calc(98vh - 120px);
  }
  
  .modal-body .cardx {
    padding: 0.75rem !important;
    margin-bottom: 0.75rem;
  }
  
  .modal-hero {
    min-height: 180px;
    max-height: 280px;
    border-radius: 10px;
    aspect-ratio: 1/1;
  }
  
  .modal-hero img {
    padding: 0.5rem;
    max-width: 100%;
    max-height: 100%;
  }
  
  /* Precio en móvil */
  .modal-body #mPrice {
    font-size: clamp(1.25rem, 6vw, 1.5rem) !important;
  }
  
  /* Botones en móvil */
  .modal-body .btn-td {
    font-size: 0.9rem;
    padding: 12px 16px;
    width: 100% !important;
  }
  
  /* Miniaturas en móvil muy pequeño */
  .thumbnail-gallery-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .thumbnail-item {
    min-width: 45px !important;
    width: 45px !important;
    height: 45px !important;
  }
  
  /* Grid de productos en móvil */
  #grid.row > .col-6 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
  }
  
  /* Header de resultados en móvil */
  .cardx.p-4 {
    padding: 1rem !important;
  }
  
  .cardx .d-flex {
    flex-direction: column;
    align-items: flex-start !important;
  }
  
  .cardx .h5 {
    font-size: 1.1rem;
  }
  
  /* Trust badges en móvil */
  .trust-badges {
    padding: 0.5rem 0;
  }
  
  .trust-badge {
    font-size: 0.7rem;
    padding: 0.35rem 0.7rem;
  }
  
  .trust-badge i {
    font-size: 0.85rem;
  }
  
  /* Breadcrumbs en móvil */
  .breadcrumb-nav {
    padding: 0.5rem 0;
  }
  
  .breadcrumb {
    font-size: 0.75rem;
  }
  
  /* Filtros en móvil */
  aside.col-lg-3 {
    position: static;
    max-height: none;
    margin-bottom: 1rem;
  }
  
  /* Cards de productos en móvil */
  .product-card {
    margin-bottom: 1rem;
  }
  
  .product-thumb {
    min-height: 200px;
  }
  
  .product-name {
    font-size: 0.9rem;
    min-height: auto;
  }
  
  .product-price {
    font-size: 1rem;
  }
}
