/* =========================
   COMPONENTS (Cards & Buttons)
   ========================= */

/* Bloquear selección de texto accidental al hacer doble clic */
.card-producto, 
.modal__content {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Permitir selección solo en textos específicos */
.p-titulo, .modalSimpleTitle, .modalSimpleDesc {
    -webkit-user-select: text;
    user-select: text;
}

/* =========================
   CARD PRODUCTO
   ========================= */
.card-producto {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.card-producto:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

/* Badge de Oferta */
.badge-oferta {
  position: absolute;
  top: 15px;
  left: 0;
  background-color: #c01017;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 10px;
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
  z-index: 10;
  text-transform: uppercase;
}

/* Imagen Card — definición única y limpia */
.card__img {
  width: 100%;
  padding-top: 100%; /* Proporción 1:1 cuadrado */
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  transition: transform 0.4s ease;
}

.card-producto:hover .card__img {
  transform: scale(1.05);
}

/* Cuerpo de la Card */
.card__body {
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  flex: 1;
  background-color: #ffffff;
}

/* Título del producto */
.card__title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 10px 0;
  color: #4a4a4a;
  line-height: 1.3;
  min-height: 46px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: 'Georgia', serif;
}

/* Fila del precio */
.card__price-row {
  margin-top: auto;
  margin-bottom: 20px;
}

.price-val {
  font-weight: 700;
  color: #8b5a2b;
  font-size: 22px;
}

/* Botón "Ver Producto" */
.btn-ver-producto {
  background-color: #fcfcfc;
  color: #8b5a2b;
  border: 1px solid #d5bda5;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 0;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  font-size: 13px;
}

.btn-ver-producto:hover {
  background-color: #8b5a2b;
  color: #fff;
  border-color: #8b5a2b;
}

/* =========================
   ESTADO: PRODUCTO EN CARRITO
   ========================= */
.card-producto.is-in-cart {
  border: 2px solid #27ae60;
  box-shadow: 0 5px 15px rgba(39, 174, 96, 0.15);
}

.card-producto.is-in-cart .btn-ver-producto {
  background-color: #f0fcf4;
  color: #27ae60;
  border-color: #27ae60;
}

.card-producto.is-in-cart .btn-ver-producto:hover {
  background-color: #27ae60;
  color: #fff;
}

.badge-in-cart {
  position: absolute;
  top: 15px;
  right: 15px;
  background-color: #27ae60;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: 4px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 5px rgba(39, 174, 96, 0.3);
  letter-spacing: 0.5px;
}

/* =========================
   ESTADO: AGOTADO
   ========================= */
.item-agotado .card__img {
  opacity: 0.6;
  filter: grayscale(80%);
}

.item-agotado .card__title {
  color: #999;
}

.btn-agotado {
  background-color: #f5f5f5;
  color: #999;
  border: 1px solid #ddd;
  font-weight: 700;
  padding: 10px 0;
  border-radius: 8px;
  cursor: not-allowed;
  width: 100%;
  font-size: 13px;
}

/* =========================
   RESPONSIVE CARDS: CELULARES
   ========================= */
@media (max-width: 600px) {
  .card__body { padding: 12px 10px; }
  .card__title { font-size: 12px; min-height: 34px; margin-bottom: 5px; }
  .price-val { font-size: 14px; }
  .price-label { font-size: 9px; margin-bottom: 0; line-height: 1.1; }
  .btn-ver-producto { font-size: 11px; padding: 8px 0; }
  .card__banner { font-size: 9px; padding: 4px 0; }
  .badge-in-cart { font-size: 8px; padding: 4px 6px; top: 10px; right: 10px; }
}

/* =========================
   MODAL — BASE
   ========================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
  padding: 0;
}
.modal:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal__panel {
  position: relative;
  width: 100%;
  max-width: 1100px;
  height: 85vh;
  background: #fff;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  margin: 20px;
}

.modal__close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 36px;
  height: 36px;
  background-color: #c01017;
  border-radius: 50%;
  border: 1px solid #c01017;
  cursor: pointer;
  color: #ffffff;
  z-index: 20;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.modal__close:hover {
  background: #333;
  color: #fff;
  border-color: #333;
}

.modal__content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* =========================
   MODAL — COLUMNA IZQUIERDA (CARRUSEL) — DESKTOP
   ========================= */
.modal__col-img {
  width: 48%;
  background: #1a1a1a; /* Fondo oscuro para que las fotos resalten */
  border-right: 1px solid #f0f0f0;
  display: flex;
  flex-direction: column;
  position: relative; /* Contexto para flechas y puntos */
  overflow: hidden;
  flex-shrink: 0;
}

/* Pista del carrusel — solo se ve 1 foto a la vez */
.carousel-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Cada slide ocupa exactamente el 100% del contenedor */
.modal__img-container {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.modal__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  cursor: zoom-in;
}

/* Ícono de lupa (abre lightbox) */
.zoom-icon {
  position: absolute;
  bottom: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  pointer-events: none; /* El click lo maneja el wrap */
  transition: transform 0.2s;
}
.zoom-icon svg { width: 18px; height: 18px; }
.modal__img-container:hover .zoom-icon { transform: scale(1.1); }

/* --- FLECHAS DEL CARRUSEL (desktop: aparecen al hover) --- */
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(255,255,255,0.92);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
  opacity: 0; /* Ocultas por defecto en desktop */
  pointer-events: none;
}
.carousel-btn svg { width: 20px; height: 20px; fill: #333; }
.carousel-btn.carousel-prev { left: 12px; }
.carousel-btn.carousel-next { right: 12px; }
.carousel-btn:hover { background: #fff; transform: translateY(-50%) scale(1.05); }
.carousel-btn.hidden-btn { display: none; } /* cuando hay solo 1 foto */

/* Mostrar flechas al hacer hover sobre la columna */
.modal__col-img:hover .carousel-btn {
  opacity: 1;
  pointer-events: auto;
}

/* --- PUNTITOS INDICADORES --- */
.carousel-dots {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 7px;
  z-index: 10;
}
.carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}
.carousel-dot.active {
  background: #fff;
  transform: scale(1.3);
}
/* Si hay 1 sola foto no mostramos puntos */
.carousel-dots:has(.carousel-dot:only-child) { display: none; }

/* =========================
   MODAL — COLUMNA DERECHA (INFO) — DESKTOP
   ========================= */
.modal__col-info {
  width: 52%; /* Complementa el 48% de la columna de fotos */
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
}

.modal__info-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 40px;
}

