/* =========================================================================
   client.css — Estilos específicos da área do cliente
   Depende de variables.css, base.css, utilities.css
   ========================================================================= */

/* ---------- App scaffold ------------------------------------------------ */

#app {
  padding-top: var(--safe-top);
  padding-bottom: calc(var(--bottom-cart-height) + var(--safe-bottom) + var(--space-4));
  min-height: 100svh;
}

body.no-scroll {
  overflow: hidden;
}

/* =========================================================================
   HOME / CATÁLOGO
   ========================================================================= */

.home__header {
  padding: var(--space-4) 0 var(--space-2);
}

.home__search {
  margin-bottom: var(--space-3);
}

.home__grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.home__empty {
  padding: var(--space-8) var(--space-4);
}

/* =========================================================================
   CATEGORY CHIPS
   ========================================================================= */

.chips {
  margin: 0 calc(var(--space-4) * -1);
  padding: var(--space-2) var(--space-4);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chips__track {
  display: flex;
  gap: var(--space-2);
  width: max-content;
}

.chips__chip {
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}

.chips__chip--active {
  background: var(--color-text);
  color: var(--color-text-inverse);
}

/* =========================================================================
   PRODUCT CARD (catálogo)
   ========================================================================= */

.pc {
  display: flex;
  gap: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}

.pc:active {
  transform: scale(0.99);
}

.pc--flash {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.pc__thumb {
  position: relative;
  flex-shrink: 0;
  width: 88px;
  height: 88px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface-alt);
}

.pc__thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pc__thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  color: var(--color-text-subtle);
}

.pc__badges {
  position: absolute;
  top: 4px;
  left: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pc__badge {
  font-size: 10px;
  font-weight: var(--fw-semi);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--color-text);
  color: var(--color-text-inverse);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pc__badge--promo { background: var(--color-primary); }
.pc__badge--low   { background: var(--color-warning); }

.pc__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-2);
}

.pc__name {
  font-size: var(--fs-md);
  font-weight: var(--fw-semi);
  line-height: var(--lh-tight);
}

.pc__desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pc__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.pc__price {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.pc__price-old {
  font-size: var(--fs-xs);
}

.pc__price-current {
  font-size: var(--fs-lg);
}

.pc__action {
  min-height: 36px;
  padding: 0 var(--space-4);
  font-size: var(--fs-sm);
  border-radius: var(--radius-md);
}

/* =========================================================================
   PRODUCT DETAIL (tela de detalhe)
   ========================================================================= */

.pd {
  padding-bottom: 120px; /* espaço pro footer fixo */
}

.pd__header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: var(--header-height);
  margin: 0 calc(var(--space-4) * -1);
  padding: 0 var(--space-4);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: var(--z-header);
}

.pd__back {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xl);
  border-radius: var(--radius-pill);
  transition: background var(--dur-fast) var(--ease-out);
}
.pd__back:hover { background: var(--color-surface-alt); }

.pd__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semi);
  flex: 1;
}

.pd__thumb {
  aspect-ratio: 4 / 3;
  margin: var(--space-4) calc(var(--space-4) * -1) 0;
  background: var(--color-surface-alt);
  overflow: hidden;
}
.pd__thumb img { width: 100%; height: 100%; object-fit: cover; }

.pd__thumb-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; font-weight: var(--fw-bold);
  color: var(--color-text-subtle);
}

.pd__body {
  padding-top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pd__name {
  margin: 0;
}

.pd__prices {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}
.pd__price {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
}
.pd__price-old {
  font-size: var(--fs-md);
}

.pd__notes-group, .pd__qty-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.pd__footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: var(--space-3) var(--space-4) calc(var(--space-3) + var(--safe-bottom));
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: var(--shadow-up);
  z-index: var(--z-bottom);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.pd__footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pd__footer-total {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
}

/* =========================================================================
   VARIATION SELECTOR
   ========================================================================= */

.var-sel {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.var-sel__title {
  margin-bottom: 0;
  padding: 0;
}

.var-sel__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.var-sel__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  min-height: 52px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}

.var-sel__input:checked + .var-sel__option {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}

/* =========================================================================
   EXTRAS SELECTOR
   ========================================================================= */

.extras-sel__title {
  margin-bottom: var(--space-2);
}

.extras-sel__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.extras-sel__option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  min-height: 52px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out);
}

.extras-sel__check {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  position: relative;
  transition: all var(--dur-fast) var(--ease-out);
}

