/*
 * Tablify Design System v1.0 — folha central.
 * Fonte de verdade documentada em docs/padroes-layout.md.
 *
 * Este arquivo reúne SOMENTE as regras que já eram idênticas,
 * copiadas e coladas, em dezenas de templates (tokens, reset,
 * botões, alert, estrutura base de tabela/lista e o modal de
 * exclusão). Ajustes finos por página (paddings, tamanhos,
 * decorações pontuais) continuam no <style> local de cada
 * template, sobrescrevendo estas regras normalmente pela ordem
 * de carregamento no <head> — nada aqui deve mudar a
 * renderização de nenhuma tela existente.
 */

:root {
    --brand-dark:         #1a1f2e;
    --brand-orange:       #FF6B00;
    --brand-orange-hover: #e05e00;
    --brand-orange-light: #fff3ea;
    --brand-orange-border:#ffd1b0;

    --bg:           #f6f8fa;
    --surface:      #ffffff;
    --border:       rgba(0,0,0,.08);
    --border-focus: #FF6B00;
    --text:         #2d3748;
    --text-light:   #ffffff;
    --text-muted:   #6e7681;
    --radius:       16px;
    --radius-sm:    10px;
}

/*
 * Tema escuro — ativado via atributo data-theme="dark" em <html>,
 * definido por static/js/theme.js (localStorage + prefers-color-scheme).
 * --brand-dark, --brand-orange, --brand-orange-hover, --border-focus,
 * --text-light, --radius e --radius-sm não mudam: já servem nos dois
 * temas (headers/thead escuros e o laranja de marca funcionam em
 * ambos os fundos).
 */
:root[data-theme="dark"] {
    --brand-orange-light: rgba(255,107,0,.16);
    --brand-orange-border:rgba(255,107,0,.4);

    --bg:         #12141c;
    --surface:    #1b1e29;
    --border:     rgba(255,255,255,.08);
    --text:       #e8eaf0;
    --text-muted: #8b93a7;
}

/* ── Reset base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ── Alert flash ── */
.alert-modern {
    border-radius: var(--radius-sm);
    border: 1px solid;
    font-size: .875rem;
    font-weight: 600;
    padding: .8rem 1.1rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: 1.25rem;
}
.alert-modern.success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-modern.error   { background: #fff5f5; border-color: #fecaca; color: #b91c1c; }

/* ── Botões — form card (btn-submit / btn-ghost) ── */
.btn-submit {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    background: var(--brand-orange);
    color: var(--text-light);
    border: none;
    border-radius: 50px;
    padding: .6rem 1.5rem;
    font-family: 'Inter', sans-serif;
    font-size: .85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, transform .15s;
    white-space: nowrap;
}
.btn-submit:hover { background: var(--brand-orange-hover); transform: translateY(-1px); }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    padding: .55rem 1.1rem;
    font-family: 'Inter', sans-serif;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    white-space: nowrap;
}
.btn-ghost:hover {
    border-color: rgba(0,0,0,.18);
    color: var(--text);
    background: #f0f1f3;
}

/* ── Botões — list page (btn-pill) ── */
.btn-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border-radius: 50px;
    padding: .5rem 1.1rem;
    font-family: 'Inter', sans-serif;
    font-size: .8rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    border: 1.5px solid transparent;
    transition: opacity .15s, transform .15s;
}
.btn-pill:hover { transform: translateY(-1px); }
.btn-pill-primary { background: var(--brand-orange); color: var(--text-light); }
.btn-pill-primary:hover { background: var(--brand-orange-hover); color: var(--text-light); }
.btn-pill-outline { background: var(--surface); color: var(--text); border-color: rgba(0,0,0,.12); }
.btn-pill-outline:hover { background: #f0f1f3; color: var(--text); }

/* ── Input com foco laranja ── */
.field-input:focus,
.field-select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(255,107,0,.13);
}

/* ── Form card — estrutura base (form-card-header/body, ver seção 3) ──
 * Referência canônica: entregadores/form.html, clientes/form.html
 * (variante "ícone laranja" — escolhida como padrão único em 2026-07-07
 * por já ser majoritária, 7 de 13 formulários). width/max-width e
 * paddings finos continuam locais por página.
 */
