/* MODALES */
.modal {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}

.modal-contenido {
  position: relative;
  background: 
    linear-gradient(135deg, var(--blanco) 0%, #f8f9fa 100%);
  padding: 35px;
  border-radius: 20px;
  width: 90%;
  max-width: 500px;
  z-index: 1100;
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.8);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-contenido::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    url('../img/fondomodal.jpg') no-repeat center center;
  background-size: cover;
  filter: grayscale(0%) opacity(0.12) saturate(120%);
  border-radius: 20px;
  z-index: -1;
}

.producto-modal-contenido {
  position: relative;
  background: 
    linear-gradient(135deg, var(--blanco) 0%, #f8f9fa 100%);
  max-width: 1100px;
  width: 95%;
  display: flex;
  gap: 30px;
  padding: 30px;
  border-radius: 20px;
  z-index: 1100;
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.8);
  max-height: 90vh;
  overflow-y: auto;
}

.producto-modal-contenido::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    url('../img/fondomodal.jpg') no-repeat center center;
  background-size: cover;
  filter: grayscale(0%) opacity(0.12) saturate(120%);
  border-radius: 20px;
  z-index: -1;
}


.modal-contenido h2 {
  color: var(--azul-oscuro);
  margin-bottom: 20px;
  text-align: center;
  font-size: 1.8rem;
}

.texto-contenedor {
  text-align: center;
  padding: 25px;
  margin-bottom: 25px;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 15px;
  border: 2px solid rgba(10, 61, 98, 0.1);
  box-shadow: 0 8px 25px rgba(10, 61, 98, 0.08);
  position: relative;
  backdrop-filter: blur(10px);
}

.texto-contenedor::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, var(--rojo-colorcopy), var(--azul-principal));
  border-radius: 2px;
}

.texto-contenedor h2 {
  font-family: 'Montserrat', sans-serif;
  color: var(--azul-oscuro);
  font-size: 2.1rem;
  font-weight: 700;
  margin-bottom: 15px;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.texto-contenedor p {
  font-family: 'Poppins', sans-serif;
  color: var(--gris-oscuro);
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.7;
  margin: 0;
}

.cerrar-modal {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  cursor: pointer;
  color: var(--gris-oscuro);
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cerrar-modal:hover {
  color: var(--rojo-colorcopy);
  background: white;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.oculto {
  display: none !important;
}

/* MODAL PRODUCTO */
.producto-detalle {
  display: flex;
  gap: 30px;
  align-items: flex-start;
  width: 100%;
}

.detalle-imagen {
  flex-shrink: 0;
  width: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f9f9f9 0%, #f0f0f0 100%);
  border-radius: 12px;
  padding: 20px;
  border: 2px solid var(--gris-medio);
  min-height: 400px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  position: relative; /* Agregado para el pseudo-elemento */
  overflow: hidden; /* Para contener la franja */
}

.detalle-imagen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, var(--rojo-colorcopy), var(--azul-principal));
  border-radius: 2px;
  z-index: 1;
}

.detalle-imagen img {
  width: 100%;
  max-width: 400px;
  height: auto;
  max-height: 500px;
  object-fit: contain;
  object-position: center;
  border-radius: 10px;
  position: relative; /* Para que esté por encima de la franja */
  z-index: 0;
}

.detalle-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 550px;
  min-height: 600px;
  height: 85vh;
}

.opcion {
  margin-top: 8px;
  padding: 8px 0;
}

.opcion em {
  font-family: 'Poppins', sans-serif;
  font-style: italic;
  color: var(--gris-oscuro);
  font-weight: 300;
}

.opcion label {
  display: block;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 10px;
  color: var(--azul-oscuro);
  letter-spacing: 0.3px;
}

.opcion-contenedor {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 5px;
}

#opciones-medidas, 
#opciones-colores, 
#opciones-material,
#opciones-terminacion,
#opciones-acabado {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.opcion button, 
.opcion .chip {
  font-family: 'Poppins', sans-serif;
  border-radius: 20px;
  padding: 10px 16px;
  border: none;
  cursor: pointer;
  background: #0000006f;
  transition: all 0.3s ease;
  font-weight: 500;
  font-size: 0.95rem;
}

.chip {
  font-family: 'Poppins', sans-serif;
  border-radius: 20px;
  padding: 8px 14px;
  border: none;
  cursor: pointer;
  background: #0000006f;
  transition: all 0.3s ease;
  font-weight: 500;
  font-size: 0.9rem;
  min-height: 36px;
}