.extras-sel__input:checked + .extras-sel__option {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}
.extras-sel__input:checked + .extras-sel__option .extras-sel__check {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.extras-sel__input:checked + .extras-sel__option .extras-sel__check::after {
  content: '';
  position: absolute;
  inset: 3px 5px;
  border: 2px solid #fff;
  border-top: 0;
  border-left: 0;
  transform: rotate(45deg) translateY(-2px);
  width: 6px; height: 10px;
}

/* =========================================================================
   QUANTITY STEPPER
   ========================================================================= */

.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  overflow: hidden;
}

.qty-stepper__btn {
  width: 44px; height: 40px;
  font-size: var(--fs-xl);
  font-weight: var(--fw-semi);
  color: var(--color-text);
  transition: background var(--dur-fast) var(--ease-out);
}
.qty-stepper__btn:not(:disabled):hover { background: var(--color-surface-alt); }
.qty-stepper__btn:disabled { color: var(--color-text-subtle); cursor: not-allowed; }

.qty-stepper__value {
  min-width: 32px;
  text-align: center;
  font-weight: var(--fw-semi);
}

/* =========================================================================
   BOTTOM CART BAR
   ========================================================================= */

.bc {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 0 var(--space-4) calc(var(--space-4) + var(--safe-bottom));
  z-index: var(--z-bottom);
  transition: transform var(--dur-base) var(--ease-out),
              opacity var(--dur-base) var(--ease-out);
  pointer-events: none;
}

.bc[data-visible="false"] {
  transform: translateY(120%);
  opacity: 0;
}
.bc[data-visible="true"] {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.bc__btn {
  width: 100%;
  max-width: var(--max-w-mobile);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--color-text);
  color: var(--color-text-inverse);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-md);
  font-weight: var(--fw-semi);
  min-height: 56px;
}

.bc__left, .bc__right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.bc__icon {
  font-size: var(--fs-lg);
}

.bc__chevron {
  font-size: var(--fs-xl);
  opacity: 0.7;
}

/* =========================================================================
   CART BOTTOM SHEET
   ========================================================================= */

.cart-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: var(--z-drawer);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
}
.cart-backdrop--show { opacity: 1; }

.cart-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: calc(var(--z-drawer) + 1);
  max-height: 90svh;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform var(--dur-slow) var(--ease-out);
  /* centralizado em telas maiores */
  max-width: var(--max-w-mobile);
  margin: 0 auto;
}
.cart-sheet--show { transform: translateY(0); }

.cart-sheet__grip {
  width: 36px; height: 4px;
  background: var(--color-border-strong);
  border-radius: var(--radius-pill);
  margin: var(--space-2) auto var(--space-1);
}

.cart-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.cart-sheet__close {
  width: 36px; height: 36px;
  font-size: var(--fs-2xl);
  border-radius: var(--radius-pill);
  color: var(--color-text-muted);
}

.cart-sheet__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2) var(--space-4) var(--space-4);
}

.cart-sheet__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.cart-sheet__footer {
  padding: var(--space-4);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-muted);
  padding-bottom: calc(var(--space-4) + var(--safe-bottom));
}

.cart-sheet__subtotal {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
}

/* ---------- Linha de item do carrinho ---------- */

.ci {
  padding: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.ci__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.ci__name {
  font-size: var(--fs-md);
  font-weight: var(--fw-semi);
  line-height: var(--lh-tight);
  margin-bottom: var(--space-1);
}

.ci__details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ci__detail--note {
  color: var(--color-text-subtle);
  font-style: italic;
}

.ci__price {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  white-space: nowrap;
}

.ci__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.ci__remove {
  color: var(--color-danger);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  padding: var(--space-2);
}

/* =========================================================================
   TOAST
   ========================================================================= */

.toast {
  position: fixed;
  bottom: calc(var(--bottom-cart-height) + var(--space-4) + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: var(--space-3) var(--space-5);
  background: var(--color-text);
  color: var(--color-text-inverse);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  z-index: var(--z-toast);
  transition: opacity var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-out);
  max-width: calc(100% - var(--space-8));
  text-align: center;
}

.toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =========================================================================
   CHECKOUT (co = checkout)
   ========================================================================= */

.co__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding-bottom: 120px;
}

.co__block {
  padding: var(--space-4);
}

.co__block-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semi);
  margin-bottom: var(--space-3);
}

.co__block-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.co__field {
  display: flex;
  flex-direction: column;
}

