﻿/* CafeManager · Pedidos móviles. Estilo "Soft UI Evolution" (mismo sistema que la caja).
   Contrastes de texto ≥ 4.5:1; objetivos táctiles ≥ 44 px; respeta "reducir movimiento" y áreas seguras (notch). */
:root {
    --espresso: #2B1D15;
    --espresso-2: #1F1712;
    --caramel: #B45309;
    --caramel-light: #F2B47A;
    --price: #9A4A12;
    --bg: #F6F3EF;
    --surface: #FFFFFF;
    --surface-2: #F2EDE7;
    --border: #E6DED5;
    --text: #1F1712;
    --muted: #6B5E54;
    --danger: #B91C1C;
    --danger-soft: #FDECEC;
    --success: #15803D;
    --success-soft: #EAF6EE;
    --warning: #A15C07;
    --warning-soft: #FEF6E7;
    --focus: #2563EB;
    --radius: 16px;
    --shadow-sm: 0 1px 2px rgba(59, 42, 32, .06), 0 2px 8px rgba(59, 42, 32, .06);
    --shadow-md: 0 8px 24px rgba(59, 42, 32, .14);
    --ease: cubic-bezier(.2, .8, .2, 1);
    color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
/* Los títulos reciben foco al navegar (lectores de pantalla) pero no son interactivos: sin anillo. */
[tabindex="-1"]:focus, h1:focus { outline: none; }

.shell { max-width: 640px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden; }
.shell > * { min-width: 0; }
.content { padding: 16px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); flex: 1; display: flex; flex-direction: column; gap: 12px; }
.content.with-bar { padding-bottom: calc(108px + env(safe-area-inset-bottom)); }
.legal { text-align: center; color: var(--muted); font-size: 12px; padding: 12px 0 calc(20px + env(safe-area-inset-bottom)); }
h1, h2 { margin: 0 0 8px; font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif; letter-spacing: -.01em; }
h2 { font-size: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }

/* ---------- arranque */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); }
.boot img { width: 72px; height: 72px; border-radius: 18px; box-shadow: var(--shadow-md); }

/* ---------- marca */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; }
.brand img { width: 32px; height: 32px; border-radius: 9px; }
.brand .m { color: var(--caramel-light); font-weight: 400; }

/* ---------- portada */
.hero {
    background: radial-gradient(120% 80% at 100% 0%, #4A3326 0%, var(--espresso-2) 60%);
    color: #fff;
    padding: calc(20px + env(safe-area-inset-top)) 20px 28px;
    border-radius: 0 0 28px 28px;
}
.hero .brand { margin-bottom: 22px; }
.hero h1 { font-size: 30px; line-height: 1.15; }
.hero p { margin: 0; color: #E3D6CA; }

/* ---------- barra superior */
.topbar {
    position: sticky; top: 0; z-index: 5;
    display: flex; align-items: center; gap: 10px;
    background: var(--espresso-2); color: #fff;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
}
.topbar .back {
    display: grid; place-content: center; width: 44px; height: 44px; border-radius: 12px;
    color: #fff; text-decoration: none; font-size: 26px; line-height: 1;
}
.topbar .back:active { background: rgba(255, 255, 255, .12); }
.topbar img { width: 30px; height: 30px; border-radius: 8px; }
.topbar .title { font-weight: 650; font-size: 17px; }
.topbar .subtitle { color: #D9C9BB; font-size: 13px; }

/* ---------- tarjetas y avisos */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.alert { display: flex; gap: 10px; align-items: flex-start; background: var(--danger-soft); color: var(--danger); border-radius: 12px; padding: 12px 14px; font-weight: 500; }
.alert::before { content: "!"; flex: none; display: grid; place-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--danger); color: #fff; font-weight: 700; font-size: 14px; }

/* ---------- botones */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 52px; padding: 0 20px; border-radius: 14px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    font: inherit; font-size: 16px; font-weight: 600; text-decoration: none; cursor: pointer;
    transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .2s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--espresso); border-color: var(--espresso); color: #fff; box-shadow: var(--shadow-sm); }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; box-shadow: var(--shadow-sm); }
.btn.block { width: 100%; }
.btn.big { min-height: 60px; font-size: 18px; }
.btn:disabled { opacity: .55; cursor: default; }

/* ---------- campos */
.input {
    width: 100%; min-height: 52px; padding: 12px 14px; margin-bottom: 10px;
    border: 1px solid var(--border); border-radius: 12px; font: inherit; font-size: 16px; background: #fff; color: var(--text);
    transition: border-color .2s, box-shadow .2s;
}
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(37, 99, 235, .25); }
textarea.input { resize: vertical; }
.field-label { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin: 6px 0 6px; }

.row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; gap: 12px; }
.row.link { color: inherit; text-decoration: none; border-bottom: 1px solid var(--surface-2); min-height: 48px; }
.row.total { font-size: 18px; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 12px; }