/* Sticky en desktop: la columna derecha queda fija mientras scrolleás las fotos */
@media (min-width: 901px) {
  .modal__col-info {
    position: sticky;
    top: 0;
    height: 100%;
    max-height: 85vh;
    overflow-y: auto;
  }
}

/* =========================
   MODAL — TEXTOS Y PRECIOS
   ========================= */
.modal__title {
  font-size: 26px;
  font-weight: 800;
  margin: 0 0 10px 0;
  color: #111;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.price-banner {
  background-color: #e5f2ff;
  border-radius: 8px;
  padding: 5px 12px;
  margin: 10px 0;
  border: 1px solid #eee;
}
.price-banner__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 5px;
}
.lbl-unitario { font-size: 14px; color: #666; }
.val-unitario { font-size: 14px; text-decoration: line-through; color: #999; }
.lbl-bonificado { font-size: 16px; font-weight: 700; color: #333; }
.val-bonificado { font-size: 28px; font-weight: 900; color: #111; }
.lbl-lista { font-size: 11px; color: #999; font-style: italic; text-align: right; margin-top: 5px; }

.modal__tipo {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =========================
   MODAL — GRILLA DE TALLES
   ========================= */
.pares-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 10px;
  margin-top: 15px;
}
.pares-item {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  background: #fff;
  transition: border 0.2s;
}
.pares-item:focus-within {
  border-color: #6d9ed2;
  box-shadow: 0 0 0 2px rgba(109, 158, 210, 0.2);
}
.pares-item__talle {
  font-weight: 800;
  font-size: 14px;
  margin-bottom: 5px;
  color: #333;
}
.pares-item input {
  width: 100%;
  border: 1px solid #eee;
  border-radius: 4px;
  text-align: center;
  padding: 4px;
  font-size: 15px;
  font-weight: 700;
  outline: none;
  background: #f9f9f9;
  color: #333;
}
.pares-item input:focus {
  background: #fff;
  border-color: #6d9ed2;
}
.pares-item__stock {
  font-size: 10px;
  color: #999;
  margin-top: 4px;
  font-weight: 600;
}

/* =========================
   MODAL — FOOTER
   ========================= */
.modal__footer {
  flex-shrink: 0;
  background: #fff;
  padding: 20px 40px;
  border-top: 1px solid #eee;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.03);
  z-index: 5;
}

.modal__resume-data {
  display: flex;
  gap: 30px;
}
.resume-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.resume-lbl {
  font-size: 11px;
  color: #999;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.resume-val {
  font-size: 20px;
  font-weight: 800;
  color: #333;
  line-height: 1;
}

.modal__actions {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
  flex: 1;
}

.btn-cancelar {
  padding: 12px 20px;
  border: 1px solid #ddd;
  color: #555;
  background: #fff;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-cancelar:hover {
  background: #f5f5f5;
  color: #c01017;
  border-color: #fadbd8;
}

.btn-agregar {
  padding: 12px 30px;
  background-color: #6aa8d5;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(106, 168, 213, 0.4);
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-agregar:hover {
  background-color: #568bb5;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(106, 168, 213, 0.5);
}

/* =========================
   MODAL — MINIATURAS
   ========================= */
.thumb-item {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  background-color: #f9f9f9;
  flex-shrink: 0;
}

/* =========================
   MODAL — RESPONSIVE TABLET/MÓVIL (única definición)
   ========================= */
@media (max-width: 900px) {
  .modal {
    padding: 15px;
    align-items: center;
  }

  .modal__panel {
    width: 100%;
    max-width: 100%;
    max-height: 95vh;
    height: 85vh;
    position: relative;
    bottom: auto;
    margin: 0;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  }

  .modal__content {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: auto;
    overflow: hidden;
    min-height: 0;
  }

  /* Fotos: carrusel cuadrado en mobile */
  .modal__col-img {
    width: 100%;
    aspect-ratio: 1 / 1; /* Cuadrado perfecto en mobile */
    height: auto;
    min-height: unset;
    border-right: none;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
  }

  /* En mobile las flechas siempre visibles (no hay hover) */
  .carousel-btn {
    opacity: 1;
    pointer-events: auto;
    width: 34px;
    height: 34px;
    background: rgba(255,255,255,0.85);
  }
  .carousel-btn svg { width: 18px; height: 18px; }

  .modal__img-container {
    border-radius: 0;
  }

  .modal__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    cursor: zoom-in;
  }

  /* Info: ocupa el resto */
  .modal__col-info {
    width: 100% !important;
    max-width: 100vw !important;
    flex: 1;
    height: auto;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    position: static;
    box-sizing: border-box;
  }

  .modal__info-scroll {
    flex: 1;
    width: 100% !important;
    max-width: 100vw !important;
    padding: 20px 15px 40px 15px !important;
    box-sizing: border-box;
    overflow-x: hidden !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal__title { font-size: 22px; }

  /* Footer responsive */
  .modal__footer {
    padding: 15px 20px;
    gap: 15px;
    flex-direction: column;
    align-items: stretch;
    flex-shrink: 0;
  }
  .modal__resume-data {
    width: 100%;
    justify-content: space-between;
    padding-bottom: 15px;
    border-bottom: 1px solid #f5f5f5;
    margin-bottom: 0;
  }
  .modal__actions { width: 100%; }
  .btn-cancelar { flex: 1; }
  .btn-agregar { flex: 2; }
}

/* =========================
   MÓDULOS Y EXTRAS
   ========================= */
.modulo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
  margin-bottom: 15px;
}
.mod-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid #eee;
  border-radius: 6px;
  overflow: hidden;
  min-width: 45px;
  background: #fff;
}
.mod-talle {
  width: 100%;
  background-color: #f8f9fa;
  color: #555;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  padding: 4px 0;
  border-bottom: 1px solid #eee;
}
.mod-cant {
  width: 100%;
  background-color: #fff;
  color: #111;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  padding: 6px 0;
}

.btn-add-modulo {
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  background-color: #fff;
  border: 1px solid #6d9ed2;
  color: #6d9ed2;
  font-weight: 700;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
}
.btn-add-modulo:hover:not(:disabled) {
  background-color: #6d9ed2;
  color: #fff;
  transform: translateY(-1px);
}
.btn-add-modulo:disabled {
  border-color: #eee;
  color: #ccc;
  cursor: not-allowed;
  background-color: #fcfcfc;
}

.modulo-control {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background-color: #f8f9fa;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #eee;
}
.modulo-control label {
  font-size: 13px;
  font-weight: 700;
  color: #555;
}
.modulo-input {
  width: 70px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  text-align: center;
  font-weight: 700;
  font-size: 16px;
  outline: none;
}
.modulo-input:focus {
  border-color: #6d9ed2;
  background: #fff;
}

/* =========================
   LIGHTBOX
   ========================= */
.lightbox-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.95);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.lightbox-overlay.active { opacity: 1; pointer-events: all; }

.lightbox-main {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1;
  position: relative;
}
.lightbox-img {
  max-width: 85vw;
  max-height: 75vh;
  object-fit: contain;
}

.lb-btn {
  position: absolute;
  background: rgba(255,255,255,0.15);
  color: white;
  border: none;
  width: 50px; height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}
.lb-btn:hover { background: rgba(255,255,255,0.3); }
.lb-btn svg { width: 24px; height: 24px; fill: white; }
.lb-prev { left: 5%; }
.lb-next { right: 5%; }

.lightbox-close {
  position: absolute;
  top: 20px; right: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  z-index: 10;
}
.lightbox-close svg { width: 30px; height: 30px; fill: white; }

.lightbox-thumbs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  max-width: 90vw;
  overflow-x: auto;
  padding: 10px 0;
}
.lb-thumb {
  width: 60px; height: 60px;
  object-fit: cover;
  object-position: top;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.5;
  transition: 0.2s;
}
.lb-thumb.active { opacity: 1; border-color: #fff; }

@media (max-width: 768px) {
  .lb-btn { width: 40px; height: 40px; }
  .lb-btn svg { width: 20px; height: 20px; }
  .lb-prev { left: 10px; }
  .lb-next { right: 10px; }
  .lightbox-img { max-width: 95vw; max-height: 70vh; }
  .lb-thumb { width: 50px; height: 50px; }
}

/* =========================
   UTILITY
   ========================= */
.hidden {
  display: none !important;
}