/* Flujo de pedido */

.order-layout { padding-top: 1rem; padding-bottom: 2rem; }
.order-main { min-width: 0; }
.step-title { font-size: clamp(1.6rem, 6vw, 2.2rem); margin: .25rem 0 .35rem; }
.sub-title { font-size: 1.25rem; margin: 1.75rem 0 .75rem; }

.notice { border-radius: var(--radius); padding: .85rem 1rem; margin-bottom: 1rem; font-weight: 600; border: 1.5px solid; }
.notice-warn { background: var(--warn-wash); color: var(--warn); }
.notice-error { background: var(--danger-wash); color: var(--danger); }
.notice-info { background: var(--celeste-wash); color: var(--ink); border-color: var(--celeste-dark); font-weight: 500; }
.notice a { font-weight: 700; }

/* ---------- Progreso ---------- */
.progress { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0 0 1.25rem; padding: 0; }
.progress button {
    width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px;
    background: none; border: 0; padding: 4px 0; cursor: pointer; font-size: .78rem; font-weight: 700; color: var(--ink-faint);
}
.progress button:disabled { cursor: default; }
.progress span {
    width: 100%; height: 8px; border-radius: 999px; background: var(--line); font-size: 0; overflow: hidden;
}
.progress li.done span { background: var(--celeste-dark); }
.progress li.current span { background: var(--ink); }
.progress li.current button, .progress li.done button { color: var(--ink); }

/* ---------- Paso 1: presentaciones ---------- */
.product-list { display: flex; flex-direction: column; gap: 12px; }
.product-row {
    display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; align-items: center; gap: 12px;
    background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius-lg); padding: 10px 12px 10px 10px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.product-row.has-qty { border-color: var(--ink); box-shadow: var(--pop-sm); }
.product-row img { width: 84px; height: 84px; object-fit: cover; border-radius: 14px; }
.product-row .thumb-empty { width: 84px; height: 84px; border-radius: 14px; background: var(--amarillo-wash); display: grid; place-items: center; font-size: 2rem; }
.product-info h3 { font-size: 1.35rem; margin: 0; }
.product-info p { margin: 0; font-size: .88rem; color: var(--ink-soft); }
.product-info .price { font-size: 1.1rem; }
.extras .product-row { grid-template-columns: minmax(0, 1fr) auto; }
.extras .hint { font-size: .88rem; color: var(--ink-soft); margin: .5rem 0 0; }

@media (max-width: 380px) {
    .product-row { grid-template-columns: 64px minmax(0, 1fr); }
    .product-row img, .product-row .thumb-empty { width: 64px; height: 64px; }
    .product-row .stepper { grid-column: 1 / -1; justify-self: end; }
}

/* ---------- Paso 2: sabores ---------- */
.pote-tabs {
    position: sticky; top: var(--header-h); z-index: 20;
    display: flex; gap: 8px; overflow-x: auto; padding: 8px 2px 10px; margin: 0 -2px .5rem;
    background: var(--bg); scrollbar-width: none;
}
.pote-tabs::-webkit-scrollbar { display: none; }
.pote-tab {
    flex-shrink: 0; display: flex; align-items: center; gap: 8px; min-height: 44px;
    padding: .35rem .9rem; border-radius: 999px; border: 2px solid var(--ink); background: var(--paper);
    font-weight: 700; cursor: pointer; white-space: nowrap;
}
.pote-tab[aria-selected="true"] { background: var(--amarillo); box-shadow: var(--pop-sm); }
.pote-tab .count { font-size: .8rem; background: var(--celeste-wash); border-radius: 999px; padding: .05rem .5rem; }
.pote-tab.complete .count { background: var(--ok-wash); color: var(--ok); }
.pote-tab.invalid .count { background: var(--danger-wash); color: var(--danger); }

.pote-status {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px;
    margin-bottom: .5rem;
}
.pote-status h2 { font-size: 1.25rem; margin: 0; }
.pote-status p { margin: 0; font-weight: 600; color: var(--ink-soft); }
.pote-status p.full { color: var(--ok); }

.picked { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 1rem; min-height: 8px; }
.picked-chip {
    display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
    padding: .3rem .4rem .3rem .85rem; border-radius: 999px; border: 2px solid var(--ink); background: var(--rosa);
    font-weight: 700; font-size: .92rem; cursor: pointer;
}
.picked-chip .x {
    width: 26px; height: 26px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--ink);
    display: inline-grid; place-items: center; font-size: 1rem; line-height: 1;
}
.picked-empty { color: var(--ink-faint); font-size: .92rem; margin: 0; }

