/* ==========================================================
   Carrito y pedido
   ========================================================== */

/* ---------- Botones en tarjetas ---------- */
.add-btn { display: inline-flex; align-items: center; gap: .35rem; min-height: 42px; padding: .45rem 1.05rem; border: 0; border-radius: var(--radius-pill); background: var(--pink-strong); color: #fff; font-weight: 700; font-size: var(--fs-sm); box-shadow: 0 6px 16px -8px rgba(214, 53, 113, .8); transition: transform var(--t) var(--ease), background var(--t-fast); }
.add-btn:hover { background: var(--pink-strong-dark); transform: translateY(-2px); }
.add-btn:active { transform: scale(.96); }

.qty { display: inline-flex; align-items: center; border-radius: var(--radius-pill); background: var(--pink-pastel); padding: 3px; }
.qty button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: #fff; font-size: 1.25rem; font-weight: 700; line-height: 1; color: var(--pink-strong-dark); box-shadow: var(--shadow-sm); transition: transform var(--t-fast); }
.qty button:hover { transform: scale(1.08); }
.qty button:disabled { opacity: .4; transform: none; }
.qty span { min-width: 2.2ch; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.qty--sm button { width: 32px; height: 32px; font-size: 1.1rem; }
.product__action { display: inline-flex; }

/* ---------- Botón flotante del carrito ---------- */
.cart-fab { position: fixed; z-index: 70; right: 1rem; bottom: 1rem; display: flex; align-items: center; gap: .8rem; min-height: 60px; padding: .55rem 1.3rem .55rem .6rem; border: 0; border-radius: var(--radius-pill); background: var(--coffee); color: var(--cream); font-weight: 700; box-shadow: 0 16px 34px -12px rgba(75, 46, 36, .7); transition: transform var(--t) var(--ease); }
.cart-fab[hidden] { display: none; }
.cart-fab:hover { transform: translateY(-3px); }
.cart-fab__ico { position: relative; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--pink-strong); }
.cart-fab__ico .ico { width: 22px; height: 22px; }
.cart-fab__ico b { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 99px; background: var(--cream); color: var(--coffee); font-size: .78rem; display: grid; place-items: center; }
.cart-fab__total { font-family: var(--font-display); font-size: 1.15rem; }
.cart-fab.is-bump { animation: bump .5s var(--ease); }
@keyframes bump { 30% { transform: scale(1.08); } 60% { transform: scale(.97); } }
@media (max-width: 640px) {
  .cart-fab { left: .75rem; right: .75rem; bottom: .75rem; justify-content: space-between; }
  .cart-fab__label { margin-right: auto; }
  .menu-body { padding-bottom: 6rem; }
}

/* ---------- Panel ---------- */
.cart { padding: 0; border: 0; margin: 0 0 0 auto; width: min(100%, 470px); max-width: none; height: 100dvh; max-height: none; background: transparent; color: var(--text); }
.cart::backdrop { background: rgba(75, 46, 36, .45); backdrop-filter: blur(3px); }
.cart__panel { height: 100%; display: flex; flex-direction: column; background: var(--cream); box-shadow: var(--shadow-lg); }
.cart[open] .cart__panel { animation: slide-in .38s var(--ease); }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }
@media (max-width: 600px) {
  .cart { width: 100%; height: 94dvh; margin: auto 0 0 0; }
  .cart__panel { border-radius: 26px 26px 0 0; }
  .cart[open] .cart__panel { animation-name: slide-up; }
  @keyframes slide-up { from { transform: translateY(60px); opacity: 0; } }
}

.cart__head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--line); }
.cart__head h2 { font-size: 1.6rem; }
.cart__close { display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--pink-pastel); }
.cart__body { flex: 1; overflow-y: auto; padding: 1rem 1.25rem 1.5rem; overscroll-behavior: contain; }
.cart__body[hidden] { display: none; }
.cart__table { display: flex; align-items: center; gap: .5rem; padding: .7rem 1rem; margin-bottom: 1rem; border-radius: var(--radius-sm); background: var(--beige); font-size: var(--fs-sm); }

