/* ============================================================
   CARRITO DE COMPRAS — PASTELITOS
   ============================================================ */

/* Overlay */
.cart-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9000;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.cart-overlay.open {
  display: block;
  opacity: 1;
}

/* Sidebar */
.cart-sidebar {
  position: fixed;
  top: 0;
  right: -400px;
  width: 380px;
  max-width: 100vw;
  height: 100%;
  background: #fff;
  z-index: 9100;
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.4,0,0.2,1);
  box-shadow: -4px 0 30px rgba(0,0,0,0.15);
}
.cart-sidebar.open {
  right: 0;
}

/* Header */
.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #f0ece5;
  background: #1a1a1a;
  color: #fff;
}
.cart-header h3 {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 0;
  color: #fff;
}
.cart-close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.cart-close-btn:hover { opacity: 1; }

/* Body / Items */
.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.cart-empty {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  letter-spacing: 1px;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid #f5f0e8;
}
.cart-item:last-child { border-bottom: none; }

.cart-item-img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: #f5f0e8;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}
.cart-item-name {
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #1a1a1a;
  display: block;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cart-item-price {
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  color: #c8a96e;
  font-weight: 700;
}

/* Qty Controls */
.cart-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.qty-btn {
  width: 26px;
  height: 26px;
  border: 1px solid #e0dbd0;
  background: #fff;
  color: #1a1a1a;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qty-btn:hover { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.qty-num {
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
  color: #1a1a1a;
}

.cart-item-remove {
  background: none;
  border: none;
  color: #ccc;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
  flex-shrink: 0;
  line-height: 1;
}
.cart-item-remove:hover { color: #cc3333; }

/* Footer */
.cart-footer {
  padding: 20px 24px;
  border-top: 1px solid #f0ece5;
  background: #faf8f4;
}
.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.cart-total-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #888;
}
.cart-total-price {
  font-family: 'Montserrat', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
}

.btn-checkout {
  width: 100%;
  padding: 14px;
  background: #1a1a1a;
  color: #fff;
  border: none;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s;
  border-radius: 2px;
  margin-bottom: 10px;
}
.btn-checkout:hover { background: #c8a96e; }

.btn-whatsapp-order {
  width: 100%;
  padding: 12px;
  background: #25d366;
  color: #fff;
  border: none;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s;
  border-radius: 2px;
}
.btn-whatsapp-order:hover { background: #1ebe5a; }

/* Badge en el ícono del carrito */
.cart-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #c8a96e;
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Montserrat', sans-serif;
  line-height: 1;
}
.user-basket > a {
  position: relative !important;
}

/* Modal Checkout */
.cart-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9500;
  align-items: center;
  justify-content: center;
}
.cart-modal-overlay.open {
  display: flex;
}
.cart-modal {
  background: #fff;
  width: 460px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 4px;
  padding: 32px;
  position: relative;
}
.cart-modal h3 {
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #1a1a1a;
  margin-bottom: 20px;
}
.cart-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
  line-height: 1;
}
.cart-modal-close:hover { color: #1a1a1a; }

.cart-order-summary {
  background: #faf8f4;
  padding: 16px;
  margin-bottom: 20px;
  border-radius: 2px;
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  color: #555;
  line-height: 1.8;
}
.cart-order-summary .order-item-line {
  display: flex;
  justify-content: space-between;
}
.cart-order-summary .order-total-line {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  color: #1a1a1a;
  border-top: 1px solid #e8e2d8;
  margin-top: 8px;
  padding-top: 8px;
  font-size: 13px;
}

.cart-form-field {
  margin-bottom: 14px;
}
.cart-form-field input,
.cart-form-field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #e0dbd0;
  border-radius: 2px;
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  color: #1a1a1a;
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
}
.cart-form-field input:focus,
.cart-form-field textarea:focus { border-color: #c8a96e; }
.cart-form-field textarea { height: 80px; resize: none; }

.cart-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.cart-modal-actions button {
  flex: 1;
  padding: 13px;
  border: none;
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.2s;
}
.btn-send-order {
  background: #1a1a1a;
  color: #fff;
}
.btn-send-order:hover { background: #c8a96e; }
.btn-send-whatsapp {
  background: #25d366;
  color: #fff;
}
.btn-send-whatsapp:hover { background: #1ebe5a; }

.cart-success-msg {
  text-align: center;
  padding: 30px 20px;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  color: #1a1a1a;
  display: none;
}
.cart-success-msg strong { display: block; font-size: 15px; margin-bottom: 8px; }

/* Imagen de producto — ancho completo */
#products-grid .img-1 {
  width: 100%;
  display: block;
}

@media (max-width: 480px) {
  .cart-sidebar { width: 100vw; }
  .cart-modal-actions { flex-direction: column; }
}

/* El dropdown del ícono de cesta se oculta siempre:
   el carrito real es el sidebar manejado por cart.js */
.user-basket .dropdown-menu {
  display: none !important;
}
.user-basket .dropdown-toggle {
  pointer-events: auto;
}
