/* =============================================
   Cart flotante — Estilo libreta / papel rayado
   Fondo amarillo con líneas horizontales
   ============================================= */

.cart-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: #766d42;
  border: none;
  color: #000000;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(118, 109, 66, 0.3);
  transition: all 0.3s ease;
}

.cart-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 30px rgba(118, 109, 66, 0.4);
}

.cart-toggle .cart-count {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: #724154;
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #000000;
}

/* === Panel del carrito — fondo libreta === */
.cart-panel {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  z-index: 299;
  width: min(380px, calc(100vw - 2rem));
  max-height: 60vh;
  background-color: #f5e6b8;
  background-image: repeating-linear-gradient(
    transparent,
    transparent 27px,
    #d4c4a0 27px,
    #d4c4a0 28px
  );
  border: 1px solid #c4b48a;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.cart-panel.active {
  display: flex;
}

.cart-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 28px;
  background-color: #f5e6b8;
  border-bottom: 1px solid #d4c4a0;
}

/* Línea roja del margen izquierdo (como libreta) */
.cart-panel::after {
  content: '';
  position: absolute;
  top: 0;
  left: 32px;
  bottom: 0;
  width: 1px;
  background-color: #e8c8c8;
}

.cart-header {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  background-color: rgba(245, 230, 184, 0.95);
  border-bottom: 1px solid #d4c4a0;
}

.cart-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: #2a2a2a;
}

.cart-clear {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8a5050;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.3s ease;
}

.cart-clear:hover {
  color: #c0392b;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0;
  position: relative;
  z-index: 1;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 1rem 0.35rem 2.5rem;
  border-bottom: 1px solid rgba(196, 180, 138, 0.3);
  min-height: 28px;
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item-info {
  flex: 1;
}

.cart-item-name {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 500;
  color: #2a2a2a;
}

.cart-item-price {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 400;
  color: #5a5a5a;
}

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1rem;
}

.cart-qty-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid #b8a880;
  background-color: transparent;
  color: #5a4a2a;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.cart-qty-btn:hover {
  background-color: #766d42;
  color: #ffffff;
  border-color: #766d42;
}

.cart-item-qty-value {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  color: #2a2a2a;
  min-width: 1.2rem;
  text-align: center;
}

.cart-item-remove {
  background: none;
  border: none;
  color: #b8a880;
  font-size: 1rem;
  cursor: pointer;
  padding: 0 0.25rem;
  transition: color 0.2s ease;
}

.cart-item-remove:hover {
  color: #8a5050;
}

.cart-footer {
  position: relative;
  z-index: 1;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  background-color: rgba(245, 230, 184, 0.95);
  border-top: 1px solid #d4c4a0;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.cart-total-label {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  color: #2a2a2a;
}

.cart-total-value {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  color: #2a2a2a;
}

.cart-actions {
  display: flex;
  gap: 0.5rem;
}

.cart-ask-btn {
  flex: 1;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #000000;
  background-color: #766d42;
  border: none;
  padding: 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.cart-ask-btn:hover {
  background-color: #8a7d4e;
}

.cart-empty {
  text-align: center;
  padding: 2rem 1rem 2rem 2.5rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: #8a7a5a;
  font-style: italic;
  position: relative;
  z-index: 1;
}

/* === Responsive carrito === */
@media (max-width: 480px) {
  .cart-toggle {
    bottom: 1rem;
    right: 1rem;
    width: 48px;
    height: 48px;
    font-size: 1.1rem;
  }

  .cart-panel {
    right: 0.75rem;
    bottom: 4.5rem;
    width: calc(100vw - 1.5rem);
    max-height: 55vh;
  }
}