.chip:hover {
  background: var(--gris-oscuro);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.chip.selected {
  background: linear-gradient(135deg, var(--azul-principal), var(--azul-oscuro));
  color: white;
  box-shadow: 0 4px 10px rgba(0, 64, 133, 0.3);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.modal-actions button {
  flex: 1;
  padding: 12px 20px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-size: 0.9rem;
  min-height: 44px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

/* BOTÓN AGREGAR AL CARRITO MEJORADO - MÁS GRANDE */
#btn-agregar-carrito,
.btn-gris {
  min-height: 48px !important;
  padding: 14px 22px !important;
  font-size: 0.95rem !important;
  line-height: 1 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  text-transform: uppercase;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}
/* Botón rojo (Agregar al carrito) */
#btn-agregar-carrito {
  background: linear-gradient(135deg, var(--rojo-colorcopy) 0%, var(--rojo-oscuro) 100%) !important;
  color: #fff !important;
  box-shadow:
    0 4px 15px rgba(220, 53, 69, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  flex: 0.6 !important; /* 60% del ancho disponible */
}

/* Hover del botón rojo */
#btn-agregar-carrito:hover {
  background: linear-gradient(135deg, var(--rojo-oscuro) 0%, var(--rojo-colorcopy) 100%) !important;
  transform: translateY(-2px);
  box-shadow:
    0 6px 20px rgba(220, 53, 69, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}


#btn-agregar-carrito::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

#btn-agregar-carrito:hover::before {
  left: 100%;
}

#btn-agregar-carrito:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 6px 20px rgba(220, 53, 69, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  background: linear-gradient(135deg, var(--rojo-oscuro) 0%, var(--rojo-colorcopy) 100%);
}

#btn-agregar-carrito:active {
  transform: translateY(0);
  box-shadow: 
    0 2px 10px rgba(220, 53, 69, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}



/* BOTÓN CANCELAR MEJORADO - MÁS PEQUEÑO */
.btn-gris {
  background: linear-gradient(135deg, #6c757d 0%, #495057 100%) !important;
  color: #fff !important;
  box-shadow:
    0 4px 15px rgba(108, 117, 125, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  flex: 0.4 !important; /* 40% del ancho disponible */
}

/* Hover del botón gris */
.btn-gris:hover {
  background: linear-gradient(135deg, #495057 0%, #6c757d 100%) !important;
  transform: translateY(-2px);
  box-shadow:
    0 6px 20px rgba(108, 117, 125, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-gris:active {
  transform: translateY(0);
  box-shadow: 
    0 2px 10px rgba(108, 117, 125, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-personalizar {
  background: linear-gradient(135deg, var(--azul-principal) 0%, var(--azul-oscuro) 100%) !important;
  color: white;
  padding: 10px 14px !important;
  border-radius: 20px;
  font-size: 0.9rem;
  margin: 0 !important;
  flex-shrink: 0;
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

.btn-personalizar:hover {
  background: linear-gradient(135deg, var(--azul-oscuro) 0%, var(--azul-principal) 100%) !important;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);
}

.btn-confirmar {
  background: linear-gradient(135deg, var(--rojo-colorcopy) 0%, var(--rojo-oscuro) 100%) !important;
  padding: 10px 14px !important;
  margin: 0 !important;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  transition: all 0.3s ease;
  color: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.btn-confirmar:hover {
  background: linear-gradient(135deg, var(--rojo-oscuro) 0%, var(--rojo-colorcopy) 100%) !important;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.input-personalizado {
  display: flex;
  gap: 8px;
}

.input-personalizado input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--gris-medio);
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.input-personalizado input:focus {
  outline: none;
  border-color: var(--azul-principal);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

/* PRECIO DETALLE MEJORADO */
#detalle-precio {
  background: linear-gradient(135deg, #2e7d32 0%, #388e3c 50%, #43a047 100%) !important;
  color: white !important;
  padding: 12px 20px;
  border-radius: 20px;
  text-align: center;
  font-weight: 700;
  box-shadow: 
    0 4px 15px rgba(46, 125, 50, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  margin: 8px auto 5px;
  max-width: fit-content;
  min-width: 140px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

#detalle-precio::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.6s ease;
}

#detalle-precio:hover::before {
  left: 100%;
}

#detalle-precio strong {
  font-family: 'Montserrat', sans-serif;
  color: white !important;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* CONTENEDOR DE OPCIONES CON SCROLL - MÁS ESPACIO */
#opciones-container {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
  overflow-y: auto;
  max-height: calc(85vh - 200px);
  padding: 20px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.9) 100%);
  border-radius: 12px;
  border: 1px solid rgba(10, 61, 98, 0.08);
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.03),
    0 4px 12px rgba(10, 61, 98, 0.06);
}

/* ACCIONES FIJAS - OCUPANDO MENOS ESPACIO */
.acciones-fijas {
  flex-shrink: 0;
  margin-top: auto;
  padding: 5px;
  margin-bottom: 0;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 15px;
  border: 2px solid rgba(10, 61, 98, 0.1);
  box-shadow: 0 8px 25px rgba(10, 61, 98, 0.08);
  position: relative;
  backdrop-filter: blur(10px);
  min-height: auto;
}

.acciones-fijas::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, var(--rojo-colorcopy), var(--azul-principal));
  border-radius: 2px;
}

.acciones-fijas .opcion {
  margin-bottom: 5px;
}

/* TÍTULO PRECIO CENTRADO */
.acciones-fijas .opcion label {
  text-align: center;
  display: block;
  width: 100%;
  margin-bottom: 5px;
  font-size: 0.9rem;
  font-family: 'Montserrat', sans-serif;
}

/* Botones más compactos en acciones fijas */
.acciones-fijas .modal-actions {
  margin-top: 8px;
  gap: 8px;
}

.acciones-fijas .modal-actions button {
  padding: 10px 16px;
  min-height: 40px;
  font-size: 0.85rem;
  margin-bottom: 0;
  font-family: 'Montserrat', sans-serif;
}

.acciones-fijas .modal-actions .btn-gris {
  flex: 0.4 !important;
}

/* Asegura la proporción también dentro de acciones fijas */
.acciones-fijas .modal-actions #btn-agregar-carrito {
  flex: 0.6 !important;
}

/* Scroll personalizado */
.producto-detalle::-webkit-scrollbar {
  width: 8px;
}

.producto-detalle::-webkit-scrollbar-track {
  background: var(--gris-claro);
  border-radius: 10px;
}

.producto-detalle::-webkit-scrollbar-thumb {
  background: var(--azul-principal);
  border-radius: 10px;
}

.producto-detalle::-webkit-scrollbar-thumb:hover {
  background: var(--azul-oscuro);
}

#opciones-container::-webkit-scrollbar {
  width: 6px;
}

#opciones-container::-webkit-scrollbar-track {
  background: var(--gris-claro);
  border-radius: 10px;
}

#opciones-container::-webkit-scrollbar-thumb {
  background: var(--azul-principal);
  border-radius: 10px;
}