.form-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 4px 24px rgba(0,0,0,.07);
    overflow: hidden;
}
.form-card-header {
    background: var(--brand-dark);
    padding: 1.75rem 2rem 1.5rem;
    position: relative;
    overflow: hidden;
}
.form-card-header::after {
    content: '';
    position: absolute;
    right: -24px; top: -24px;
    width: 120px; height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,.06);
}
.form-card-header::before {
    content: '';
    position: absolute;
    left: -16px; bottom: -32px;
    width: 90px; height: 90px;
    border-radius: 50%;
    background: rgba(255,107,0,.12);
}
.header-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: rgba(255,107,0,.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    color: var(--brand-orange);
    margin-bottom: .85rem;
    position: relative;
    z-index: 1;
}
.form-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -.03em;
    color: var(--text-light);
    line-height: 1.1;
    position: relative;
    z-index: 1;
}
.form-subtitle {
    font-size: .78rem;
    font-weight: 500;
    color: rgba(255,255,255,.6);
    margin-top: .3rem;
    position: relative;
    z-index: 1;
}
.form-card-body { padding: 1.75rem 2rem 2rem; }
.form-divider {
    height: 1px;
    background: var(--border);
    margin: 1.5rem 0;
}
.actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

/* ── List page — table-card (ver seção 4) ──
 * Referência canônica: cardapio/lista.html, clientes/lista.html.
 */
.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    overflow: hidden;
}
.table-card-header {
    padding: 1rem 1.4rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    background: var(--brand-dark);
    color: var(--text-light);
}
.table-card-title { font-size: .9rem; font-weight: 800; letter-spacing: -.01em; }
.table-card-count { font-size: .78rem; color: rgba(255,255,255,.5); font-weight: 600; }

.btn-action-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    background: transparent;
    border: 1.5px solid rgba(0,0,0,.1);
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
}
.btn-action-icon:hover { background: #f0f1f3; border-color: rgba(0,0,0,.18); color: var(--text); }
.btn-action-icon.danger:hover { background: #fff5f5; border-color: #fecaca; color: #b91c1c; }

.empty-row td { text-align: center; padding: 3rem 1rem; color: var(--text-muted); font-size: .88rem; }
.empty-row i { font-size: 2rem; display: block; margin-bottom: .6rem; opacity: .3; }

/* ── Tabela — estrutura base ── */
.table-modern { width: 100%; border-collapse: collapse; }
.table-modern thead tr { background: var(--brand-dark); }

/* ── Modal de exclusão (Bootstrap modal — nunca confirm()) ──
 * Uso: ver docs/padroes-layout.md seção 5.
 * Classes usadas no lugar de style="" inline repetido nos
 * templates de listagem/detalhe com ação de excluir.
 */
.delete-modal-content {
    border: none;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0,0,0,.18);
}
.delete-modal-header {
    background: linear-gradient(135deg, #e63946, #ff6b6b);
    padding: 1.75rem 1.5rem 1.25rem;
    text-align: center;
}
.delete-modal-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .75rem;
}
.delete-modal-icon i { font-size: 1.4rem; color: #fff; }
.delete-modal-title {
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    margin: 0;
    letter-spacing: -.02em;
}
.delete-modal-body { padding: 1.5rem 1.75rem; text-align: center; }
.delete-modal-body p {
    font-family: 'Inter', sans-serif;
    font-size: .9rem;
    font-weight: 500;
    color: #4b5563;
    margin: 0;
}
.delete-modal-body strong { color: #2d3748; }
.delete-modal-hint {
    font-family: 'Inter', sans-serif;
    font-size: .78rem;
    color: #9ca3af;
    margin: .5rem 0 0;
}
.delete-modal-actions {
    padding: .25rem 1.75rem 1.5rem;
    display: flex;
    gap: .6rem;
    justify-content: center;
}
.delete-modal-btn-cancel {
    font-family: 'Inter', sans-serif;
    font-size: .82rem;
    font-weight: 700;
    border-radius: 50px;
    padding: .5rem 1.4rem;
    border: 1.5px solid rgba(0,0,0,.12);
    background: #fff;
    color: #374151;
    cursor: pointer;
}
.delete-modal-btn-confirm {
    font-family: 'Inter', sans-serif;
    font-size: .82rem;
    font-weight: 700;
    border-radius: 50px;
    padding: .5rem 1.4rem;
    border: none;
    background: linear-gradient(135deg, #e63946, #ff6b6b);
    color: #fff;
    cursor: pointer;
}
