/**
 * Promizhon Edizioni — Stili Carrello di Vendita & Drawer E-Commerce
 * File: css/promizhon_carrello.css (v1.0.0)
 * Conforme alle regole di design (transizioni 180-220ms, curve morbide, WCAG AA)
 */

:root {
  --cart-accent: #1A5C3D;
  --cart-gold: #B58934;
  --cart-gold-light: #FBF4E6;
  --cart-bg: #FFFFFF;
  --cart-paper: #FDFBF7;
  --cart-ink: #1C2421;
  --cart-muted: #5A6963;
  --cart-border: rgba(28, 36, 33, 0.12);
  --cart-shadow: 0 24px 54px -14px rgba(20, 28, 24, 0.32);
}

/* 1. PULSANTE FLUTTUANTE CARRELLO (FLOATING CART TRIGGER) */
.cart-floating-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 99;
  background: var(--cart-accent);
  color: #FFFFFF;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: 0 10px 28px -6px rgba(26, 92, 61, 0.45);
  cursor: pointer;
  transform: translateY(0);
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 200ms cubic-bezier(0.22, 1, 0.36, 1), background-color 180ms ease;
}

.cart-floating-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 16px 36px -8px rgba(26, 92, 61, 0.55);
  background: #144930;
}

.cart-badge-count {
  background: #D94E2E;
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 800;
  min-width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  border-radius: 999px;
  padding: 0 6px;
  display: inline-block;
  box-shadow: 0 2px 6px rgba(217, 78, 46, 0.4);
}

.cart-floating-btn.is-empty {
  display: none;
}

/* 2. OVERLAY & DRAWER LATERALE */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 24, 21, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 220ms cubic-bezier(0.22, 1, 0.36, 1), visibility 220ms ease;
}

.cart-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 460px;
  background: var(--cart-paper);
  box-shadow: var(--cart-shadow);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.cart-overlay.is-open .cart-drawer {
  transform: translateX(0);
}

/* Header Drawer */
.cart-header {
  padding: 0.95rem 1.35rem;
  border-bottom: 1px solid var(--cart-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
}

.cart-header-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--cart-ink);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cart-header-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--cart-accent);
  background: #E8F5EE;
  border: 1px solid rgba(26, 92, 61, 0.2);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  margin-left: 0.35rem;
}

.cart-close-btn {
  background: transparent;
  border: 1px solid var(--cart-border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--cart-muted);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.cart-close-btn:hover {
  background: #F0F4F2;
  color: var(--cart-ink);
}

/* Corpo Lista Articoli */
.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.cart-body::-webkit-scrollbar {
  width: 6px;
}
.cart-body::-webkit-scrollbar-track {
  background: transparent;
}
.cart-body::-webkit-scrollbar-thumb {
  background: rgba(28, 36, 33, 0.18);
  border-radius: 999px;
}
.cart-body::-webkit-scrollbar-thumb:hover {
  background: rgba(28, 36, 33, 0.32);
}

.cart-items-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 8px;
  padding: 0.45rem 0.8rem;
  font-size: 0.82rem;
  color: #166534;
  margin-bottom: 0.15rem;
}

.cart-banner-sub {
  font-size: 0.82rem;
  color: var(--cart-accent);
}

.cart-empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--cart-muted);
}

.cart-empty-icon {
  font-size: 3rem;
  margin-bottom: 0.8rem;
  display: block;
  opacity: 0.7;
}

.cart-item {
  display: flex;
  gap: 0.75rem;
  background: #FFFFFF;
  border: 1px solid var(--cart-border);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  box-shadow: 0 3px 10px -4px rgba(20, 28, 24, 0.06);
  position: relative;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 200ms ease;
}

.cart-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -4px rgba(20, 28, 24, 0.1);
}

.cart-item.is-highlighted {
  animation: cartItemPulse 1.2s ease;
}

@keyframes cartItemPulse {
  0%, 100% { border-color: var(--cart-border); box-shadow: 0 3px 10px -4px rgba(20, 28, 24, 0.06); }
  50% { border-color: var(--cart-accent); box-shadow: 0 0 0 3px rgba(26, 92, 61, 0.22); }
}

.cart-item-img {
  width: 48px;
  height: 64px;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: 5px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

.cart-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.cart-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
}