#opciones-container::-webkit-scrollbar-thumb:hover {
  background: var(--azul-oscuro);
}

/* RESPONSIVE MODALES */
@media (max-width: 768px) {
  .modal-contenido {
    padding: 20px;
    width: 95%;
  }
  
  .producto-modal-contenido {
    flex-direction: column;
    align-items: center;
    max-height: 95vh;
    overflow-y: auto;
    padding: 20px;
  }
  
  .producto-detalle {
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }
  
  .detalle-imagen {
    width: 100%;
    max-width: 100%;
    min-height: 350px;
  }
  
  .detalle-imagen img {
    width: 100%;
    max-width: 100%;
    max-height: 400px;
  }
  
  .detalle-info {
    max-width: 100%;
    min-height: auto;
    height: auto;
  }

  .texto-contenedor h2 {
    font-size: 1.6rem;
  }
  
  .modal-actions {
    flex-direction: column;
  }

  .modal-actions button {
    padding: 14px 20px;
    font-size: 1rem;
  }

  /* En móvil, ajustamos los botones para que sean del mismo tamaño */
  #btn-agregar-carrito,
  .btn-gris {
    flex: 1;
    min-height: 46px;
    padding: 12px 20px;
    font-size: 0.7rem;
  }

  #detalle-precio {
    padding: 10px 16px;
    min-width: 130px;
    max-width: 90%;
    margin: 12px auto 8px;
  }

  #detalle-precio strong {
    font-size: 1.2rem;
    word-wrap: break-word;
    white-space: normal;
    text-align: center;
  }

  #opciones-container {
    max-height: none;
    overflow-y: visible;
    margin-bottom: 0;
    gap: 12px;
  }

  .acciones-fijas {
    margin-top: 15px;
    padding: 20px;
    border-radius: 12px;
  }

  /* En móvil, acciones fijas más compactas */
  .acciones-fijas .modal-actions button {
    padding: 12px 18px;
    min-height: 44px;
    font-size: 0.95rem;
  }
  .modal-contenido::before,
  .producto-modal-contenido::before {
    position: fixed;
    /* Calcular posición basada en el modal */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% - 40px); /* Restar el padding del modal */
    height: calc(100% - 40px);
    max-width: 500px; /* Mismo max-width que el modal */
    max-height: 90vh; /* Mismo max-height que el modal */
  }
  
  /* Ajuste específico para el modal de producto en móviles */
  .producto-modal-contenido::before {
    max-width: calc(100% - 40px);
  }
}

@media (max-width: 480px) {
  .producto-modal-contenido {
    padding: 15px;
  }
  
  .detalle-info {
    min-height: auto;
  }

  .detalle-imagen {
    min-height: 280px;
  }

  .detalle-imagen img {
    max-height: 320px;
  }

  #detalle-precio {
    padding: 8px 14px;
    min-width: 120px;
  }

  #detalle-precio strong {
    font-size: 1.1rem;
  }

  .texto-contenedor h2 {
    font-size: 1.4rem;
  }

  .modal-actions button {
    padding: 12px 18px;
    font-size: 0.95rem;
  }

  /* En móvil pequeño, acciones fijas aún más compactas */
  .acciones-fijas {
    margin-top: 12px;
    padding: 15px;
    border-radius: 10px;
  }

  .acciones-fijas .modal-actions {
    gap: 6px;
  }

  .acciones-fijas .modal-actions button {
    padding: 10px 14px;
    min-height: 40px;
    font-size: 0.9rem;
  }
  .modal-contenido::before,
  .producto-modal-contenido::before {
    width: calc(100% - 30px);
    height: calc(100% - 30px);
  }
}