/* ========================================= */
/* ESTILOS PARA PRODUCTOS DENTRO DEL CARRITO */
/* ========================================= */

.carrito-producto {
  position: relative;
  margin-bottom: 10px;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 10px 12px 34px;
  background-color: #fafafa;
  font-size: 0.85em;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.carrito-producto__eliminar {
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 18px;
  font-weight: bold;
  color: #888;
  cursor: pointer;
  transition: color 0.3s ease;
}

.carrito-producto__eliminar:hover {
  color: #ff4136;
}

.carrito-producto__titulo {
  margin: 0 0 8px;
  color: #444;
  font-size: 1em;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 4px;
}

.carrito-producto__detalles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.carrito-producto__detalle-item {
  flex: 1 1 48%;
  margin: 2px 0;
  word-break: break-word; /* Para enlaces largos */
}

.carrito-producto__enlace {
  color: #007bff;
  text-decoration: underline;
}

.carrito-producto__subtotal-wrapper {
  text-align: right;
  margin-top: 10px;
}

.carrito-producto__subtotal {
  color: #ff4136;
  font-size: 1em;
  font-weight: bold; /* Añadido para consistencia */
}

/* ========================================= */
/* ESTILOS DEL CARRITO DE COMPRAS */
/* ========================================= */

/* --- 1. Overlay (Fondo Oscuro) --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: none; /* Se activa con JS */
}

/* --- 2. Contenedor Principal del Modal --- */
.modal-carrito {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  z-index: 1001;
  width: 100%;
  max-width: 600px;
  max-height: 95vh;
  overflow: hidden;
  border-radius: 12px;
  display: none; /* Se activa con JS */
  box-shadow: 0 4px_12px rgba(0, 0, 0, 0.3);
  padding: 0;
  /* Se eliminó la declaración repetida de "position: fixed;" */
}

/* --- 3. Encabezado y Botón de Cerrar --- */
.cerrar-modal {
  position: absolute;
  top: 10px;
  right: 15px;
  width: 40px;
  height: 40px;
  font-size: 24px;
  font-weight: bold;
  color: #fff;
  cursor: pointer;
  z-index: 1002;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  line-height: 1;
}
.cerrar-modal:hover {
  transform: rotate(90deg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.car {
  background: linear-gradient(to right, #ff4136, #e63946);
  color: white;
  padding: 20px;
  font-size: 1.5em;
  text-align: center;
  border-radius: 12px 12px 0 0;
  margin: 0;
}

/* --- 4. Área de Contenido (Scroll) --- */
.carrito-scroll {
  overflow-y: auto;
  padding: 20px;
  /* Se deja un espacio abajo para que no choque con el resumen */
  padding-bottom: 220px; 
  /* Altura calculada para ocupar el espacio entre el header y el footer del modal */
  height: calc(95vh - 60px - 180px);
  box-sizing: border-box;
}
.carrito-scroll::-webkit-scrollbar {
  width: 6px;
}
.carrito-scroll::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
}
.carrito-scroll::-webkit-scrollbar-track {
  background: transparent;
}

/* --- 5. Resumen de Pago (Footer del Modal) --- */
.resumen-carrito {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: white;
  padding: 25px 30px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  z-index: 10;
  border-top: 1px solid #ddd;
  font-size: 1.1em;
  box-sizing: border-box;
}
.resumen-linea {
  display: flex;
  justify-content: space-between;
  margin: 4px 0;
}
.resumen-linea.total strong {
  font-size: 1.1em;
  color: #ff4136;
}
.finalizar-compra-container {
  margin-top: 12px;
  text-align: center;
}
.btn-finalizar {
  width: 100%;
  padding: 12px 0;
  background: linear-gradient(to right, #ff4136, #e63946);
  color: white;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
}
.btn-finalizar:hover {
  background: linear-gradient(to right, #e63946, #d62839);
  transform: scale(1.02);
}
.btn-finalizar:active {
  background-color: #c12b24;
  transform: scale(0.98);
}

/* ========================================= */
/* ESTILOS DEL TOAST (Notificaciones) */
/* ========================================= */

.toast-container {
  position: fixed;
  top: 90px;
  right: 30px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: linear-gradient(to right, #E1306C, #C13584, #F77737);
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  font-size: 13px;
  animation: fadeInOut 4s ease forwards;
  max-width: 300px;
  word-break: break-word;
}
@keyframes fadeInOut {
  0% { opacity: 0; transform: translateY(-10px); }
  10%, 90% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-10px); }
}


/* ========================================= */
/* ESTILOS RESPONSIVOS PARA EL CARRITO */
/* ========================================= */

@media (max-width: 600px) {
  .modal-carrito {
    width: 90%;
    max-height: 85vh; 
  }
  .car {
    padding: 15px;
    font-size: 1.2em;
  }
  .carrito-scroll {
    /* Ajustamos el padding inferior para que el contenido no quede tan arriba */
    padding-bottom: 180px; 
    /* Ajustamos el cálculo de la altura para la nueva altura máxima del modal */
    height: calc(85vh - 51px - 155px);
  }
  .resumen-carrito {
    padding: 15px 20px;
    font-size: 1em;
  }
}