.cart__lines { display: grid; gap: .75rem; }
.line { display: flex; gap: .85rem; padding: .75rem; border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-sm); }
.line__thumb { flex: none; width: 72px; height: 72px; border-radius: var(--radius-sm); overflow: hidden; background: var(--pink-pastel-soft); }
.line__thumb img { width: 100%; height: 100%; object-fit: cover; }
.line__thumb .product__art { display: grid; place-items: center; width: 100%; height: 100%; }
.line__thumb .art { width: 90%; height: 90%; }
.line__main { flex: 1; min-width: 0; display: grid; gap: .45rem; }
.line__top { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.line__top strong { font-family: var(--font-display); font-size: 1.05rem; line-height: 1.2; }
.line__remove { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); }
.line__remove:hover { background: var(--pink-pastel); color: var(--pink-strong-dark); }
.line__mid { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.line__price { font-family: var(--font-display); font-weight: 800; color: var(--pink-strong-dark); }
.line__price.is-pending { font-family: var(--font-body); font-size: var(--fs-xs); color: var(--text-muted); }
.line__note { width: 100%; padding: .45rem .7rem; border: 1px dashed var(--pink-dusty-soft); border-radius: 10px; background: var(--cream); font: inherit; font-size: var(--fs-xs); color: var(--text); }
.line__note:focus { outline: none; border-style: solid; border-color: var(--pink-strong); }

.cart__empty { text-align: center; padding: 2.5rem 1rem; display: grid; justify-items: center; gap: .8rem; color: var(--text-muted); }
.cart__empty[hidden] { display: none; }

/* Formulario */
.cart__form { margin-top: 1.5rem; display: grid; gap: 1rem; }
.cart__form[hidden] { display: none; }
.field { display: grid; gap: .35rem; border: 0; padding: 0; margin: 0; min-width: 0; }
.field label, .field legend { font-weight: 700; font-size: var(--fs-sm); padding: 0; margin-bottom: .1rem; }
.field small { font-weight: 400; color: var(--text-muted); }
.field input, .field textarea { width: 100%; min-height: 48px; padding: .7rem .9rem; border: 2px solid var(--beige); border-radius: var(--radius-sm); background: #fff; font: inherit; font-size: 1rem; color: var(--text); transition: border-color var(--t-fast); }
.field textarea { resize: vertical; min-height: 70px; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--pink-strong); }
.field input[aria-invalid="true"] { border-color: #c0183e; }
.field__err { min-height: 0; color: #b0123a; font-size: var(--fs-xs); font-weight: 700; }
.field__err:empty { display: none; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.mode { position: relative; }
.mode input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; }
.mode span { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; min-height: 84px; padding: .6rem; border: 2px solid var(--beige); border-radius: var(--radius-sm); background: #fff; text-align: center; font-weight: 700; font-size: var(--fs-sm); cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast); }
.mode span .ico { width: 24px; height: 24px; color: var(--pink-strong); }
.mode input:checked + span { border-color: var(--pink-strong); background: var(--pink-pastel-soft); box-shadow: 0 0 0 3px rgba(214, 53, 113, .15); }
.mode input:focus-visible + span { outline: 3px solid var(--pink-strong); outline-offset: 2px; }
.mode input:disabled + span { opacity: .45; cursor: not-allowed; }

/* Pie: totales y botones */
.cart__foot { padding: 1rem 1.25rem calc(1rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; display: grid; gap: .75rem; }
.cart__foot[hidden] { display: none; }
.totals { margin: 0; display: grid; gap: .2rem; }
.totals div { display: flex; justify-content: space-between; }
.totals dt { color: var(--text-muted); }
.totals dd { margin: 0; font-weight: 700; }
.totals__total dt { color: var(--text); font-weight: 700; font-size: 1.1rem; }
.totals__total dd { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; color: var(--pink-strong-dark); }
.cart__pending { font-size: var(--fs-xs); color: var(--text-muted); background: var(--beige-soft); padding: .5rem .75rem; border-radius: 10px; }
.cart__pending[hidden] { display: none; }
.cart__actions { display: grid; gap: .6rem; }
.cart__actions .btn { width: 100%; }
.btn--wa { --btn-bg: #1f9d55; }
.btn--wa:hover { --btn-bg: #17834a; }
.btn--mp { --btn-bg: #009ee3; }
.btn--mp:hover { --btn-bg: #0086c3; }
.btn[aria-busy="true"] { opacity: .7; cursor: progress; }
.cart__hint { font-size: var(--fs-xs); color: var(--text-muted); text-align: center; }

/* Confirmación */
.cart__done { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 2rem 1.5rem; text-align: center; }
.cart__done[hidden] { display: none; }
.cart__done h3 { font-size: 1.7rem; }
.cart__done p { color: var(--text-muted); max-width: 32ch; }
.cart__done img { animation: bob 5s ease-in-out infinite; }

/* Toast */
.toast { position: fixed; z-index: 200; left: 50%; bottom: 6rem; transform: translate(-50%, 20px); max-width: min(92vw, 420px); padding: .75rem 1.2rem; border-radius: var(--radius-pill); background: var(--coffee); color: var(--cream); font-size: var(--fs-sm); font-weight: 700; text-align: center; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity var(--t), transform var(--t) var(--ease); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: #9e1238; }
