/* ============================================================
   CASHLESS EVENTO — CSS Global (Responsive)
   ============================================================ */

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

:root {
    --cor-primaria:  #2563eb;
    --cor-hover:     #1d4ed8;
    --cor-sucesso:   #16a34a;
    --cor-perigo:    #dc2626;
    --cor-aviso:     #d97706;
    --cor-sidebar:   #1e293b;
    --cor-sidebar2:  #0f172a;
    --cor-fundo:     #f1f5f9;
    --cor-branco:    #ffffff;
    --cor-cinza:     #64748b;
    --cor-borda:     #e2e8f0;
    --cor-texto:     #1e293b;
    --raio:          8px;
    --raio-lg:       12px;
    --sombra:        0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --sombra-md:     0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --sidebar-w:     240px;
    --topbar-h:      60px;
    --transition:    .2s ease;
}

html { font-size: 15px; }
body { font-family: 'Inter', 'Segoe UI', Arial, sans-serif; background: var(--cor-fundo); color: var(--cor-texto); min-height: 100vh; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

/* ── ÍCONES FEATHER ──────────────────────────────────────── */
.icon { display: inline-flex; align-items: center; justify-content: center; }
.icon svg { width: 18px; height: 18px; stroke-width: 1.75; }
.icon-sm svg { width: 15px; height: 15px; }
.icon-lg svg { width: 22px; height: 22px; }

/* ── LOGIN ───────────────────────────────────────────────── */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #1d4ed8 100%);
    padding: 1rem;
}
.login-box {
    background: var(--cor-branco);
    padding: 2.5rem;
    border-radius: var(--raio-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    width: 100%; max-width: 420px;
}
.login-logo {
    display: flex; align-items: center; justify-content: center;
    gap: .6rem; margin-bottom: .5rem;
    color: var(--cor-primaria);
}
.login-logo svg { width: 32px; height: 32px; }
.login-logo h1 { font-size: 1.5rem; font-weight: 700; }
.login-subtitulo { text-align: center; color: var(--cor-cinza); margin-bottom: 2rem; font-size: .875rem; }

/* ── LAYOUT ──────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--cor-sidebar);
    color: #fff;
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 200;
    transition: transform var(--transition);
}
.sidebar-logo {
    display: flex; align-items: center; gap: .75rem;
    padding: 1.1rem 1.2rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    min-height: var(--topbar-h);
}
.sidebar-logo svg { width: 24px; height: 24px; color: #60a5fa; flex-shrink: 0; }
.sidebar-logo-text { display: flex; flex-direction: column; }
.sidebar-logo-text strong { font-size: .95rem; color: #fff; letter-spacing: .3px; }
.sidebar-logo-text span { font-size: .72rem; color: #94a3b8; }

.sidebar-nav { padding: .75rem 0; flex: 1; overflow-y: auto; }
.sidebar-section { padding: .5rem 1rem .2rem; font-size: .68rem; text-transform: uppercase; letter-spacing: 1px; color: #475569; }
.sidebar-nav a {
    display: flex; align-items: center; gap: .75rem;
    padding: .65rem 1.2rem;
    color: #94a3b8; font-size: .875rem;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    border-left: 3px solid transparent;
    position: relative;
}
.sidebar-nav a svg { width: 17px; height: 17px; flex-shrink: 0; }
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #e2e8f0; border-left-color: rgba(96,165,250,.4); }
.sidebar-nav a.active { background: rgba(37,99,235,.2); color: #93c5fd; border-left-color: #3b82f6; }

.sidebar-footer {
    padding: .85rem 1.2rem;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex; align-items: center; gap: .6rem;
    font-size: .82rem; color: #94a3b8;
}
.sidebar-footer svg { width: 16px; height: 16px; }

/* Overlay mobile */
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.5); z-index: 199;
}
.sidebar-overlay.visible { display: block; }