.cart-item-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--cart-accent);
  background: #E8F5EE;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  width: fit-content;
  white-space: nowrap;
}

.cart-item-remove-btn {
  background: transparent;
  border: none;
  color: var(--cart-muted);
  font-size: 0.85rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  transition: color 150ms ease, background 150ms ease;
}

.cart-item-remove-btn:hover {
  color: #D94E2E;
  background: #FEE2E2;
}

.cart-item-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--cart-ink);
  line-height: 1.25;
  margin-bottom: 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-item-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: auto;
}

.cart-qty-ctrl {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--cart-border);
  border-radius: 6px;
  background: #F8FAF9;
  overflow: hidden;
}

.cart-qty-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--cart-ink);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 150ms ease;
}

.cart-qty-btn:hover {
  background: #E5EBE8;
}

.cart-qty-val {
  min-width: 22px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--cart-ink);
}

.cart-item-pricing {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
}

.cart-item-unit {
  font-size: 0.7rem;
  color: var(--cart-muted);
}

.cart-item-price {
  font-weight: 800;
  font-size: 0.98rem;
  color: var(--cart-accent);
}

/* Footer & Riepilogo */
.cart-footer {
  padding: 0.9rem 1.25rem;
  background: #FFFFFF;
  border-top: 1px solid var(--cart-border);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.cart-row-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--cart-ink);
}

.cart-perks {
  background: var(--cart-gold-light);
  border: 1px solid rgba(181, 137, 52, 0.22);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font-size: 0.75rem;
  color: #6E531B;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
}

.cart-perks div {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.cart-checkout-btn {
  background: var(--cart-accent);
  color: #FFFFFF;
  border: none;
  border-radius: 8px;
  padding: 0.8rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 16px -4px rgba(26, 92, 61, 0.4);
  transition: background-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.cart-checkout-btn:hover {
  background: #144930;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -6px rgba(26, 92, 61, 0.5);
}
  color: #FFFFFF;
  border: none;
  border-radius: 10px;
  padding: 0.95rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 20px -4px rgba(26, 92, 61, 0.4);
  transition: background-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.cart-checkout-btn:hover {
  background: #144930;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -6px rgba(26, 92, 61, 0.5);
}

/* 3. PULSANTE DIRETTO NELLE SCHEDE LIBRO */
.btn-buy-digital {
  background: linear-gradient(135deg, #1A5C3D 0%, #257850 100%);
  color: #FFFFFF !important;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 0.85rem 1.15rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  cursor: pointer;
  box-shadow: 0 8px 22px -6px rgba(26, 92, 61, 0.38);
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 180ms cubic-bezier(0.22, 1, 0.36, 1), background 180ms ease;
  text-decoration: none;
  width: 100%;
}

.btn-buy-digital:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px -6px rgba(26, 92, 61, 0.48);
  background: linear-gradient(135deg, #144930 0%, #1c6140 100%);
}

.btn-buy-digital .btn-badge-save {
  background: #FFDF80;
  color: #4A3A00;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
}

/* 4. PULSANTE CARRELLO NAVBAR & QUICK BUY NELLE CARD */
.nav-cart-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #FFFFFF;
  color: var(--cart-ink);
  border: 1px solid var(--cart-border);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(20, 28, 24, 0.06);
  transition: all 180ms cubic-bezier(0.22, 1, 0.36, 1);
  text-decoration: none;
}

.nav-cart-btn:hover {
  background: #F4FAF6;
  border-color: var(--cart-accent);
  color: var(--cart-accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26, 92, 61, 0.15);
}

.nav-cart-btn .cart-badge-count {
  font-size: 0.7rem;
  min-width: 19px;
  height: 19px;
  line-height: 19px;
  padding: 0 5px;
}

.btn-digital-quick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: #EAF6EE;
  color: #1A5C3D;
  border: 1px solid rgba(26, 92, 61, 0.25);
  border-radius: 6px;
  padding: 0.42rem 0.75rem;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 160ms ease;
  text-decoration: none;
}

.btn-digital-quick:hover {
  background: #1A5C3D;
  color: #FFFFFF;
  border-color: #1A5C3D;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26, 92, 61, 0.22);
}

.badge-digital-pill {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(26, 92, 61, 0.92);
  color: #FFFFFF;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  z-index: 4;
}

