/* ==============================================
   HIDER · cart.css
   Ubicación: frontend/css/cart.css
   Cart drawer · cart page · checkout
   ============================================== */

/* ── Cart scrim ──────────────────────────────── */
.cart-scrim {
  position: fixed;
  inset: 0;
  background: rgba(30, 18, 8, 0.45);
  backdrop-filter: blur(4px);
  z-index: 149;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

.cart-scrim.open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Cart drawer ─────────────────────────────── */
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 94vw);
  background: var(--white);
  z-index: 150;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.38s var(--ease-out);
  box-shadow: var(--shadow-lg);
}

.cart-drawer.open {
  transform: translateX(0);
}

.cart-drawer__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
}

.cart-drawer__head h3 {
  font-size: 22px;
}

.cart-count {
  font-size: 14px;
  color: var(--muted);
  font-family: var(--font-body);
  font-weight: 400;
}

.cart-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 24px;
}

.cart-drawer__foot {
  border-top: 1px solid var(--line-soft);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

/* ── Cart empty ──────────────────────────────── */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 24px;
  text-align: center;
}

.cart-empty h3 {
  font-size: 26px;
}

.cart-empty p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

/* ── Cart item ───────────────────────────────── */
.cart-item {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line-soft);
  align-items: start;
}

.cart-item:last-child { border-bottom: 0; }

.cart-item__img {
  display: block;
  width: 88px;
  height: 110px;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--cream);
  flex-shrink: 0;
}

.cart-item__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}

.cart-item__img:hover img {
  transform: scale(1.04);
}

.cart-item__placeholder {
  width: 100%;
  height: 100%;
  background: var(--cream-dark);
}

.cart-item__body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.cart-item__name {
  font-weight: 500;
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--duration);
}

.cart-item__name:hover { color: var(--brown); }

.cart-item__meta {
  font-size: 12px;
  color: var(--muted);
}

.cart-item__controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  flex-wrap: wrap;
}

/* ── Qty control ─────────────────────────────── */
.qty-control {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.qty-control button {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  transition: background var(--duration);
  flex-shrink: 0;
}

.qty-control button:hover {
  background: var(--cream);
  color: var(--brown);
}

.qty-control span {
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
  min-width: 28px;
  text-align: center;
}

.cart-item__remove {
  font-size: 11px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--duration);
}

.cart-item__remove:hover { color: var(--sale); }

.cart-item__price {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.cart-item__price span:first-child {
  font-weight: 500;
  font-size: 14px;
}

.cart-item__was {
  font-size: 12px;
  color: var(--muted);
  text-decoration: line-through;
}

/* ── Cart footer ─────────────────────────────── */
.cart-savings {
  font-size: 13px;
  color: var(--sale);
  text-align: center;
  padding: 8px;
  background: rgba(192, 67, 42, 0.06);
  border-radius: var(--r-sm);
}

.cart-shipping-msg {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.cart-shipping-msg strong { color: var(--ink); }

.cart-progress {
  height: 4px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.cart-progress__bar {
  height: 100%;
  background: linear-gradient(
    90deg, var(--brown), var(--gold)
  );
  border-radius: 999px;
  transition: width 0.5s var(--ease-out);
}

.cart-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 15px;
}

.cart-subtotal span:last-child {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
}

.cart-progress__check {
  display: none !important;
}
/* ══ DARK MODE — cart ══ */
[data-theme="dark"] .cart-drawer              { background: var(--surface); }
[data-theme="dark"] .cart-drawer__head        { border-bottom-color: var(--line); }
[data-theme="dark"] .cart-drawer__title       { color: var(--text); }
[data-theme="dark"] .cart-item                { border-bottom-color: var(--line); }
[data-theme="dark"] .cart-item__img           { background: var(--surface-2); }
[data-theme="dark"] .cart-item__name          { color: var(--text); }
[data-theme="dark"] .cart-item__meta          { color: var(--muted); }
[data-theme="dark"] .cart-item__price         { color: var(--text); }
[data-theme="dark"] .cart-item__remove        { color: var(--muted); }
[data-theme="dark"] .cart-item__remove:hover  { color: var(--sale); }
[data-theme="dark"] .cart-item__placeholder   { background: var(--surface-2); }
[data-theme="dark"] .qty-control              { background: var(--surface-2); border-color: var(--line); }
[data-theme="dark"] .cart-empty               { color: var(--muted); }
[data-theme="dark"] .cart-count               { color: var(--muted); }
[data-theme="dark"] .cart-drawer__foot        { background: var(--surface); border-top-color: var(--line); }
[data-theme="dark"] .cart-subtotal            { border-top-color: var(--line); color: var(--text); }
[data-theme="dark"] .cart-subtotal-label      { color: var(--muted); }
[data-theme="dark"] .cart-progress            { background: var(--surface-2); }
[data-theme="dark"] .cart-shipping-msg        { color: var(--muted); }
[data-theme="dark"] .cart-savings             { color: var(--success); }