/* ── MAIN CONTENT ────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
    background: var(--cor-branco);
    border-bottom: 1px solid var(--cor-borda);
    height: var(--topbar-h);
    padding: 0 1.5rem;
    display: flex; align-items: center; justify-content: space-between;
    box-shadow: var(--sombra); position: sticky; top: 0; z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: .8rem; }
.topbar-title { font-size: 1rem; font-weight: 600; color: var(--cor-texto); }

.hamburger {
    display: none; background: none; border: none; cursor: pointer;
    padding: .4rem; border-radius: var(--raio); color: var(--cor-cinza);
    transition: background var(--transition);
}
.hamburger:hover { background: var(--cor-fundo); }
.hamburger svg { width: 22px; height: 22px; }

.topbar-right { display: flex; align-items: center; gap: 1rem; }
.topbar-user { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--cor-cinza); }
.topbar-user svg { width: 16px; height: 16px; }
.btn-logout {
    display: flex; align-items: center; gap: .35rem;
    font-size: .82rem; color: var(--cor-perigo);
    padding: .3rem .65rem; border-radius: var(--raio);
    transition: background var(--transition);
}
.btn-logout:hover { background: #fef2f2; }
.btn-logout svg { width: 15px; height: 15px; }

/* ── PAGE BODY ───────────────────────────────────────────── */
.page-body { padding: 1.5rem; flex: 1; }