/* ---------- categorías */
.chips {
    position: sticky; top: calc(64px + env(safe-area-inset-top)); z-index: 4; background: var(--bg);
    display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px; scrollbar-width: none; min-width: 0;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex: none; min-height: 44px; padding: 0 18px; border-radius: 22px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; transition: background .2s, color .2s;
}
.chip.active { background: var(--espresso); color: #fff; border-color: var(--espresso); font-weight: 600; }

/* ---------- productos */
.product {
    display: flex; gap: 14px; text-align: left; width: 100%; align-items: stretch;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px;
    color: inherit; font: inherit; cursor: pointer; box-shadow: var(--shadow-sm);
    transition: transform .15s var(--ease), box-shadow .2s var(--ease);
}
.product:active { transform: scale(.985); }
.product img, .product .placeholder { width: 88px; height: 88px; border-radius: 14px; object-fit: cover; flex: none; }
.product .placeholder {
    display: grid; place-content: center; color: #fff; font-size: 30px; font-weight: 700;
    background: linear-gradient(135deg, #E3954A 0%, #B8622A 55%, #6E3418 100%);
}
.product .info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.product .name { font-weight: 650; font-size: 16px; }
.product .desc { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.product .price { color: var(--price); font-weight: 700; font-size: 17px; }
.product .add {
    display: grid; place-content: center; width: 36px; height: 36px; border-radius: 50%;
    background: var(--espresso); color: #fff; font-size: 22px; line-height: 1; font-weight: 400;
}
.product.soldout { opacity: .6; }
.product.soldout .price { color: var(--danger); }

/* ---------- barra del carrito */
.cartbar {
    position: fixed; left: 50%; transform: translateX(-50%); z-index: 6;
    bottom: calc(16px + env(safe-area-inset-bottom));
    width: calc(100% - 32px); max-width: 608px; min-height: 64px;
    display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 12px 0 16px;
    background: var(--success); color: #fff; border-radius: 18px; text-decoration: none; font-size: 17px; font-weight: 600;
    box-shadow: var(--shadow-md); animation: rise .3s var(--ease);
}
.cartbar .count {
    display: grid; place-content: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 16px;
    background: rgba(255, 255, 255, .22); font-weight: 700;
}
.cartbar .left { display: flex; align-items: center; gap: 10px; }
.cartbar strong { background: rgba(0, 0, 0, .14); padding: 8px 12px; border-radius: 12px; }

/* ---------- hoja de producto */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(31, 23, 18, .5); z-index: 10; animation: fade .2s ease; }
.sheet {
    position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 11;
    width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto;
    background: var(--surface); border-radius: 24px 24px 0 0; padding: 12px 18px 0;
    box-shadow: var(--shadow-md); animation: sheet .28s var(--ease);
}
.sheet-handle { width: 44px; height: 5px; border-radius: 3px; background: var(--border); margin: 0 auto 14px; }
.sheet h2 { font-size: 22px; }
.sheet-actions { display: flex; gap: 12px; align-items: center; position: sticky; bottom: 0; background: var(--surface); padding: 12px 0 calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--surface-2); }

.group { border: none; padding: 0; margin: 14px 0; }
.group legend { font-weight: 650; margin-bottom: 8px; padding: 0; }
.group .hint { font-weight: 500; color: var(--muted); font-size: 12px; margin-left: 6px; background: var(--surface-2); padding: 2px 8px; border-radius: 10px; }
.option {
    display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 14px; margin-bottom: 8px;
    border: 1.5px solid var(--border); border-radius: 14px; cursor: pointer; background: #fff;
    transition: border-color .15s, background .15s;
}
.option.selected { border-color: var(--espresso); background: #FBF7F3; }
.option input { width: 20px; height: 20px; accent-color: var(--espresso); flex: none; }
.option .delta { margin-left: auto; color: var(--price); font-weight: 600; }

.qty { display: flex; align-items: center; gap: 10px; }
.qty span { min-width: 28px; text-align: center; font-weight: 700; font-size: 18px; }
.round {
    width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border);
    background: var(--surface-2); font-size: 22px; color: var(--text); cursor: pointer; display: grid; place-content: center;
}
.round:active { background: var(--border); }
.small-qty { margin-top: 8px; }

/* ---------- líneas del pedido */
.line { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--surface-2); }
.line:last-of-type { border-bottom: none; }
.line .name { font-weight: 600; }
.line .amount { font-weight: 700; white-space: nowrap; }

/* ---------- seguimiento */
.steps { list-style: none; margin: 0; padding: 0; position: relative; }
.steps li { display: flex; align-items: center; gap: 14px; padding: 10px 0; color: var(--muted); position: relative; }
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 10px; top: 34px; bottom: -10px; width: 2px; background: var(--border); }
.steps li.done::after { background: var(--success); }
.steps .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); background: #fff; flex: none; z-index: 1; display: grid; place-content: center; font-size: 12px; color: #fff; }
.steps li.done { color: var(--text); }
.steps li.done .dot { background: var(--success); border-color: var(--success); }
.steps li.done .dot::before { content: "✓"; }
.steps li.current { color: var(--text); font-weight: 700; }
.steps li.current .dot { background: var(--caramel); border-color: var(--caramel); box-shadow: 0 0 0 5px rgba(180, 83, 9, .18); }

.ready {
    background: linear-gradient(135deg, #15803D, #0F6B33); color: #fff; border-radius: 20px; padding: 24px 20px; text-align: center;
    box-shadow: var(--shadow-md); animation: rise .35s var(--ease);
}
.ready .bell { width: 56px; height: 56px; margin: 0 auto 8px; border-radius: 50%; background: rgba(255, 255, 255, .18); display: grid; place-content: center; font-size: 28px; }
.ready h1 { font-size: 26px; }
.ready p { margin: 0; }

.number-badge { display: inline-block; background: var(--surface-2); padding: 4px 12px; border-radius: 12px; font-weight: 700; }

.spinner {
    width: 36px; height: 36px; margin: 8px auto; border-radius: 50%;
    border: 4px solid var(--surface-2); border-top-color: var(--caramel); animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes sheet { from { transform: translate(-50%, 40px); opacity: 0; } }
@keyframes rise { from { transform: translate(-50%, 16px); opacity: 0; } }
.ready, .alert { animation-name: none; }

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

#blazor-error-ui {
    background: var(--warning-soft); color: var(--warning); bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
    display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
