/* ═══════════════════════════════════════════════════════════════
   FoodDash Design System — base compartilhada de todas as telas
   Fonte: fooddash-DESIGN.md
   Carregado ANTES do <style> de cada página: as páginas usam os
   tokens --fd-* e ainda podem sobrescrever o que for específico.
   ═══════════════════════════════════════════════════════════════ */

:root {
    /* ── Cores ── */
    --fd-primary:        #DC2626;  /* CTAs, cabeçalho da marca, botão de pedir */
    --fd-primary-hover:  #B91C1C;
    --fd-primary-soft:   #FEF2F2;
    --fd-primary-rgb:    220, 38, 38;
    --fd-secondary:      #EA580C;  /* promoções, selos de oferta */
    --fd-secondary-soft: #FFEDD5;
    --fd-tertiary:       #16A34A;  /* disponível, aberto */

    --fd-bg:             #FFFFFF;
    --fd-bg-subtle:      #FAFAFA;  /* telas operacionais densas (admin, PDV, KDS) */
    --fd-surface:        #FFFFFF;

    --fd-success:        #16A34A;  --fd-success-soft: #DCFCE7;
    --fd-warning:        #D97706;  --fd-warning-soft: #FEF3C7;
    --fd-error:          #EF4444;  --fd-error-soft:   #FEE2E2;
    --fd-info:           #2563EB;  --fd-info-soft:    #DBEAFE;

    /* Neutros */
    --fd-n50:  #FAFAFA;
    --fd-n100: #F5F5F5;
    --fd-n200: #E5E5E5;
    --fd-n300: #D4D4D4;
    --fd-n400: #A3A3A3;
    --fd-n500: #737373;
    --fd-n600: #525252;
    --fd-n700: #404040;
    --fd-n900: #171717;

    --fd-text:          #171717;
    --fd-text-2:        #525252;
    --fd-text-tertiary: #737373;
    --fd-text-inverse:  #FFFFFF;
    --fd-border:        #E5E5E5;
    --fd-divider:       #F5F5F5;

    /* ── Tipografia ── */
    --fd-font-head: 'Poppins', system-ui, sans-serif;
    --fd-font-body: 'DM Sans', system-ui, sans-serif;
    --fd-font-mono: 'Roboto Mono', ui-monospace, monospace;

    /* ── Espaçamento (base 6px) ── */
    --fd-xs: 3px; --fd-sm: 6px; --fd-md: 12px; --fd-lg: 18px;
    --fd-xl: 24px; --fd-2xl: 36px; --fd-3xl: 48px;

    /* ── Raios ── */
    --fd-r-sm:   6px;     /* tags, elementos pequenos */
    --fd-r-md:   12px;    /* cards, inputs */
    --fd-r-lg:   16px;    /* bottom sheets, modais */
    --fd-r-pill: 9999px;  /* CTAs, busca */

    /* ── Elevação ── */
    --fd-shadow-sm: 0 1px 3px rgba(0,0,0,.08);
    --fd-shadow-md: 0 4px 12px rgba(0,0,0,.12);
    --fd-shadow-lg: 0 8px 24px rgba(0,0,0,.16);
    --fd-shadow-xl: 0 12px 32px rgba(0,0,0,.20);
    --fd-focus:     0 0 0 3px rgba(220,38,38,.25);
}

/* ── Base ── */
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--fd-font-body);
    color: var(--fd-text);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6, .fd-head { font-family: var(--fd-font-head); letter-spacing: -.01em; }
code, kbd, samp, .fd-mono { font-family: var(--fd-font-mono); }
button, input, select, textarea { font-family: inherit; }

/* Anel de foco padrão (teclado) */
:focus-visible { outline: none; box-shadow: var(--fd-focus); }

/* Barra de rolagem discreta */
* { scrollbar-width: thin; scrollbar-color: var(--fd-n300) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--fd-n300); border-radius: var(--fd-r-pill); }
*::-webkit-scrollbar-track { background: transparent; }

/* ═══════════ Componentes utilitários (fd-*) ═══════════ */