.flavor-tools { margin-bottom: .75rem; }
.search { position: relative; display: block; }
.search svg { position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--ink-soft); pointer-events: none; }
.search input {
    width: 100%; min-height: 48px; padding: .6rem 1rem .6rem 2.75rem; border-radius: 999px;
    border: 2px solid var(--ink); background: var(--paper); font-size: 1rem;
}
.search input:focus { outline: none; box-shadow: 3px 3px 0 var(--celeste-dark); }

.flavor-cat { border-top: 1.5px solid var(--line); }
.flavor-cat > summary {
    list-style: none; display: flex; align-items: center; gap: 8px; min-height: 52px; cursor: pointer;
    font-family: var(--font-display); font-weight: 800; font-size: 1.12rem;
}
.flavor-cat > summary::-webkit-details-marker { display: none; }
.flavor-cat > summary::after {
    content: ''; margin-left: auto; width: 10px; height: 10px; border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink);
    transform: rotate(45deg); transition: transform .15s ease; margin-right: 6px;
}
.flavor-cat[open] > summary::after { transform: rotate(-135deg); }
.flavor-cat .cat-meta { font-family: var(--font-body); font-weight: 600; font-size: .82rem; color: var(--ink-soft); }
.flavor-cat .tag { font-family: var(--font-body); }

.flavor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 2px 0 14px; }
@media (min-width: 640px) { .flavor-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.flavor-btn {
    position: relative; text-align: left; min-height: 52px; padding: .5rem 2.1rem .5rem .75rem;
    border-radius: 14px; border: 2px solid var(--line); background: var(--paper); cursor: pointer;
    display: flex; flex-direction: column; justify-content: center; line-height: 1.2;
    transition: border-color .12s ease, background-color .12s ease, box-shadow .12s ease;
    -webkit-tap-highlight-color: transparent;
}
.flavor-btn strong { font-weight: 700; font-size: .95rem; }
.flavor-btn small { color: var(--ink-soft); font-size: .76rem; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.flavor-btn::after {
    content: ''; position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); background: var(--paper);
}
.flavor-btn:hover { border-color: var(--ink-faint); }
.flavor-btn[aria-pressed="true"] { border-color: var(--ink); background: var(--rosa-wash); box-shadow: var(--pop-sm); }
.flavor-btn[aria-pressed="true"]::after {
    border-color: var(--ink); background: var(--ink)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.flavor-cat[data-slug="pura"] .flavor-btn[aria-pressed="true"] { background: var(--celeste-light); }
.flavor-btn.locked { opacity: .45; }
.no-results { padding: 1rem; text-align: center; color: var(--ink-soft); border: 2px dashed var(--line); border-radius: var(--radius); }

.pote-next { display: flex; justify-content: flex-end; margin-top: .5rem; }

/* ---------- Paso 3: datos y pago ---------- */
#customerForm { max-width: 560px; }
.pay-options { border: 0; padding: 0; margin: 1.25rem 0 1rem; display: grid; gap: 10px; }
.pay-options legend { margin-bottom: .5rem; padding: 0; }
.pay-card {
    display: flex; gap: 12px; align-items: flex-start; padding: 1rem; cursor: pointer;
    border: 2px solid var(--line); border-radius: var(--radius); background: var(--paper);
}
.pay-card input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--ink); flex-shrink: 0; min-height: 0; }
.pay-body { display: flex; flex-direction: column; }
.pay-body strong { font-family: var(--font-display); font-size: 1.1rem; }
.pay-body span { color: var(--ink-soft); font-size: .92rem; }
.pay-card:has(input:checked) { border-color: var(--ink); background: var(--amarillo-wash); box-shadow: var(--pop-sm); }
.pay-options.has-error .pay-card { border-color: var(--danger); }

.bank { background: var(--celeste-wash); border: 2px solid var(--ink); border-radius: var(--radius); padding: 1rem; max-width: 560px; }
.bank h3 { font-size: 1.05rem; margin-bottom: .5rem; }
.bank dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; }
.bank dt { color: var(--ink-soft); font-size: .9rem; }
.bank dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.copy-btn { border: 1.5px solid var(--ink); background: var(--paper); border-radius: 999px; font-size: .78rem; font-weight: 700; padding: .15rem .6rem; cursor: pointer; min-height: 30px; }
.bank p { margin: .75rem 0 0; font-size: .9rem; }

