/* Estilos generales mejorados */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: #f5f5f5;
  margin: 0;
  padding: 0;
  color: #333;
  line-height: 1.6;
  min-height: 100vh;
}

/* Header mejorado */
.header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 1rem clamp(1rem, 3vw, 2rem);
  background-color: #004aad;
  color: white;
  position: sticky;
  top: 0;
  z-index: 1000;
  gap: 1rem;
}

.header .logo {
  display: flex;
  align-items: center;
  min-width: fit-content;
}

.header .logo img {
  height: clamp(40px, 5vw, 50px);
  margin-right: 0.75rem;
  object-fit: contain;
}

.header .nav-container {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-grow: 1;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
  justify-content: center;
}

.nav-links a {
  color: white;
  text-decoration: none;
  font-size: clamp(0.9rem, 2vw, 1rem);
  transition: color 0.3s;
  white-space: nowrap;
  font-weight: 500;
}

.nav-links a:hover {
  color: #ffcc00;
}

.icon-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.icon-container i {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  position: relative;
  cursor: pointer;
}

.fa-shopping-cart[data-count]:after {
  content: attr(data-count);
  position: absolute;
  top: -0.6rem;
  right: -0.6rem;
  background: #ff0000;
  color: white;
  border-radius: 50%;
  width: 1.2rem;
  height: 1.2rem;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.search-container {
  display: flex;
  align-items: center;
  border: 1px solid white;
  border-radius: 2rem;
  padding: 0.4rem 0.8rem;
  background: rgba(255, 255, 255, 0.1);
  min-width: 8rem;
  max-width: 15rem;
  flex-grow: 1;
}

.search-container input {
  background: none;
  border: none;
  color: white;
  outline: none;
  font-size: clamp(0.8rem, 2vw, 0.9rem);
  width: 100%;
  padding: 0.2rem;
}

.search-container input::placeholder {
  color: rgba(255, 255, 255, 0.7);
  font-size: clamp(0.8rem, 2vw, 0.9rem);
}

.search-icon {
  margin-left: 0.3rem;
  color: white;
  cursor: pointer;
  font-size: clamp(0.9rem, 2vw, 1rem);
}

/* Contenedor principal mejorado */
.cart-container {
  width: min(90%, 900px);
  margin: 2rem auto;
  background: white;
  border-radius: 0.8rem;
  padding: clamp(1.5rem, 3vw, 2rem);
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.cart-container h1 {
  text-align: center;
  color: #004aad;
  margin-bottom: 2rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 600;
}

/* Items del carrito mejorados */
.cart-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid #eee;
  align-items: center;
}

.cart-item-img {
  width: clamp(80px, 15vw, 100px);
  height: clamp(80px, 15vw, 100px);
  object-fit: contain;
  border-radius: 0.5rem;
  border: 1px solid #ddd;
  background-color: #f9f9f9;
  padding: 0.5rem;
}

.cart-item-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.cart-item-info h3 {
  margin: 0 0 0.5rem;
  color: #004aad;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  font-weight: 600;
}

.cart-item-info p {
  margin: 0.3rem 0;
  color: #555;
  font-size: clamp(0.85rem, 2vw, 0.95rem);
}

.price {
  font-weight: 700;
  color: #2c3e50;
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
}

/* Controles de cantidad mejorados */
.quantity-controls {
  display: flex;
  align-items: center;
  margin: 0.8rem 0;
}

.quantity-btn {
  background-color: #004aad;
  color: white;
  border: none;
  width: 2rem;
  height: 2rem;
  border-radius: 0.3rem;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.quantity-btn:hover {
  background-color: #003b8a;
  transform: scale(1.05);
}

.quantity-btn:active {
  transform: scale(0.95);
}

.quantity-input {
  width: 3rem;
  height: 2rem;
  text-align: center;
  margin: 0 0.5rem;
  border: 1px solid #ddd;
  border-radius: 0.3rem;
  font-size: 0.95rem;
}

/* Botones mejorados */
.remove-btn {
  background-color: #e74c3c;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.3rem;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: all 0.3s;
  font-weight: 500;
  font-size: clamp(0.8rem, 2vw, 0.9rem);
  width: fit-content;
}

.remove-btn:hover {
  background-color: #c0392b;
  transform: translateY(-2px);
}

.remove-btn:active {
  transform: translateY(0);
}

/* Resumen del carrito mejorado */
.cart-summary {
  text-align: right;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid #eee;
}

.cart-summary h2 {
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  color: #333;
  margin-bottom: 1.5rem;
  font-weight: 600;
}

.total-price {
  font-size: clamp(1.1rem, 3vw, 1.3rem);
  font-weight: 700;
  color: #004aad;
  margin: 1rem 0;
}

.pay-btn {
  background-color: #27ae60;
  color: white;
  padding: 0.8rem 1.8rem;
  border: none;
  border-radius: 0.3rem;
  cursor: pointer;
  font-size: clamp(0.9rem, 2vw, 1rem);
  font-weight: 500;
  transition: all 0.3s;
  display: inline-block;
}

.pay-btn:hover {
  background-color: #219653;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.pay-btn:active {
  transform: translateY(0);
}

/* Carrito vacío mejorado */
.empty-cart {
  text-align: center;
  padding: 3rem;
  color: #777;
  font-size: clamp(1rem, 3vw, 1.2rem);
}

.empty-cart-icon {
  font-size: 3rem;
  color: #ddd;
  margin-bottom: 1rem;
}

/* Alertas mejoradas */
.stock-alerts {
  margin-bottom: 1.5rem;
}

.dismissible-alert {
  position: relative;
  padding: 1rem 3rem 1rem 1rem;
  margin-bottom: 0.8rem;
  border-radius: 0.4rem;
  display: flex;
  align-items: center;
  animation: fadeIn 0.3s ease-out;
  font-size: clamp(0.85rem, 2vw, 0.95rem);
}

.alert-warning {
  background-color: #fff3cd;
  border-left: 0.3rem solid #ffc107;
  color: #856404;
}

.alert-danger {
  background-color: #f8d7da;
  border-left: 0.3rem solid #dc3545;
  color: #721c24;
}

.alert-success {
  background-color: #d4edda;
  border-left: 0.3rem solid #28a745;
  color: #155724;
}

.alert-close {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
  padding: 0;
  line-height: 1;
  transition: opacity 0.2s;
}

.alert-close:hover {
  opacity: 1;
}

.alert-icon {
  margin-right: 0.8rem;
  font-size: 1.2rem;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mejoras de responsive */
@media (max-width: 768px) {
  .cart-item {
    grid-template-columns: 1fr;
    gap: 1rem;
    position: relative;
    padding-left: 90px;
    min-height: 100px;
  }
  
  .cart-item-img {
    position: absolute;
    left: 0;
    top: 1.5rem;
    width: 80px;
    height: 80px;
  }
  
  .cart-summary {
    text-align: center;
  }
  
  .header {
    flex-direction: row;
    padding: 0.8rem;
  }
  
  .nav-links {
    margin-top: 0;
    justify-content: flex-end;
  }
  
  .search-container {
    order: 1;
    width: 100%;
    max-width: 100%;
    margin-top: 0.5rem;
  }
}

@media (max-width: 576px) {
  .cart-item {
    padding-left: 0;
    grid-template-columns: 1fr;
  }
  
  .cart-item-img {
    position: static;
    width: 100%;
    height: auto;
    max-height: 200px;
    margin-bottom: 1rem;
  }
  
  .quantity-controls {
    justify-content: flex-start;
  }
  
  .remove-btn {
    width: 100%;
    text-align: center;
  }
  
  .nav-links {
    gap: 0.8rem;
    justify-content: center;
  }
  
  .header {
    flex-direction: column;
    text-align: center;
    gap: 0.8rem;
  }
  
  .nav-container {
    justify-content: center;
    width: 100%;
  }
  
  .icon-container {
    justify-content: center;
    width: 100%;
  }
}

/* Pequeñas mejoras de accesibilidad */
button:focus, input:focus, a:focus {
  outline: 2px solid #004aad;
  outline-offset: 2px;
}

/* Transiciones suaves para interacciones */
button, a, .quantity-btn, .remove-btn, .pay-btn {
  transition: all 0.2s ease;
}