/* ── ALERTAS ─────────────────────────────────────────────── */
.alert {
    display: flex; align-items: flex-start; gap: .6rem;
    padding: .75rem 1rem; border-radius: var(--raio);
    margin-bottom: 1.2rem; font-size: .875rem;
}
.alert svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ── CARDS STAT ──────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--cor-branco); border-radius: var(--raio-lg);
    padding: 1.2rem 1.4rem; box-shadow: var(--sombra);
    display: flex; align-items: flex-start; gap: 1rem;
}
.stat-icon {
    width: 44px; height: 44px; border-radius: var(--raio);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.azul   { background: #dbeafe; color: #2563eb; }
.stat-icon.verde  { background: #dcfce7; color: #16a34a; }
.stat-icon.laranja{ background: #ffedd5; color: #ea580c; }
.stat-icon.roxo   { background: #ede9fe; color: #7c3aed; }
.stat-icon.cinza  { background: #f1f5f9; color: #475569; }
.stat-info .label { font-size: .75rem; color: var(--cor-cinza); text-transform: uppercase; letter-spacing: .5px; margin-bottom: .2rem; }
.stat-info .valor { font-size: 1.5rem; font-weight: 700; color: var(--cor-texto); }

/* ── CARD ────────────────────────────────────────────────── */
.card { background: var(--cor-branco); border-radius: var(--raio-lg); box-shadow: var(--sombra); margin-bottom: 1.2rem; }
.card-header {
    padding: .9rem 1.3rem; border-bottom: 1px solid var(--cor-borda);
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 600; font-size: .9rem; gap: .5rem;
}
.card-header-left { display: flex; align-items: center; gap: .5rem; }
.card-header-left svg { width: 17px; height: 17px; color: var(--cor-cinza); }
.card-body { padding: 1.3rem; }

/* ── FORMULÁRIOS ─────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: .4rem; font-size: .83rem; font-weight: 500; color: #374151; }
.form-control {
    width: 100%; padding: .55rem .8rem;
    border: 1px solid var(--cor-borda); border-radius: var(--raio);
    font-size: .9rem; background: #fff; color: var(--cor-texto);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus { outline: none; border-color: var(--cor-primaria); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-control::placeholder { color: #9ca3af; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.form-hint { font-size: .76rem; color: var(--cor-cinza); margin-top: .3rem; }
.input-group { display: flex; gap: .5rem; }
.input-group .form-control { flex: 1; }

/* ── BOTÕES ──────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .5rem 1rem; border: none; border-radius: var(--raio);
    font-size: .875rem; font-weight: 500; cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition), transform .1s;
    white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 15px; height: 15px; }
.btn-primary  { background: var(--cor-primaria); color: #fff; }
.btn-primary:hover  { background: var(--cor-hover); }
.btn-success  { background: var(--cor-sucesso);  color: #fff; }
.btn-success:hover  { background: #15803d; }
.btn-danger   { background: var(--cor-perigo);   color: #fff; }
.btn-danger:hover   { background: #b91c1c; }
.btn-warning  { background: #f59e0b; color: #fff; }
.btn-warning:hover  { background: var(--cor-aviso); }
.btn-outline  { background: #fff; color: var(--cor-cinza); border: 1px solid var(--cor-borda); }
.btn-outline:hover  { background: var(--cor-fundo); }
.btn-ghost    { background: transparent; color: var(--cor-cinza); }
.btn-ghost:hover    { background: var(--cor-fundo); }
.btn-sm  { padding: .3rem .65rem; font-size: .8rem; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ── TABELAS ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .855rem; }
table thead th {
    background: #f8fafc; padding: .65rem 1rem;
    text-align: left; font-weight: 600; font-size: .78rem;
    text-transform: uppercase; letter-spacing: .4px; color: var(--cor-cinza);
    border-bottom: 2px solid var(--cor-borda); white-space: nowrap;
}
table tbody td { padding: .7rem 1rem; border-bottom: 1px solid #f1f5f9; color: var(--cor-texto); }
table tbody tr:last-child td { border-bottom: none; }
table tbody tr:hover { background: #f8fafc; }
.td-actions { display: flex; gap: .4rem; align-items: center; }

/* ── BADGE ───────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .22rem .6rem; border-radius: 20px;
    font-size: .72rem; font-weight: 600;
}
.badge svg { width: 11px; height: 11px; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger  { background: #fef2f2; color: #b91c1c; }
.badge-warning { background: #fffbeb; color: #92400e; }
.badge-info    { background: #eff6ff; color: #1d4ed8; }
.badge-cinza   { background: #f1f5f9; color: #475569; }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(15,23,42,.55); z-index: 300;
    align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.aberto { display: flex; }
.modal-box {
    background: #fff; border-radius: var(--raio-lg); width: 100%; max-width: 500px;
    box-shadow: 0 25px 50px rgba(0,0,0,.25);
    animation: slideUp .2s ease;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--cor-borda);
}
.modal-header h3 { font-size: .95rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; }
.modal-header h3 svg { width: 18px; height: 18px; color: var(--cor-cinza); }
.btn-modal-close { background: none; border: none; cursor: pointer; color: var(--cor-cinza); padding: .2rem; border-radius: 4px; }
.btn-modal-close:hover { background: var(--cor-fundo); }
.btn-modal-close svg { width: 18px; height: 18px; }
.modal-body { padding: 1.4rem; }
.modal-footer { display: flex; gap: .7rem; justify-content: flex-end; padding: 1rem 1.4rem; border-top: 1px solid var(--cor-borda); }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── PULSEIRA INFO ───────────────────────────────────────── */
.pulseira-card {
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    color: #fff; border-radius: var(--raio-lg); padding: 1.2rem 1.4rem;
    margin: .8rem 0; display: flex; align-items: center; gap: 1rem;
}
.pulseira-card-icon { width: 44px; height: 44px; background: rgba(255,255,255,.15); border-radius: var(--raio); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pulseira-card-icon svg { width: 22px; height: 22px; }
.pulseira-card-info { flex: 1; min-width: 0; }
.pulseira-card-nome { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pulseira-card-codigo { font-size: .72rem; opacity: .7; font-family: monospace; margin-top: .15rem; }
.pulseira-card-saldo { text-align: right; flex-shrink: 0; }
.pulseira-card-saldo .label { font-size: .7rem; opacity: .7; }
.pulseira-card-saldo .valor { font-size: 1.3rem; font-weight: 700; }

/* ── QR CODE ─────────────────────────────────────────────── */
#qr-reader { width: 100%; border-radius: var(--raio); overflow: hidden; }
.qr-container { display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.qr-hint { font-size: .82rem; color: var(--cor-cinza); text-align: center; }

/* ── PRODUTOS GRID ───────────────────────────────────────── */
.produtos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: .7rem;
    max-height: 380px; overflow-y: auto;
    padding-right: .2rem;
}
.produto-card {
    border: 2px solid var(--cor-borda); border-radius: var(--raio);
    padding: .85rem .7rem; text-align: center; cursor: pointer;
    transition: border-color var(--transition), background var(--transition), transform .1s;
    user-select: none;
}
.produto-card:hover { border-color: var(--cor-primaria); background: #eff6ff; transform: translateY(-2px); }
.produto-card:active { transform: scale(.97); }
.produto-card .pc-icon { margin-bottom: .5rem; color: var(--cor-cinza); }
.produto-card .pc-icon svg { width: 20px; height: 20px; }
.produto-card .pc-nome { font-weight: 600; font-size: .82rem; margin-bottom: .3rem; color: var(--cor-texto); }
.produto-card .pc-preco { color: var(--cor-sucesso); font-size: .8rem; font-weight: 600; }
.produto-card .pc-stock { color: var(--cor-cinza); font-size: .72rem; margin-top: .15rem; }
.produto-card.sem-stock { opacity: .5; cursor: not-allowed; }

/* ── CARRINHO ────────────────────────────────────────────── */
.carrinho-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: .6rem 0; border-bottom: 1px solid var(--cor-borda);
    gap: .5rem; font-size: .875rem;
}
.carrinho-item:last-child { border-bottom: none; }
.carrinho-item-info .nome { font-weight: 500; }
.carrinho-item-info .qty { font-size: .78rem; color: var(--cor-cinza); }
.carrinho-item-right { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.carrinho-item-right .subtotal { font-weight: 600; font-size: .875rem; }
.carrinho-total-bar {
    display: flex; justify-content: space-between; align-items: center;
    font-weight: 700; font-size: 1rem;
    margin-top: .8rem; padding-top: .8rem;
    border-top: 2px solid var(--cor-borda);
}

/* ── GRID LAYOUTS ────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

/* ── DIVIDER ─────────────────────────────────────────────── */
.divider { height: 1px; background: var(--cor-borda); margin: 1rem 0; }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
    text-align: center; padding: 2.5rem 1rem; color: var(--cor-cinza);
}
.empty-state svg { width: 40px; height: 40px; margin-bottom: .8rem; opacity: .4; }
.empty-state p { font-size: .9rem; }

/* ── TABS ────────────────────────────────────────────────── */
.tabs { display: flex; gap: .3rem; border-bottom: 2px solid var(--cor-borda); margin-bottom: 1.2rem; }
.tab-btn {
    display: flex; align-items: center; gap: .4rem;
    padding: .6rem 1rem; background: none; border: none; cursor: pointer;
    font-size: .875rem; color: var(--cor-cinza); border-radius: var(--raio) var(--raio) 0 0;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: color var(--transition), border-color var(--transition);
}
.tab-btn svg { width: 15px; height: 15px; }
.tab-btn.active { color: var(--cor-primaria); border-bottom-color: var(--cor-primaria); font-weight: 600; }
.tab-btn:hover:not(.active) { color: var(--cor-texto); background: var(--cor-fundo); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── MODAL SUCESSO ───────────────────────────────────────── */
.success-modal-icon {
    width: 64px; height: 64px; background: #dcfce7; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1rem;
}
.success-modal-icon svg { width: 32px; height: 32px; color: var(--cor-sucesso); }

/* ══════════════════════════════════════════════════════════
   RESPONSIVO
══════════════════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Mobile */
@media (max-width: 768px) {
    html { font-size: 14px; }

    /* Sidebar como drawer */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 4px 0 20px rgba(0,0,0,.3);
    }
    .sidebar.open { transform: translateX(0); }

    /* Main sem margem */
    .main-content { margin-left: 0; }

    /* Mostrar hamburger */
    .hamburger { display: flex; }

    /* Page body */
    .page-body { padding: 1rem; }

    /* Grids para 1 coluna */
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }

    /* Form row */
    .form-row { grid-template-columns: 1fr; }

    /* Tabela */
    table thead th, table tbody td { padding: .55rem .7rem; font-size: .8rem; }

    /* Topbar */
    .topbar { padding: 0 1rem; }
    .topbar-user span { display: none; }

    /* Modal */
    .modal-overlay { padding: .5rem; align-items: flex-end; }
    .modal-box { border-radius: var(--raio-lg) var(--raio-lg) 0 0; max-height: 90vh; overflow-y: auto; }

    /* Produtos grid */
    .produtos-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); max-height: 280px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .login-box { padding: 1.8rem 1.2rem; }
    .card-body { padding: 1rem; }
}