/* ---------- Paso 4: revisión ---------- */
.review-block { background: var(--paper); border: 2px solid var(--ink); border-radius: var(--radius-lg); padding: 1rem 1.1rem; margin-bottom: 14px; }
.review-block h2 { font-size: 1.1rem; display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: .6rem; }
.review-item { display: flex; justify-content: space-between; gap: 12px; padding: .55rem 0; border-top: 1px dashed var(--line); }
.review-item:first-of-type { border-top: 0; }
.review-item p { margin: 0; color: var(--ink-soft); font-size: .92rem; }
.review-item strong { font-family: var(--font-display); }
.review-totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.review-totals .grand { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; padding-top: .4rem; border-top: 2px solid var(--ink); margin-top: .3rem; }
.review-data p { margin: 0 0 .25rem; }
.link-btn { min-height: 44px; display: inline-flex; align-items: center; background: none; border: 0; padding: .25rem; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-weight: 700; font-family: var(--font-body); font-size: .9rem; }

/* ---------- Confirmación ---------- */
.done-card { text-align: center; max-width: 560px; margin: 1rem auto; }
.done-card .big-number { font-family: var(--font-display); font-weight: 800; font-size: 2.6rem; background: var(--amarillo); display: inline-block; padding: .1rem 1rem; border-radius: 999px; border: var(--stroke); margin: .25rem 0 .75rem; }
.done-card .bank { text-align: left; margin: 1rem auto; }
.done-card .actions { display: flex; flex-direction: column; gap: 10px; margin-top: 1.25rem; }

/* ---------- Resumen / barra de acción ---------- */
.summary-head { display: flex; justify-content: space-between; align-items: center; }
.summary-head h2 { font-size: 1.3rem; margin: 0; }
.sheet-close { display: none; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper); font-size: 1.5rem; cursor: pointer; }
.summary-lines { margin-top: .75rem; }
.sum-line { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: .5rem 0; border-bottom: 1px dashed var(--line); }
.sum-line p { margin: 0; font-size: .85rem; color: var(--ink-soft); }
.sum-line .remove { background: none; border: 0; color: var(--danger); font-weight: 700; font-size: .82rem; cursor: pointer; padding: .2rem 0; min-height: 36px; text-decoration: underline; }
.sum-totals { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding-top: .6rem; font-size: .95rem; }
.sum-totals .grand { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; }
.sum-empty { color: var(--ink-faint); margin: .5rem 0; }

.action-bar { display: flex; align-items: center; gap: 10px; }
.bar-total { background: none; border: 0; padding: 0; text-align: left; display: flex; flex-direction: column; cursor: pointer; min-width: 0; }
.bar-count { font-size: .8rem; font-weight: 700; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bar-amount { font-size: 1.35rem; white-space: nowrap; }
.bar-buttons { display: flex; gap: 8px; margin-left: auto; }
.bar-buttons .btn { padding-inline: 1rem; }

/* Celular: barra fija abajo y resumen como hoja deslizable */
@media (max-width: 959px) {
    body.order-page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
    .summary { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; }
    .action-bar {
        background: var(--paper); border-top: var(--stroke);
        padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
        box-shadow: 0 -6px 20px rgba(31, 42, 48, .08);
    }
    .summary-sheet {
        display: none; background: var(--paper); border-top: var(--stroke); border-radius: 22px 22px 0 0;
        padding: 1rem var(--gutter); max-height: 65vh; overflow-y: auto;
    }
    .summary.open .summary-sheet { display: block; }
    .sheet-close { display: inline-block; }
    .sheet-backdrop { position: fixed; inset: 0; background: rgba(31, 42, 48, .35); z-index: 55; }
    .wa-float { display: none; }
}
@media (max-width: 360px) {
    .bar-buttons .btn { padding-inline: .75rem; font-size: .95rem; }
    .bar-amount { font-size: 1.15rem; }
}

/* Computadora: columna lateral fija */
@media (min-width: 960px) {
    .order-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: start; padding-top: 2rem; }
    .summary { position: sticky; top: calc(var(--header-h) + 16px); background: var(--paper); border: var(--stroke); border-radius: var(--radius-lg); box-shadow: var(--pop); padding: 1.25rem; }
    .action-bar { flex-direction: column; align-items: stretch; margin-top: 1rem; }
    .bar-total { display: none; }
    .bar-buttons { margin-left: 0; flex-direction: row-reverse; }
    .bar-buttons .btn { flex: 1; }
    .sheet-backdrop { display: none !important; }
}

/* Estado de la página tras confirmar: sin barra */
body.order-done .summary, body.order-done .progress { display: none; }
body.order-done.order-page { padding-bottom: 0; }
@media (min-width: 960px) { body.order-done .order-layout { grid-template-columns: 1fr; } }

/* Avisos por encima de la barra fija en celular */
@media (max-width: 959px) {
    .order-page .toasts { bottom: calc(100px + env(safe-area-inset-bottom)); }
}
.flavor-cat > summary { flex-wrap: wrap; padding: .6rem 0; row-gap: 4px; }
.flavor-cat > summary .cat-meta { flex-basis: auto; }