.co__address {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.co__address-row {
  display: flex;
  gap: var(--space-2);
}

.co__pickup {
  padding: var(--space-3);
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.co__geo-status {
  padding: var(--space-3);
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  margin-top: var(--space-2);
}

.co__cash-container {
  margin-top: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.co__summary {
  padding: var(--space-4);
}
.co__summary strong {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
}

.co__footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: var(--space-3) var(--space-4) calc(var(--space-3) + var(--safe-bottom));
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: var(--shadow-up);
  z-index: var(--z-bottom);
  max-width: var(--max-w-mobile);
  margin: 0 auto;
}

/* =========================================================================
   RADIO GROUP (rg)
   ========================================================================= */

.rg {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.rg__option {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  min-height: 52px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: var(--fw-medium);
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}

.rg__option::before {
  content: '';
  width: 20px; height: 20px;
  flex-shrink: 0;
  margin-right: var(--space-3);
  border: 2px solid var(--color-border-strong);
  border-radius: 50%;
  transition: all var(--dur-fast) var(--ease-out);
}

.rg__input:checked + .rg__option {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}

.rg__input:checked + .rg__option::before {
  border-color: var(--color-primary);
  border-width: 6px;
}

/* =========================================================================
   PIX
   ========================================================================= */

.pix {
  padding-bottom: var(--space-8);
}

.pix__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding-top: var(--space-4);
}

.pix__amount {
  text-align: center;
  padding: var(--space-4);
  background: var(--color-primary-soft);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.pix__amount-value {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
  color: var(--color-primary);
}

.pix__qr {
  display: flex;
  justify-content: center;
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.pix__qr-loading {
  width: 220px;
  height: 220px;
}

.pix__qr-svg {
  max-width: 260px;
  width: 100%;
}
.pix__qr-svg svg {
  width: 100%;
  height: auto;
  display: block;
}

.pix__qr-fallback {
  padding: var(--space-6) var(--space-4);
}

.pix__code-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.pix__code {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  padding: var(--space-3);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  word-break: break-all;
  line-height: 1.4;
  user-select: all;
}

.pix__steps {
  padding-left: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
}
.pix__steps li {
  list-style: decimal;
  padding-left: var(--space-1);
}

.pix__status-chip {
  display: inline-block;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  text-align: center;
}

.pix__status-chip--warning {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}
.pix__status-chip--info {
  background: var(--color-info-soft);
  color: var(--color-info);
}
.pix__status-chip--success {
  background: var(--color-success-soft);
  color: var(--color-success);
}
.pix__status-chip--danger {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.pix__status {
  text-align: center;
}

.pix__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

/* =========================================================================
   ORDER TRACKING (ot)
   ========================================================================= */

.ot__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-4);
  padding-bottom: var(--space-8);
}

.ot__current {
  text-align: center;
  padding: var(--space-5);
}

.ot__status {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  margin: var(--space-2) 0;
}

/* Cores de status derivadas do token status-* (variables.css) */
.ot__status--aguardando-pagamento { color: var(--status-aguardando-pagamento-fg); }
.ot__status--pagamento-em-analise { color: var(--status-pagamento-em-analise-fg); }
.ot__status--pagamento-confirmado { color: var(--status-pagamento-confirmado-fg); }
.ot__status--pedido-aceito        { color: var(--status-pedido-aceito-fg); }
.ot__status--em-preparo           { color: var(--status-em-preparo-fg); }
.ot__status--pronto-para-retirada { color: var(--status-pronto-retirada-fg); }
.ot__status--saiu-para-entrega    { color: var(--status-saiu-entrega-fg); }
.ot__status--entregue             { color: var(--status-entregue-fg); }
.ot__status--concluido            { color: var(--status-concluido-fg); }
.ot__status--cancelado            { color: var(--status-cancelado-fg); }
.ot__status--recusado             { color: var(--status-recusado-fg); }

.ot__timeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  position: relative;
}

.ot__event {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  position: relative;
}

.ot__event-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--color-border-strong);
  flex-shrink: 0;
  margin-top: 6px;
}

.ot__event--current .ot__event-dot {
  background: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.ot__event-body {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.ot__event-label {
  font-weight: var(--fw-medium);
  font-size: var(--fs-sm);
}

.ot__event--current .ot__event-label {
  font-weight: var(--fw-semi);
  color: var(--color-text);
}

.ot__items {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.ot__item {
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}
.ot__item:last-child { border-bottom: 0; padding-bottom: 0; }

.ot__fulfillment {
  padding: var(--space-4);
}

