/* ===== CONTENEDOR PRINCIPAL ===== */
.carrito-contenedor {
  padding: clamp(1rem, 4vw, 2rem);
  background: linear-gradient(180deg, var(--primary-bg) 0%, var(--secondary-bg) 30%, var(--text-white) 100%);
  min-height: 100vh;
}

/* ===== TÍTULO ===== */
.titulo-carrito {
  text-align: center;
  font-size: clamp(1.8rem, 5vw, 2.1rem);
  margin-top: clamp(2rem, 5vw, 3rem);
  margin-bottom: clamp(1.5rem, 4vw, 2rem);
  color: var(--text-white);
  font-family: var(--font-display);
  font-weight: 800;
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-green));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
  position: relative;
  z-index: 1;
}

/* ===== GRID DEL CARRITO ===== */
.carrito-grid {
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 3vw, 2rem);
  padding: clamp(0.5rem, 2vw, 1rem);
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

/* ===== TARJETA HORIZONTAL ===== */
.tarjeta-horizontal {
  display: grid;
  grid-template-columns: minmax(200px, 290px) 1fr;
  background: var(--text-white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  width: 100%;
  border: 1.2px solid var(--border-color);
  transition: all var(--transition-smooth);
  align-items: stretch;
}

.tarjeta-horizontal:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-2px) scale(1.005);
}

/* ===== LADO IMAGEN ===== */
.lado-imagen {
  position: relative;
  overflow: hidden;
}

.lado-imagen img {
  width: 100%;
  height: 100%;
  min-height: 200px;
  object-fit: contain;
  background: var(--text-light);
  padding: clamp(0.5rem, 2vw, 1rem);
  transition: transform var(--transition-smooth);
}

.lado-imagen:hover img {
  transform: scale(1.05);
}

/* ===== LADO INFO ===== */
.lado-info {
  padding: clamp(1rem, 3vw, 2rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: clamp(0.9rem, 2vw, 1rem);
  color: var(--secondary-bg);
  font-family: var(--font-sans);
  line-height: 1.5;
}

.lado-info p {
  margin: 0.5rem 0;
  color: var(--secondary-bg);
}

/* ===== TOTAL A PAGAR ===== */
.total-pagar {
  font-size: clamp(1.1rem, 3vw, 1.36rem);
  color: var(--accent-green);
  margin-top: 1.2rem;
  font-weight: 700;
  font-family: var(--font-display);
}

/* ===== ESTADOS ===== */
.estado {
  display: inline-block;
  padding: clamp(0.4rem, 1.5vw, 0.6rem) clamp(0.8rem, 2.5vw, 1.2rem);
  margin-top: 1rem;
  border-radius: var(--border-radius-md);
  font-weight: 700;
  text-align: center;
  font-size: clamp(0.85rem, 2vw, 1.01rem);
  letter-spacing: 0.01em;
  background: var(--secondary-bg);
  color: var(--text-white);
  white-space: nowrap;
  align-self: flex-start;
}

.estado-proceso {
  background: linear-gradient(90deg, var(--accent-gold) 70%, var(--accent-green) 100%);
  color: var(--primary-bg);
}

.estado-pendiente {
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-gold) 60%);
  color: var(--primary-bg);
}

.estado-finalizado {
  background: linear-gradient(90deg, var(--accent-green) 60%, var(--accent-gold) 100%);
  color: var(--text-white);
}

/* ===== BOTÓN MIS COMPRAS ===== */
.boton-mis-compras {
  margin-top: clamp(1.5rem, 3vw, 2rem);
  text-align: center;
}

.btn-secundario {
  display: inline-block;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-gold) 100%);
  color: var(--text-white);
  padding: clamp(0.6rem, 2vw, 0.8rem) clamp(1rem, 3vw, 1.5rem);
  border-radius: var(--border-radius-md);
  text-decoration: none;
  font-size: clamp(0.9rem, 2.2vw, 1rem);
  font-family: var(--font-display);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-smooth);
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn-secundario:hover {
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-blue));
  box-shadow: var(--shadow-md);
  transform: scale(1.04) translateY(-2px);
}

/* ===== CARRITO VACÍO ===== */
.carrito-vacio {
  text-align: center;
  color: var(--text-white);
  padding: clamp(1.5rem, 4vw, 2rem);
  background: rgba(226, 232, 240, 0.09);
  border-radius: var(--border-radius-lg);
  margin: clamp(2rem, 5vw, 3rem) auto;
  max-width: 500px;
  font-family: var(--font-sans);
  animation: fadeIn 0.6s var(--transition-smooth);
  border: 1.2px solid var(--border-color);
}

.carrito-vacio i {
  color: var(--accent-blue);
  font-size: clamp(1.8rem, 4vw, 2.2rem);
  margin-bottom: 1rem;
}

