/* publico.css - Cardápio do cliente (estilo iFood) */
:root {
    --pub-bg: #f5f5f5;
    --pub-card: #ffffff;
    --pub-border: #ececec;
    --pub-text: #3e3e3e;
    --pub-text2: #7e7e7e;
    --pub-brand: #ea1d2c;
    --pub-brand2: #c4111f;
    --pub-green: #00a86b;
    --pub-amber: #f59e0b;
    --pub-red: #e0342c;
    --pub-blue: #1d6fdb;
    --pub-radius: 16px;
    --pub-shadow: 0 1px 3px rgba(0,0,0,.08);
    --pub-shadow-lg: 0 -4px 24px rgba(0,0,0,.14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--pub-bg);
    color: var(--pub-text);
    font-family: 'Segoe UI', system-ui, sans-serif;
    min-height: 100vh;
}

.publico-container { max-width: 480px; margin: 0 auto; padding-bottom: 175px; }

/* ============ HEADER ============ */
.pub-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; background: var(--pub-card);
    position: sticky; top: 0; z-index: 50;
    box-shadow: var(--pub-shadow);
}
.pub-brand { display: flex; gap: 10px; align-items: center; }
.pub-brand-icon {
    width: 40px; height: 40px; border-radius: 12px;
    background: var(--pub-brand);
    display: flex; align-items: center; justify-content: center;
    font-size: 19px; color: #fff;
}
.pub-brand h1 { font-size: 16px; font-weight: 900; color: var(--pub-brand); }
.pub-brand span { font-size: 11px; color: var(--pub-text2); }
.pub-mesa-badge {
    background: var(--pub-brand); color: #fff; border-radius: 999px;
    padding: 7px 14px; font-size: 13px; font-weight: 700;
    display: inline-flex; align-items: center; gap: 5px;
}
.pub-mesa-badge strong { font-size: 15px; }

.pub-userbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 16px; font-size: 12px; color: var(--pub-text2);
    background: var(--pub-card); border-bottom: 1px solid var(--pub-border);
}
.pub-userbar span i { color: var(--pub-brand); margin-right: 4px; }
.pub-userbar a { color: var(--pub-blue); text-decoration: none; font-weight: 700; margin-left: 14px; }
.pub-userbar a i { margin-right: 3px; }

