/* ==========================
   OVERLAY OSCURO
========================== */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 999;
}

.cart-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* ==========================
   PANEL DEL CARRITO
========================== */
.cart-panel {
  width: 360px;
  height: 100dvh;
  position: fixed;
  right: -400px;
  top: 0;
  background: #fcfaf6;
  box-shadow: -3px 0 12px rgba(0, 0, 0, 0.18);
  transition: right 0.35s ease;
  z-index: 1000;
  padding: 22px;
  display: flex;
  flex-direction: column;
}

.cart-panel.open {
  right: 0;
}

/* ==========================
   HEADER DEL CARRITO
========================== */
.cart-header {
  position: relative;
  margin-bottom: 22px;
}

.cart-header h2 {
  font-family: Hatton, Arial, sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 0;
}

/* Botón de cerrar */
.cart-close-btn {
  position: absolute;
  right: 0;
  top: -4px;
  background: none;
  border: none;
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  padding: 4px;
  cursor: pointer;
}

/* ==========================
   LISTA DE PRODUCTOS
========================== */
.cart-items {
  flex: 1;
  overflow-y: auto;
  padding-right: 6px;
}

.cart-items::-webkit-scrollbar {
  width: 6px;
}

.cart-items::-webkit-scrollbar-thumb {
  background: #cccccc;
  border-radius: 10px;
}

.cart-item {
  position: relative;
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 12px;
  padding: 5px 0 15px;
  margin-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.cart-item img {
  width: 80px;
  height: 80px;
  border-radius: 6px;
  object-fit: cover;
}

.cart-info-div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-family: Lato, sans-serif;
  gap: 4px;
}

.cart-heading {
  font-family: Hatton, Arial, sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.cart-info-div p {
  margin: 0;
  font-size: 15px;
  color: #444;
}

/* ==========================
   TOTAL Y FOOTER
========================== */
.cart-footer {
  border-top: 1px solid #eee;
  padding-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.totals {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  color: #161616;
  font-family: Lato, sans-serif;
}

.total-row {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-family: Hatton, Arial, sans-serif;
}

.red-discount {
  color: #d11a2a;
}

.cart-checkout-btn {
  width: 100%;
  padding: 15px 12px 10px 12px;
  font-size: 1rem;
  border: none;
  font-family: Hatton, Arial, sans-serif;
  text-transform: uppercase;
  background: #161616;
  color: #fff;
  letter-spacing: 1px;
  border-radius: 6px;
  text-align: center;
  cursor: pointer;
  transition: 0.2s ease;
}

.cart-checkout-btn:hover {
  opacity: 0.85;
}

.cart-checkout-btn.disabled {
  pointer-events: none;
  opacity: 0.8;
  cursor: not-allowed;
  color: #fff;
}

.disable-text {
  pointer-events: none;
  opacity: 0.95;
  cursor: not-allowed;
  color: #5e5e5e;
}

/* ==========================
   CANTIDAD Y BOTÓN ELIMINAR
========================== */
.cart-item.fade-out {
  opacity: 0;
  transform: scale(0.95);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

.delete-btn {
  position: absolute;
  right: 0;
  bottom: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.delete-btn svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}

.delete-btn:hover svg {
  fill: #d63341;
}

.delete-btn:focus {
  outline: none;
}

.quantity-controls {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.quantity-btn {
  width: 27px;
  height: 27px;
  background-color: #161616;
  color: #fff;
  border: none;
  cursor: pointer;
  border-radius: 5px;
  font-weight: 600;
  transition:
    opacity 0.25s ease,
    transform 0.15s ease;
}

.quantity-btn:focus {
  outline: none;
}

.quantity-btn.disabled {
  opacity: 0.8;
  pointer-events: none;
}

.quantity-input {
  width: 50px;
  text-align: center;
  font-size: 16px;
  padding: 5px;
  border: 1px solid #ccc;
  border-radius: 5px;
}

.fade-out {
  animation: fadeOut 0.3s forwards;
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.emptyCartMessage {
  display: none;
  color: #666;
  text-align: center;
  font-size: 1.1rem;
  line-height: 1.3rem;
  padding: 0 10px;
  font-family: Lato, sans-serif;
  margin: 3rem 0;
}

.cart-img {
  width: 150px;
  display: block;
  margin: 5rem auto 0;
}

@media (max-width: 480px) {
  .cart-panel {
    width: 100%;
    right: -100%;
  }
}
