/* Componentes reutilizados no cardápio e no painel. */

/* ---------- botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.12s ease, opacity 0.12s ease;
}
.btn:active:not(:disabled) {
  transform: scale(0.98);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn--primary {
  background: var(--c-primary);
  color: var(--c-primary-ink);
}
.btn--accent {
  background: var(--c-accent);
  color: var(--c-accent-ink);
}
.btn--soft {
  background: var(--c-primary-soft);
  color: var(--c-primary);
}
.btn--ghost {
  background: transparent;
  color: var(--c-ink);
  box-shadow: inset 0 0 0 1.5px var(--c-line);
}
.btn--danger {
  background: var(--c-danger);
  color: #fff;
}
.btn--small {
  min-height: 38px;
  padding: 0 14px;
  font-size: 14px;
}
.btn--block {
  display: flex;
  width: 100%;
}
.btn--grow {
  flex: 1;
  justify-content: space-between;
}
.btn--primary.btn--block,
.btn--primary:only-child.btn--grow {
  justify-content: center;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  flex: none;
}
.icon-btn:hover {
  background: var(--c-primary-soft);
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--c-primary);
  font-weight: 600;
  font-size: 14px;
}
.link-btn--danger {
  color: var(--c-danger);
}

/* ---------- formulários ---------- */
.field {
  display: block;
  margin-bottom: 12px;
}
.field__label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}
.field__hint {
  display: block;
  margin-top: 4px;
  color: var(--c-muted);
  font-size: 13px;
}
.field__error {
  display: block;
  margin-top: 4px;
  color: var(--c-danger);
  font-size: 13px;
  font-weight: 600;
}
.field__error:empty {
  display: none;
}

.input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1.5px solid var(--c-line);
  border-radius: var(--r-m);
  background: #fff;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-mid);
}
.input--area {
  min-height: 0;
  resize: vertical;
}
.has-error .input {
  border-color: var(--c-danger);
}
select.input {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6178' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 12px;
}

.form-block {
  margin-bottom: 24px;
}
.form-block__title {
  margin-bottom: 12px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ---------- opções (checkbox e radio) ---------- */
.choice {
  position: relative; /* o input escondido fica preso à linha e não rola o painel */
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--c-line);
  cursor: pointer;
}
.choice:first-child {
  border-top: 0;
}
.choice__input {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.choice__mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border: 2px solid #b9aec7;
  border-radius: 7px;
  color: transparent;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.choice__mark--round {
  border-radius: 50%;
}
.choice__mark--round svg {
  display: none;
}
.choice__mark--round::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c-primary-ink);
  transform: scale(0);
  transition: transform 0.12s ease;
}
.choice__input:checked + .choice__mark {
  border-color: var(--c-primary);
  background: var(--c-primary);
  color: var(--c-primary-ink);
}
.choice__input:checked + .choice__mark--round::after {
  transform: scale(1);
}
.choice__input:focus-visible + .choice__mark {
  outline: 3px solid var(--c-primary);
  outline-offset: 2px;
}
.choice__input:disabled ~ * {
  opacity: 0.4;
}
.choice__name {
  flex: 1;
  min-width: 0;
}
.choice__name small {
  display: block;
  color: var(--c-muted);
  font-size: 13px;
}
.choice__price {
  color: var(--c-muted);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- controle de quantidade ---------- */
.stepper {
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-pill);
  box-shadow: inset 0 0 0 1.5px var(--c-line);
  background: #fff;
}
.stepper__btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--c-primary);
  border-radius: var(--r-pill);
}
.stepper__btn:disabled {
  color: #b9aec7;
  cursor: default;
}
.stepper__value {
  min-width: 26px;
  text-align: center;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ---------- avisos e estados vazios ---------- */
.notice {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: var(--r-m);
  font-size: 14px;
  font-weight: 600;
}
.notice--warn {
  background: var(--c-warn-soft);
  color: var(--c-warn);
}
.notice--ok {
  background: var(--c-ok-soft);
  color: var(--c-ok);
}
.notices:empty {
  display: none;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 24px;
  text-align: center;
}
.empty-state__icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--c-primary-soft);
  color: var(--c-primary);
}
.empty-state__title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.empty-state__text {
  max-width: 34ch;
  color: var(--c-muted);
}
.empty-state .btn {
  margin-top: 12px;
}

/* ---------- sheets (gaveta no celular, janela no desktop) ---------- */
.sheet {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--c-ink);
}
.sheet::backdrop {
  background: rgba(24, 10, 36, 0.58);
}
.sheet[open] {
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  background: var(--c-surface);
  border-radius: var(--r-l) var(--r-l) 0 0;
  overflow: hidden;
  animation: sheet-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet--small .sheet__panel {
  max-width: 440px;
}
.sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 8px 14px 20px;
  border-bottom: 1px solid var(--c-line);
}
.sheet__title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.sheet__panel > .sheet__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 8px rgba(24, 10, 36, 0.2);
}
.sheet__body {
  flex: 1;
  min-height: 0;
  padding: 16px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sheet__footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--c-line);
  background: var(--c-surface);
}
.sheet__footer > .btn--block {
  flex: 1;
}
.sheet__message {
  color: var(--c-muted);
}

@media (max-width: 430px) {
  .sheet__header {
    padding-left: 16px;
  }
  .sheet__body {
    padding-inline: 16px;
  }
  .sheet__footer {
    flex-wrap: wrap;
    gap: 8px;
  }
  .sheet__footer > .btn,
  .sheet__footer > .btn--block {
    min-width: 0;
  }
}

@media (min-width: 720px) {
  .sheet[open] {
    align-items: center;
  }
  .sheet__panel {
    max-height: 86dvh;
    border-radius: var(--r-l);
    box-shadow: 0 24px 70px rgba(24, 10, 36, 0.35);
  }
}

@keyframes sheet-in {
  from {
    transform: translateY(24px);
    opacity: 0.6;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

/* ---------- avisos rápidos ---------- */
.toast-region {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  pointer-events: none;
}
dialog .toast-region {
  bottom: calc(var(--safe-bottom) + 90px);
}
.toast {
  max-width: 420px;
  padding: 12px 18px;
  border-radius: var(--r-pill);
  background: var(--c-ink);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(24, 10, 36, 0.3);
  animation: toast-in 0.2s ease;
}
.toast--success {
  background: var(--c-ok);
}
.toast--error {
  background: var(--c-danger);
}
.toast.is-leaving {
  opacity: 0;
  transition: opacity 0.2s ease;
}

@keyframes toast-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