/* ============ CATEGORIAS (chips) ============ */
.cats-bar {
    display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px;
    background: var(--pub-bg); position: sticky; top: 64px; z-index: 40;
    scrollbar-width: none;
}
.cats-bar::-webkit-scrollbar { display: none; }
.cat-chip {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px; border-radius: 999px; border: 1px solid var(--pub-border);
    background: var(--pub-card); color: var(--pub-text);
    font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.cat-chip i { color: var(--pub-brand); font-size: 12px; }
.cat-chip.active { background: var(--pub-brand); border-color: var(--pub-brand); color: #fff; }
.cat-chip.active i { color: #fff; }

/* ============ PRODUTOS ============ */
.cat-title {
    font-size: 18px; font-weight: 900; color: var(--pub-text);
    padding: 18px 16px 10px; display: flex; gap: 8px; align-items: center;
}
.cat-title i { color: var(--pub-brand); font-size: 16px; }

.prod-card {
    display: flex; gap: 12px; margin: 0 12px 12px; padding: 12px;
    background: var(--pub-card); border-radius: var(--pub-radius);
    box-shadow: var(--pub-shadow); cursor: pointer;
    transition: transform .12s ease;
}
.prod-card:active { transform: scale(.985); }
.prod-card.esgotado-card { opacity: .55; cursor: default; }

.prod-img {
    width: 96px; height: 96px; border-radius: 12px; overflow: hidden;
    flex: 0 0 auto; background: #fdf0f0;
    display: flex; align-items: center; justify-content: center;
}
.prod-img img { width: 100%; height: 100%; object-fit: cover; }
.prod-img .img-ph {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #ffe9ea, #ffd4d6); font-size: 34px; color: var(--pub-brand);
}

.prod-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.prod-info h3 { font-size: 15px; font-weight: 800; color: var(--pub-text); }
.prod-info .desc {
    font-size: 12px; color: var(--pub-text2); margin-top: 3px; line-height: 1.45;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.prod-info .linha { margin-top: auto; padding-top: 8px; display: flex; justify-content: space-between; align-items: center; }
.prod-info .preco { font-size: 15px; font-weight: 900; color: var(--pub-brand); }
.prod-info .esgotado { color: var(--pub-red); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.btn-quick-add {
    width: 34px; height: 34px; border-radius: 10px; border: none;
    background: var(--pub-brand); color: #fff; font-size: 17px; font-weight: 900;
    cursor: pointer; flex: 0 0 auto;
}
.btn-quick-add:active { transform: scale(.92); }

.aviso-strip {
    margin: 12px 12px 4px; padding: 11px 14px; border-radius: 12px;
    font-size: 13px; display: flex; gap: 7px; align-items: center;
}
.aviso-strip.info { background: #fff4e3; color: #a36207; }
.aviso-strip.ok { background: #e2f7ef; color: #007a50; }
.aviso-strip a { color: inherit; font-weight: 800; text-decoration: underline; }

/* ============ SACOLA (barra fixa acima do menu) ============ */
.bag-bar {
    position: fixed; bottom: calc(64px + env(safe-area-inset-bottom)); left: 0; right: 0; z-index: 70;
    max-width: 480px; margin: 0 auto; width: calc(100% - 24px);
    margin-bottom: 8px; border: none; border-radius: 14px;
    background: var(--pub-brand); color: #fff;
    padding: 14px 18px; display: flex; justify-content: space-between; align-items: center;
    font-size: 14px; font-weight: 800; cursor: pointer;
    box-shadow: 0 6px 20px rgba(234,29,44,.4);
}
.bag-bar small { display: block; font-size: 11px; font-weight: 600; opacity: .9; }
.bag-bar .ver { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }

/* ============ MENU INFERIOR (abas) ============ */
.tab-bar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 80;
    max-width: 480px; margin: 0 auto;
    background: var(--pub-card); border-top: 1px solid var(--pub-border);
    display: flex; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 14px rgba(0,0,0,.06);
}
.tab-item {
    flex: 1; border: none; background: none; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 2px; color: var(--pub-text2); font-family: inherit;
    position: relative;
}
.tab-item i { font-size: 19px; }
.tab-item span { font-size: 10px; font-weight: 700; }
.tab-item.active { color: var(--pub-brand); }
.tab-item .tab-badge {
    position: absolute; top: 2px; right: calc(50% - 22px);
    background: var(--pub-brand); color: #fff; font-size: 9px; font-weight: 900;
    min-width: 16px; height: 16px; border-radius: 999px;
    display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* ============ VIEWS (abas) ============ */
.tab-view { display: none; }
.tab-view.active { display: block; }

/* ============ FAVORITOS ============ */
.fav-btn {
    position: absolute; top: 10px; right: 10px; z-index: 2;
    width: 34px; height: 34px; border-radius: 999px; border: none; cursor: pointer;
    background: rgba(255,255,255,.92); color: #c2c2c2; font-size: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
    display: flex; align-items: center; justify-content: center;
    transition: transform .12s ease, color .15s ease;
}
.fav-btn:active { transform: scale(.85); }
.fav-btn.ativo { color: var(--pub-brand); }
.prod-card { position: relative; }

.vazio-tab { text-align: center; padding: 48px 24px; color: var(--pub-text2); }
.vazio-tab i { font-size: 44px; color: #d8d8d8; margin-bottom: 12px; display: block; }
.vazio-tab p { font-size: 14px; font-weight: 700; color: var(--pub-text); }
.vazio-tab small { font-size: 12px; display: block; margin-top: 5px; line-height: 1.5; }
.addon-group { margin: 14px 0; padding-top: 12px; border-top: 1px solid var(--pub-border); }
.addon-group > strong, .addon-group > small { display: block; }
.addon-group > strong { font-size: 14px; }
.addon-group > small { margin: 3px 0 8px; color: var(--pub-text2); font-size: 11px; }
.addon-option { display: flex; align-items: center; gap: 9px; padding: 9px 2px; font-size: 13px; }
.addon-option input { accent-color: var(--pub-brand); width: 18px; height: 18px; }
.addon-option span { flex: 1; }
.addon-option b { font-size: 12px; }
.delivery-select {
    width: 100%; padding: 13px 14px; border: 1.5px solid var(--pub-border);
    border-radius: 12px; background: #fafafa; color: var(--pub-text); font: inherit;
}
.delivery-fields { padding: 12px; border-radius: 14px; background: #f8f8f8; margin-bottom: 14px; }
.btn-location {
    width: 100%; border: 1px solid var(--pub-brand); border-radius: 11px; padding: 11px;
    color: var(--pub-brand); background: #fff; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer;
}
.delivery-location-status { margin: 8px 0 0; color: var(--pub-text2); font-size: 11px; line-height: 1.4; }
.delivery-location-status.erro { color: var(--pub-red); }
.delivery-fee-row { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--pub-border); font-size: 13px; }
.delivery-fee-row strong { color: var(--pub-green); }
.vazio-tab .btn-brand { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; margin-left: auto; margin-right: auto; }

/* ============ CUPONS (futuro) ============ */
.cupom-card {
    margin: 12px; padding: 18px; border-radius: var(--pub-radius);
    border: 2px dashed #f0b8bb; background: #fff7f7;
    display: flex; gap: 14px; align-items: center;
}
.cupom-card i { font-size: 26px; color: var(--pub-brand); }
.cupom-card .cup-nome { font-size: 15px; font-weight: 900; color: var(--pub-text); }
.cupom-card .cup-desc { font-size: 12px; color: var(--pub-text2); margin-top: 3px; line-height: 1.5; }

/* ============ SEÇÕES / PEDIDOS ============ */
.secao-titulo {
    font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .5px;
    color: var(--pub-text2); padding: 20px 16px 10px;
}
.card-pedido {
    margin: 0 12px 12px; padding: 14px; border-radius: var(--pub-radius);
    background: var(--pub-card); box-shadow: var(--pub-shadow);
}
.card-pedido .linha1 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.card-pedido .num { font-size: 12px; color: var(--pub-text2); font-weight: 700; }
.card-pedido .itens { font-size: 13px; color: var(--pub-text2); line-height: 1.6; }
.card-pedido .itens strong { color: var(--pub-text); }
.card-pedido .total-linha {
    display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px;
    border-top: 1px dashed var(--pub-border); font-size: 14px;
}
.card-pedido .total-linha strong { color: var(--pub-green); }

.status-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 999px; font-size: 10px; font-weight: 900; text-transform: uppercase;
}
.status-enviado    { background: #e8f1fd; color: #145ebc; }
.status-aceito     { background: #fff4e3; color: #a36207; }
.status-preparando { background: #ffecec; color: #c4111f; }
.status-entregue   { background: #e2f7ef; color: #007a50; }
.status-cancelado  { background: #fdecec; color: #c22a22; }
.status-finalizado { background: #eee; color: #666; }

/* ============ SHEETS (bottom sheets) ============ */
.sheet-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45);
    z-index: 90; justify-content: center;
}
.sheet-overlay.aberto { display: flex; animation: fadeIn .18s ease; }
.sheet {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
    max-width: 480px; margin: 0 auto; background: var(--pub-card);
    border-radius: 20px 20px 0 0; box-shadow: var(--pub-shadow-lg);
    padding: 8px 18px calc(18px + env(safe-area-inset-bottom));
    max-height: 86vh; overflow-y: auto;
    animation: slideUp .22s ease;
}
.sheet.aberto { display: block; }
@keyframes slideUp { from { transform: translateY(60px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.sheet .puxador {
    width: 42px; height: 4px; border-radius: 999px; background: #ddd;
    margin: 4px auto 12px; border: none; cursor: pointer;
}
.sheet h2 { font-size: 18px; font-weight: 900; margin-bottom: 3px; }
.sheet h2.sheet-title { text-align: center; margin-bottom: 12px; }
.sheet .sub { font-size: 13px; color: var(--pub-text2); margin-bottom: 14px; }

.sheet-header-close {
    position: absolute; top: 14px; right: 14px; border: none; background: #f2f2f2;
    width: 32px; height: 32px; border-radius: 999px; font-size: 13px; color: #555; cursor: pointer;
}

/* Detalhe do produto */
#sheetProduto { position: relative; }
.pd-img {
    width: 100%; height: 180px; border-radius: 14px; overflow: hidden; margin-bottom: 14px;
    display: flex; align-items: center; justify-content: center;
}
.pd-img img { width: 100%; height: 100%; object-fit: cover; }
.pd-img .img-ph {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #ffe9ea, #ffd4d6); font-size: 64px; color: var(--pub-brand);
}
.pd-desc { font-size: 13px; color: var(--pub-text2); line-height: 1.6; margin-bottom: 16px; }

.qtd-stepper {
    display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 16px;
}
.qtd-stepper button {
    width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--pub-border);
    background: #fff; color: var(--pub-brand); font-size: 20px; font-weight: 900; cursor: pointer;
}
.qtd-stepper button:active { transform: scale(.92); }
.qtd-stepper .val { font-size: 19px; font-weight: 900; min-width: 32px; text-align: center; }

.btn-brand {
    width: 100%; padding: 15px; border: none; border-radius: 14px;
    background: var(--pub-brand); color: #fff; font-size: 15px; font-weight: 900; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-brand:active { transform: scale(.985); }
.btn-brand:disabled { opacity: .6; }
.btn-brand.verde { background: var(--pub-green); }
.btn-brand.secundario { background: #f2f2f2; color: var(--pub-text); }

/* Itens da sacola */
.bag-item {
    display: flex; gap: 10px; align-items: center; padding: 12px 0;
    border-bottom: 1px solid var(--pub-border);
}
.bag-item .bi-info { flex: 1; min-width: 0; }
.bag-item .bi-nome { font-size: 14px; font-weight: 800; }
.bag-item .bi-valor { font-size: 13px; font-weight: 900; color: var(--pub-brand); margin-top: 2px; }
.bag-item .mini-stepper { display: flex; align-items: center; gap: 8px; }
.bag-item .mini-stepper button {
    width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--pub-border);
    background: #fff; color: var(--pub-brand); font-weight: 900; font-size: 15px; cursor: pointer;
}
.bag-item .mini-stepper .val { font-size: 14px; font-weight: 900; min-width: 22px; text-align: center; }
.bag-item .bi-lixeira {
    border: none; background: none; color: #bbb; font-size: 15px; cursor: pointer; padding: 6px;
}
.bag-total-linha {
    display: flex; justify-content: space-between; align-items: center; padding: 14px 0 4px;
    font-size: 15px; font-weight: 900;
}
.bag-total-linha b { color: var(--pub-brand); font-size: 18px; }

/* ============ FORMULÁRIOS (auth / mesa) ============ */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 800; margin-bottom: 5px; color: var(--pub-text2); text-transform: uppercase; letter-spacing: .3px; }
.field input, .field textarea {
    width: 100%; padding: 13px 14px; border-radius: 12px;
    background: #fafafa; border: 1.5px solid var(--pub-border);
    color: var(--pub-text); font-size: 15px; font-family: inherit;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--pub-brand); background: #fff; }
.field small { font-size: 11px; color: var(--pub-text2); display: block; margin-top: 4px; }

.auth-tabs { display: flex; background: #f2f2f2; border-radius: 999px; padding: 4px; margin-bottom: 16px; }
.auth-tab {
    flex: 1; text-align: center; padding: 9px; border-radius: 999px;
    font-weight: 900; font-size: 13px; color: var(--pub-text2); cursor: pointer; border: none;
    background: transparent;
}
.auth-tab.active { background: var(--pub-brand); color: #fff; }
.auth-form { display: none; }
.auth-form.active { display: block; }

.auth-nota {
    display: flex; gap: 8px; align-items: center; padding: 10px 13px; border-radius: 12px;
    background: #fff4e3; color: #a36207; font-size: 13px; margin-bottom: 14px;
}

/* ============ EXTRAS ============ */
.alerta-pub { padding: 11px 14px; border-radius: 12px; font-size: 13px; margin-bottom: 14px; }
.alerta-pub.erro { background: #fdecec; color: #c22a22; }
.alerta-pub.ok { background: #e2f7ef; color: #007a50; }

.publico-footer { text-align: center; padding: 24px; font-size: 10px; color: var(--pub-text2); }

.install-prompt {
    position: fixed; z-index: 500; left: 16px; right: 16px; bottom: 18px;
    display: flex; align-items: flex-start; gap: 13px; padding: 17px 46px 16px 16px;
    border: 1px solid rgba(255,255,255,.14); border-radius: 18px;
    color: #fff; background: #20242b; box-shadow: 0 12px 38px rgba(0,0,0,.3);
    opacity: 0; transform: translateY(14px); transition: opacity .2s ease, transform .2s ease;
}
.install-prompt[hidden] { display: none; }
.install-prompt.visible { opacity: 1; transform: translateY(0); }
.install-prompt-icon { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 13px; display: grid; place-items: center; background: var(--pub-brand); font-size: 18px; }
.install-prompt-copy { min-width: 0; }
.install-prompt-copy > strong { display: block; font-size: 14px; line-height: 1.3; }
.install-prompt-copy p { margin: 4px 0 10px; color: #c4c8cf; font-size: 12px; line-height: 1.45; }
.install-prompt-actions { display: flex; align-items: center; gap: 14px; }
.install-prompt-button { border: 0; border-radius: 9px; padding: 9px 12px; color: #fff; background: var(--pub-brand); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.install-prompt-later { border: 0; padding: 8px 0; color: #d7d9de; background: none; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.install-prompt-close { position: absolute; top: 7px; right: 10px; width: 32px; height: 32px; border: 0; color: #c4c8cf; background: none; font-size: 25px; line-height: 1; cursor: pointer; }
@media (min-width: 769px) { .install-prompt { left: auto; right: 24px; bottom: 24px; width: 370px; } }

.toast-pub {
    position: fixed; bottom: 140px; left: 50%; transform: translateX(-50%);
    background: #333; color: #fff; font-weight: 700; font-size: 13px;
    padding: 12px 20px; border-radius: 999px; z-index: 300; display: none;
    max-width: 88%; text-align: center; box-shadow: 0 4px 16px rgba(0,0,0,.3);
}
.toast-pub.erro { background: var(--pub-red); }