.carrito-vacio p {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  margin-top: 1rem;
  line-height: 1.4;
}

.carrito-vacio a {
  display: inline-block;
  margin-top: 1.2rem;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
  color: var(--text-white);
  padding: clamp(0.5rem, 1.5vw, 0.6rem) clamp(1rem, 2.5vw, 1.2rem);
  border-radius: var(--border-radius-md);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-smooth);
  font-size: clamp(0.9rem, 2vw, 1rem);
}

.carrito-vacio a:hover {
  background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
  box-shadow: var(--shadow-md);
  transform: scale(1.04) translateY(-1px);
}

/* ===== BOTÓN CANCELAR ===== */
.btn-cancelar {
  margin-top: 10px;
  background: linear-gradient(90deg, #dc3545 70%, var(--accent-gold));
  color: var(--text-white);
  border: none;
  padding: clamp(4px, 1.5vw, 6px) clamp(8px, 2.5vw, 12px);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 600;
  transition: all var(--transition-fast);
  font-size: clamp(0.8rem, 1.8vw, 0.9rem);
  align-self: flex-start;
}

.btn-cancelar:hover {
  background: linear-gradient(90deg, var(--accent-gold), #dc3545 100%);
  box-shadow: var(--shadow-md);
  transform: scale(1.05) translateY(-1px);
}

/* ===== OCULTO ===== */
.oculto {
  display: none !important;
}

/* ===== ALERTAS PREMIUM ===== */
.alerta {
  position: fixed;
  top: clamp(12px, 3vw, 22px);
  right: clamp(12px, 3vw, 22px);
  background: linear-gradient(90deg, var(--accent-green), var(--accent-gold) 100%);
  color: var(--text-white);
  padding: clamp(8px, 2vw, 12px) clamp(12px, 3vw, 20px);
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.42s var(--transition-smooth);
  z-index: 9999;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(0.8rem, 2vw, 0.9rem);
  max-width: calc(100vw - 24px);
  word-wrap: break-word;
}

.alerta.mostrar {
  opacity: 1;
  transform: translateY(0);
}

.alerta.error {
  background: linear-gradient(90deg, #dc3545 60%, var(--accent-gold));
}

.alerta i {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  flex-shrink: 0;
}

/* ===== ANIMACIÓN FADEIN ===== */
@keyframes fadeIn {
  from { 
    opacity: 0; 
    transform: translateY(10px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Tablets en portrait */
@media (max-width: 768px) {
  .tarjeta-horizontal {
    grid-template-columns: 1fr;
    max-width: 100%;
  }
  
  .lado-imagen img {
    min-height: 180px;
    border-radius: var(--border-radius-md) var(--border-radius-md) 0 0;
  }
  
  .lado-info {
    padding: clamp(1rem, 3vw, 1.5rem);
  }
  
  .carrito-grid {
    gap: 1.5rem;
  }
}

/* Móviles grandes */
@media (max-width: 480px) {
  .carrito-contenedor {
    padding: 1rem 0.5rem;
  }
  
  .tarjeta-horizontal {
    margin: 0 0.25rem;
  }
  
  .lado-imagen img {
    min-height: 160px;
    padding: 0.75rem;
  }
  
  .lado-info {
    padding: 1rem 0.75rem;
  }
  
  .carrito-grid {
    padding: 0.25rem;
    gap: 1rem;
  }
  
  .estado {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
}

/* Móviles pequeños */
@media (max-width: 320px) {
  .titulo-carrito {
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }
  
  .lado-imagen img {
    min-height: 140px;
    padding: 0.5rem;
  }
  
  .lado-info {
    padding: 0.75rem 0.5rem;
  }
  
  .total-pagar {
    font-size: 1rem;
    margin-top: 0.8rem;
  }
  
  .btn-secundario,
  .carrito-vacio a {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
  }
}

/* Mejoras para dispositivos táctiles */
@media (hover: none) and (pointer: coarse) {
  .tarjeta-horizontal:hover,
  .btn-secundario:hover,
  .btn-cancelar:hover,
  .carrito-vacio a:hover {
    transform: none;
  }
  
  .lado-imagen:hover img {
    transform: none;
  }
  
  /* Aumentar área de toque para botones */
  .btn-secundario,
  .btn-cancelar,
  .carrito-vacio a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Mejoras para alta densidad de píxeles */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .lado-imagen img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Modo landscape en móviles */
@media (max-width: 768px) and (orientation: landscape) {
  .carrito-contenedor {
    padding: 1rem;
  }
  
  .titulo-carrito {
    font-size: 1.8rem;
    margin-bottom: 1rem;
  }
  
  .tarjeta-horizontal {
    grid-template-columns: 200px 1fr;
  }
  
  .lado-imagen img {
    min-height: 120px;
  }
}