/* Botões — tamanhos sm 32 / md 42 / lg 50 */
.fd-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px; padding: 8px 20px; font-size: 14px; font-weight: 600;
    border: none; border-radius: var(--fd-r-pill); cursor: pointer;
    font-family: var(--fd-font-body); text-decoration: none; white-space: nowrap;
    transition: background .15s, box-shadow .15s, transform .1s, color .15s;
}
.fd-btn:active:not(:disabled) { transform: scale(.98); box-shadow: var(--fd-shadow-md); }
.fd-btn:disabled { opacity: .4; cursor: not-allowed; }
.fd-btn-sm { height: 32px; padding: 6px 14px; font-size: 12px; }
.fd-btn-lg { height: 50px; padding: 12px 28px; font-size: 16px; }
.fd-btn-primary   { background: var(--fd-primary); color: #fff; }
.fd-btn-primary:hover:not(:disabled)   { background: var(--fd-primary-hover); }
.fd-btn-secondary { background: transparent; color: var(--fd-primary); box-shadow: inset 0 0 0 1.5px var(--fd-primary); }
.fd-btn-secondary:hover:not(:disabled) { background: var(--fd-primary-soft); }
.fd-btn-ghost     { background: transparent; color: var(--fd-n600); }
.fd-btn-ghost:hover:not(:disabled)     { background: var(--fd-n100); }
.fd-btn-dark      { background: var(--fd-n900); color: #fff; }   /* "Destructive" do design */
.fd-btn-dark:hover:not(:disabled)      { background: var(--fd-n700); }

/* Inputs */
.fd-input {
    width: 100%; height: 42px; padding: 10px 14px;
    border: 1px solid var(--fd-n200); border-radius: var(--fd-r-md);
    background: #fff; color: var(--fd-text); font-size: 14px;
    box-shadow: var(--fd-shadow-sm); outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.fd-input:hover  { border-color: var(--fd-n400); }
.fd-input:focus  { border-color: var(--fd-primary); box-shadow: var(--fd-focus); }
.fd-input.is-error { border-color: var(--fd-error); background: var(--fd-primary-soft); box-shadow: none; }
.fd-input:disabled { background: var(--fd-n50); box-shadow: none; }
.fd-label  { display: block; font-size: 14px; font-weight: 500; color: var(--fd-text); margin-bottom: 4px; }
.fd-helper { font-size: 12px; color: var(--fd-text-tertiary); margin-top: 4px; }

/* Cards */
.fd-card     { background: var(--fd-surface); border-radius: var(--fd-r-md); box-shadow: var(--fd-shadow-sm); }
.fd-card-elv { background: var(--fd-surface); border-radius: var(--fd-r-md); box-shadow: var(--fd-shadow-md); }

/* Chips */
.fd-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 12px; border-radius: var(--fd-r-pill);
    background: var(--fd-n100); color: var(--fd-n900);
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.fd-chip.is-selected { background: var(--fd-primary); color: #fff; }

/* Chips de status do pedido (mapeamento semântico) */
.fd-st { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--fd-r-pill);
         font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.fd-st-PENDENTE   { background: var(--fd-secondary-soft); color: var(--fd-secondary); }
.fd-st-PREPARO    { background: var(--fd-warning-soft);   color: var(--fd-warning); }
.fd-st-ENTREGA    { background: var(--fd-info-soft);      color: var(--fd-info); }
.fd-st-FINALIZADO { background: var(--fd-success-soft);   color: var(--fd-success); }
.fd-st-CANCELADO  { background: var(--fd-error-soft);     color: var(--fd-error); }

/* Tooltip simples via atributo data-tip */
[data-tip] { position: relative; }
[data-tip]:hover::after {
    content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%;
    transform: translateX(-50%); max-width: 200px; width: max-content;
    background: var(--fd-n900); color: #fff; font-size: 12px; font-weight: 400;
    padding: 6px 12px; border-radius: 8px; box-shadow: var(--fd-shadow-md);
    pointer-events: none; z-index: 50;
}

/* Checkbox / radio no padrão do design (accent nativo) */
input[type="checkbox"], input[type="radio"] { accent-color: var(--fd-primary); }

/* ═══════════ Comanda / recibos (térmica 80mm) — FoodDash em P&B ═══════════
   Gerados por comanda.js. Só preto sobre branco: nada de cinza de fundo
   (a térmica transforma em pontilhado). Hierarquia e formas do FoodDash:
   Poppins nos títulos, DM Sans no corpo, Roboto Mono em números/valores,
   cantos arredondados e etiquetas em pílula. */
.cmd {
    font-family: var(--fd-font-body);
    color: #000; background: #fff;
    font-size: 12px; line-height: 1.4;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.cmd-logo { text-align: center; margin-bottom: 6px; }
.cmd-logo img { max-width: 44mm; max-height: 18mm; object-fit: contain; filter: grayscale(1) contrast(1.2); }
.cmd-title { font-family: var(--fd-font-head); font-weight: 700; font-size: 18px; line-height: 1.2; text-align: center; }
.cmd-sub   { text-align: center; font-size: 10px; margin-top: 2px; }

.cmd-label { font-size: 10px; font-weight: 600; letter-spacing: .02em; }
.cmd-mono, .cmd-money { font-family: var(--fd-font-mono); font-variant-numeric: tabular-nums; }
.cmd-money { white-space: nowrap; font-weight: 600; }
.cmd-strong { font-weight: 600; font-size: 13px; }
.cmd-muted  { font-size: 10px; }

/* Número do pedido em destaque */
.cmd-num-box  { border: 2px solid #000; border-radius: 12px; padding: 6px 8px 7px; margin: 10px 0 8px; text-align: center; }
.cmd-num      { font-family: var(--fd-font-mono); font-weight: 700; font-size: 30px; line-height: 1.1; }
.cmd-num-meta { font-size: 10px; }

/* Etiquetas (pílulas) */
.cmd-tags { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-bottom: 8px; }
.cmd-pill { display: inline-block; border: 1.5px solid #000; border-radius: 9999px; padding: 1px 9px; font-size: 11px; font-weight: 600; }
.cmd-pill-solid { background: #000; color: #fff; }

/* Blocos */
.cmd-block { margin: 6px 0; }
.cmd-cli   { font-family: var(--fd-font-head); font-weight: 600; font-size: 15px; line-height: 1.25; }
.cmd-box   { border: 1.5px solid #000; border-radius: 8px; padding: 5px 8px; margin: 6px 0; }
.cmd-box-solid { border-width: 2.5px; }
.cmd-hr    { border-top: 1.5px dashed #000; margin: 8px 0; }
.cmd-section {
    display: flex; justify-content: space-between; align-items: baseline;
    font-family: var(--fd-font-head); font-weight: 600; font-size: 13px; margin-bottom: 2px;
}
.cmd-section .cmd-mono { font-family: var(--fd-font-mono); font-weight: 500; font-size: 10px; }

/* Itens */
.cmd-item      { display: flex; align-items: baseline; gap: 6px; margin-top: 5px; }
.cmd-qtd       { font-family: var(--fd-font-mono); font-weight: 700; min-width: 22px; }
.cmd-item-nome { flex: 1; font-family: var(--fd-font-head); line-height: 1.25; }
.cmd-sep       { font-weight: 700; }
.cmd-extra     { display: flex; justify-content: space-between; gap: 6px; padding-left: 28px; font-size: 11px; }
.cmd-item-obs  { margin: 3px 0 2px 28px; border: 1px solid #000; border-radius: 6px; padding: 2px 6px; font-size: 11px; font-weight: 600; }

/* Linhas de valores e total */
.cmd-row        { display: flex; justify-content: space-between; gap: 8px; margin: 2px 0; }
.cmd-row-strong { font-weight: 600; }
.cmd-total {
    display: flex; justify-content: space-between; align-items: center;
    border: 2px solid #000; border-radius: 9999px; padding: 5px 12px; margin: 8px 0;
    font-family: var(--fd-font-head); font-weight: 700; font-size: 15px;
}
.cmd-total .cmd-money { font-weight: 700; font-size: 17px; }
.cmd-pay  { display: flex; justify-content: space-between; align-items: center; margin: 4px 0; }

/* Rodapé e senha destacável */
.cmd-foot     { text-align: center; margin-top: 12px; font-size: 11px; }
.cmd-foot-msg { margin-top: 2px; }
.cmd-cut { display: flex; align-items: center; gap: 6px; margin: 14px 0 10px; font-size: 11px; }
.cmd-cut::before, .cmd-cut::after { content: ''; flex: 1; border-top: 1.5px dashed #000; }
.cmd-ticket     { border: 2px solid #000; border-radius: 12px; padding: 6px 8px 8px; text-align: center; }
.cmd-ticket-num { font-family: var(--fd-font-mono); font-weight: 700; font-size: 40px; line-height: 1.1; }
.cmd-ticket-inf { font-size: 11px; font-weight: 600; }

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