/* Escarcha: fundamentos compartidos por la tienda y el panel.
   Sistema de formas: botones en píldora, tarjetas y hojas 20px, campos 12px. */

:root {
  color-scheme: light dark;
  --bg: #faf9f7;
  --surface: #fffefc;
  --surface-2: #f2efec;
  --ink: #22181f;
  --ink-2: #5e5159;
  --line: #e6e1de;
  --accent: #d6246e;
  --accent-ink: #fff8fb;
  --accent-text: #b81a5c;
  --accent-soft: #fce4ee;
  --sun: #ffd23f;
  --sun-ink: #22181f;
  --ok: #1d7f46;
  --ok-soft: #e1f3e8;
  --warn: #a15508;
  --warn-soft: #fdf0dc;
  --danger: #c0262d;
  --danger-soft: #fde6e6;
  --straw: #d6246e;
  --shadow: 0 1px 2px rgb(60 20 40 / 0.06), 0 8px 24px rgb(60 20 40 / 0.08);
  --shadow-lg: 0 24px 64px rgb(60 20 40 / 0.22);
  --r-card: 20px;
  --r-field: 12px;
  --font-display: 'Lilita One', 'Arial Rounded MT Bold', 'Trebuchet MS', sans-serif;
  --font-body: 'Outfit', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17121a;
    --surface: #211a24;
    --surface-2: #2b232f;
    --ink: #f5eef2;
    --ink-2: #bdafb8;
    --line: #3a3040;
    --accent-text: #ff8fbc;
    --accent-soft: #3d1a2b;
    --sun: #3b1730;
    --sun-ink: #ffd23f;
    --ok: #5fd08e;
    --ok-soft: #173325;
    --warn: #f3b35c;
    --warn-soft: #3a2a12;
    --danger: #ff8a8f;
    --danger-soft: #3d1a1d;
    --straw: #ff6fa5;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 24px 64px rgb(0 0 0 / 0.5);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img,
svg {
  display: block;
  max-width: 100%;
}
h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.05;
  margin: 0;
  letter-spacing: 0.005em;
}
p {
  margin: 0;
}
a {
  color: var(--accent-text);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background-color 0.2s, border-color 0.2s, opacity 0.2s;
}
.btn:active:not(:disabled) {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn--primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 88%, black);
}
.btn--ghost {
  background: transparent;
  border-color: var(--line);
}
.btn--ghost:hover:not(:disabled) {
  background: var(--surface-2);
}
.btn--danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.btn--sm {
  min-height: 36px;
  padding: 0 14px;
  font-size: 14px;
}
.btn--block {
  width: 100%;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s var(--ease);
}
.icon-btn:active {
  transform: scale(0.94);
}

/* ---------- formularios ---------- */
.field {
  display: grid;
  gap: 6px;
}
.field > span,
.label {
  font-size: 14px;
  font-weight: 600;
}
.field small,
.hint {
  color: var(--ink-2);
  font-size: 13px;
}
.input,
.field input:not([type='checkbox']):not([type='radio']):not([type='file']),
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
}
.field textarea {
  min-height: 80px;
  resize: vertical;
}
.field input::placeholder,
.field textarea::placeholder {
  color: color-mix(in srgb, var(--ink-2) 80%, transparent);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
  outline-offset: 0;
}
.field.has-error input,
.field.has-error textarea {
  border-color: var(--danger);
}
.error {
  display: block;
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
}
body:has(dialog[open]) {
  overflow: hidden;
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  cursor: pointer;
}
.check input {
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--accent);
  flex: none;
}

/* Selector segmentado (domicilio / recoger, efectivo / Nequi) */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-2);
}
.segmented label {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.segmented label:has(input:checked) {
  background: var(--surface);
  color: var(--accent-text);
  box-shadow: var(--shadow);
}
.segmented label:has(input:focus-visible) {
  outline: 3px solid var(--accent);
}
.segmented label:has(input:disabled) {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Contador de cantidad */
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border-radius: 999px;
  background: var(--surface-2);
}
.stepper button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.stepper button:hover {
  background: var(--line);
}
.stepper output {
  min-width: 26px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- avisos ---------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--r-field);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 14px;
  font-weight: 500;
}
.alert--danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.alert--ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100% - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  padding: 12px 18px;
  border-radius: 16px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.35s var(--ease);
}
.toast--error {
  background: var(--danger);
  color: #fff;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* ---------- diálogos (hoja inferior en celular, ventana centrada en computador) ---------- */
dialog.sheet {
  width: min(560px, 100%);
  max-width: 100%;
  max-height: min(92dvh, 900px);
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 24px 24px 0 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
dialog.sheet[open] {
  display: flex;
  flex-direction: column;
  animation: sheet-up 0.4s var(--ease);
}
dialog.sheet::backdrop {
  background: rgb(20 10 18 / 0.5);
  animation: fade 0.3s ease;
}
@media (min-width: 720px) {
  dialog.sheet {
    margin: auto;
    border-radius: 24px;
  }
  dialog.sheet[open] {
    animation: pop 0.3s var(--ease);
  }
}
.sheet__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 12px 20px;
  border-bottom: 1px solid var(--line);
}
.sheet__head h2 {
  flex: 1;
  font-size: 24px;
}
.sheet__body {
  display: grid;
  gap: 18px;
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sheet__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.sheet__foot .btn--primary {
  flex: 1;
}
@keyframes sheet-up {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}
@keyframes pop {
  from {
    transform: scale(0.96);
    opacity: 0;
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
}

/* Vaso de color: identifica el sabor mientras no haya foto */
.vaso {
  width: 100%;
  height: 100%;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
