/* ================================================================
   SISTEMA LANCHONETE — CSS ADMIN
   Charset: UTF-8 sem BOM — Português Brasileiro
   ================================================================ */

:root {
    --adm-primaria: #FF6B35;
    --adm-secundaria: #2C3E50;
    --adm-fundo: #F0F2F5;
    --adm-card: #FFFFFF;
    --adm-borda: #E4E6EA;
    --adm-texto: #1A1A2E;
    --adm-muted: #6C757D;
    --adm-sidebar-bg: #1A1A2E;
    --adm-sidebar-link: #A8B2C1;
    --adm-sidebar-active: #FF6B35;
    --adm-sidebar-hover: rgba(255,255,255,.08);
    --adm-sidebar-width: 240px;
    --adm-sidebar-collapsed: 64px;
    --adm-topbar-h: 60px;
    --radius: 10px;
    --sombra: 0 2px 8px rgba(0,0,0,.08);
    --sombra-md: 0 4px 16px rgba(0,0,0,.12);
    --trans: .2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body.admin-body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--adm-fundo);
    color: var(--adm-texto);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--adm-borda); border-radius: 4px; }

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

/* ── SIDEBAR ── */
.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--adm-sidebar-width);
    height: 100vh;
    background: var(--adm-sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--trans), transform var(--trans);
    overflow: hidden;
    box-shadow: var(--sombra-md);
}
.admin-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px;
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
    white-space: nowrap;
}
.admin-sidebar-brand i { font-size: 1.4rem; flex-shrink: 0; }
.admin-sidebar-toggle {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    margin-left: auto;
    padding: 4px;
    border-radius: 4px;
}
.admin-sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.admin-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,.2);
    flex-shrink: 0;
}
.admin-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}
.admin-user-nome { font-size: 0.88rem; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.admin-user-role { font-size: 0.72rem; color: var(--adm-sidebar-link); }

/* ── NAV ── */
.admin-nav { flex: 1; overflow-y: auto; padding: 8px 0; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.1) transparent; }
.admin-nav-group {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,.3);
    padding: 12px 16px 4px;
}
.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--adm-sidebar-link);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 0;
    transition: all var(--trans);
    white-space: nowrap;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
}
.admin-nav-link i { font-size: 1.05rem; width: 18px; text-align: center; flex-shrink: 0; }
.admin-nav-link:hover { background: var(--adm-sidebar-hover); color: #fff; }
.admin-nav-link.active {
    background: rgba(255,107,53,.15);
    color: var(--adm-sidebar-active);
    border-right: 3px solid var(--adm-sidebar-active);
}
.admin-nav-link.active i { color: var(--adm-sidebar-active); }
.admin-nav-link.text-danger { color: #e74c3c; }
.admin-nav-link.text-danger:hover { background: rgba(231,76,60,.1); color: #e74c3c; }
.admin-sidebar-footer {
    padding: 8px 0;
    border-top: 1px solid rgba(255,255,255,.08);
}

/* ── CONTENT ── */
.admin-content {
    margin-left: var(--adm-sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--trans);
    max-width: calc(100% - var(--adm-sidebar-width));
}

/* ── TOPBAR ── */
.admin-topbar {
    position: sticky;
    top: 0;
    height: var(--adm-topbar-h);
    background: var(--adm-card);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    z-index: 50;
    box-shadow: var(--sombra);
    border-bottom: 1px solid var(--adm-borda);
}
.admin-menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius);
    color: var(--adm-muted);
    transition: background var(--trans);
    display: none;
}
.admin-menu-toggle:hover { background: var(--adm-fundo); color: var(--adm-texto); }
.admin-page-title { font-size: 1.1rem; font-weight: 800; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-topbar-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.admin-notif-btn { position: relative; cursor: pointer; padding: 6px; color: var(--adm-muted); }

/* ── PAGE CONTENT ── */
.admin-page-content { padding: 20px; flex: 1; }

/* ── CARDS ── */
.card-admin {
    background: var(--adm-card);
    border-radius: var(--radius);
    box-shadow: var(--sombra);
    overflow: hidden;
    border: 1px solid var(--adm-borda);
    margin-bottom: 16px;
}
.card-admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--adm-borda);
    background: var(--adm-fundo);
}
.card-admin-header h3 {
    font-size: 0.95rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-admin-header h3 i { color: var(--adm-primaria); }
.card-admin-body { padding: 16px; }
.p-0 { padding: 0 !important; }

/* ── MÉTRICAS ── */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.metric-card {
    background: var(--adm-card);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--sombra);
    border: 1px solid var(--adm-borda);
    transition: transform var(--trans);
}
.metric-card:hover { transform: translateY(-2px); box-shadow: var(--sombra-md); }
.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.bg-primary-soft  { background: #e8f4ff; }
.bg-success-soft  { background: #e8f8f0; }
.bg-info-soft     { background: #e0f7fa; }
.bg-warning-soft  { background: #fff8e1; }
.bg-secondary-soft{ background: #f3f4f6; }
.text-primary  { color: #007bff; }
.text-success  { color: #28a745; }
.text-info     { color: #17a2b8; }
.text-warning  { color: #ffc107; }
.text-secondary{ color: #6c757d; }
.text-danger   { color: #dc3545; }
.metric-valor  { font-size: 1.3rem; font-weight: 800; line-height: 1; }
.metric-label  { font-size: 0.75rem; color: var(--adm-muted); margin-top: 2px; }

/* ── DASHBOARD GRID ── */
.dashboard-grid { display: flex; flex-direction: column; gap: 0; }
.dashboard-row-2 { display: grid; grid-template-columns: 1fr 360px; gap: 16px; margin-bottom: 16px; }
.dashboard-col-right { display: flex; flex-direction: column; }

/* ── PEDIDOS ── */
.pedido-linha {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--adm-borda);
    cursor: pointer;
    transition: background var(--trans);
}
.pedido-linha:hover { background: var(--adm-fundo); }
.pedido-linha:last-child { border: none; }
.pedido-linha-info { display: flex; align-items: center; gap: 12px; }
.pedido-numero { font-weight: 800; font-size: 0.82rem; color: var(--adm-primaria); font-family: monospace; }
.pedido-cliente { font-weight: 600; font-size: 0.88rem; }
.pedido-itens { font-size: 0.78rem; color: var(--adm-muted); }
.pedido-linha-meta { display: flex; align-items: center; gap: 12px; }
.badge-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}
.pedido-total { font-weight: 800; font-size: 0.9rem; white-space: nowrap; }

/* ── TOP PRODUTOS ── */
.top-produto-linha {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--adm-borda);
}
.top-produto-linha:last-child { border: none; }
.top-pos { width: 24px; height: 24px; background: var(--adm-primaria); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 800; flex-shrink: 0; }
.top-nome { flex: 1; font-size: 0.88rem; font-weight: 600; }
.top-qtd { font-size: 0.82rem; font-weight: 700; color: var(--adm-primaria); }

/* ── STATUS HOJE ── */
.status-hoje-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.status-hoje-item { display: flex; align-items: center; gap: 8px; }
.status-hoje-cor { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.status-hoje-info { display: flex; flex-direction: column; }
.status-hoje-label { font-size: 0.78rem; color: var(--adm-muted); }
.status-hoje-qtd { font-size: 1rem; font-weight: 800; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 32px 20px; color: var(--adm-muted); }
.empty-state i { display: block; margin-bottom: 8px; }

/* ── TABELA ── */
.tabela-admin { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.tabela-admin th { background: var(--adm-fundo); padding: 10px 12px; text-align: left; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--adm-muted); border-bottom: 2px solid var(--adm-borda); white-space: nowrap; }
.tabela-admin td { padding: 12px; border-bottom: 1px solid var(--adm-borda); vertical-align: middle; }
.tabela-admin tr:hover td { background: var(--adm-fundo); }
.tabela-admin tr:last-child td { border: none; }

/* ── BOTÕES ADMIN ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); font-family: inherit; font-weight: 700; font-size: 0.85rem; cursor: pointer; border: 2px solid transparent; transition: all var(--trans); text-decoration: none; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-primary { background: #007bff; color: #fff; border-color: #007bff; }
.btn-success { background: #28a745; color: #fff; border-color: #28a745; }
.btn-danger  { background: #dc3545; color: #fff; border-color: #dc3545; }
.btn-warning { background: #ffc107; color: #000; border-color: #ffc107; }
.btn-secondary{ background: #6c757d; color: #fff; border-color: #6c757d; }
.btn-outline-primary { background: transparent; color: #007bff; border-color: #007bff; }
.btn-outline-danger  { background: transparent; color: #dc3545; border-color: #dc3545; }
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── FORMULÁRIOS ADMIN ── */
.form-admin { max-width: 680px; }
.form-section { margin-bottom: 24px; }
.form-section-title { font-size: 0.9rem; font-weight: 800; color: var(--adm-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; padding-bottom: 6px; border-bottom: 2px solid var(--adm-borda); }
.campo-grupo { margin-bottom: 14px; }
.campo-label { display: block; font-size: 0.82rem; font-weight: 700; margin-bottom: 5px; color: var(--adm-texto); }
.campo-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--adm-borda);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--adm-texto);
    background: var(--adm-card);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color var(--trans);
}
.campo-input:focus { border-color: var(--adm-primaria); box-shadow: 0 0 0 3px rgba(255,107,53,.12); }
.campo-input::placeholder { color: var(--adm-muted); }
select.campo-input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236c757d' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.campo-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.campo-erro { font-size: 0.75rem; color: #dc3545; margin-top: 4px; display: block; }
.campo-hint { font-size: 0.75rem; color: var(--adm-muted); margin-top: 4px; display: block; }
.switch-label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.88rem; font-weight: 600; }
.switch-input { display: none; }
.switch-slider {
    width: 44px;
    height: 24px;
    background: var(--adm-borda);
    border-radius: 12px;
    position: relative;
    transition: background var(--trans);
    flex-shrink: 0;
}
.switch-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--trans);
    box-shadow: var(--sombra);
}
.switch-input:checked + .switch-slider { background: var(--adm-primaria); }
.switch-input:checked + .switch-slider::after { transform: translateX(20px); }

/* ── UPLOAD DRAG-DROP ── */
.upload-area {
    border: 2px dashed var(--adm-borda);
    border-radius: var(--radius);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--trans);
    background: var(--adm-fundo);
    position: relative;
}
.upload-area.dragover { border-color: var(--adm-primaria); background: rgba(255,107,53,.05); }
.upload-area:hover { border-color: var(--adm-primaria); }
.upload-area input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-area-icon { font-size: 2.5rem; color: var(--adm-muted); margin-bottom: 8px; }
.upload-area p { font-size: 0.88rem; color: var(--adm-muted); margin: 0; }
.upload-area span { color: var(--adm-primaria); font-weight: 700; }
.upload-preview { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.upload-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid var(--adm-borda);
}
.upload-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.upload-preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: rgba(220,53,69,.9);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── PROGRESSO UPLOAD ── */
.upload-progresso {
    margin-top: 8px;
    background: var(--adm-borda);
    border-radius: 4px;
    overflow: hidden;
    height: 6px;
    display: none;
}
.upload-progresso-barra {
    height: 100%;
    background: var(--adm-primaria);
    border-radius: 4px;
    transition: width .2s ease;
    width: 0;
}
.upload-progresso-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--adm-muted);
    margin-top: 4px;
}

/* ── PAGINAÇÃO ── */
.paginacao { display: flex; align-items: center; gap: 4px; justify-content: center; margin-top: 16px; }
.paginacao a, .paginacao span {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    border: 1.5px solid var(--adm-borda);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--adm-texto);
    transition: all var(--trans);
}
.paginacao a:hover { border-color: var(--adm-primaria); color: var(--adm-primaria); }
.paginacao .active span { background: var(--adm-primaria); border-color: var(--adm-primaria); color: #fff; }

/* ── KANBAN ── */
.kanban-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 16px; min-height: calc(100vh - 120px); }
.kanban-coluna { min-width: 280px; max-width: 300px; flex-shrink: 0; display: flex; flex-direction: column; }
.kanban-coluna-header {
    padding: 10px 14px;
    border-radius: var(--radius) var(--radius) 0 0;
    font-weight: 800;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.kanban-items { flex: 1; padding: 8px; min-height: 100px; display: flex; flex-direction: column; gap: 8px; background: var(--adm-fundo); border-radius: 0 0 var(--radius) var(--radius); border: 1px solid var(--adm-borda); border-top: none; }
.kanban-card {
    background: var(--adm-card);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--sombra);
    cursor: pointer;
    transition: transform var(--trans);
    border-left: 3px solid transparent;
}
.kanban-card:hover { transform: translateY(-2px); box-shadow: var(--sombra-md); }
.kanban-card-numero { font-size: 0.75rem; font-weight: 800; color: var(--adm-primaria); font-family: monospace; }
.kanban-card-cliente { font-weight: 700; font-size: 0.88rem; margin: 4px 0; }
.kanban-card-meta { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--adm-muted); margin-top: 4px; }

/* ── ALERTA ADMIN ── */
.alerta { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--radius); font-weight: 600; font-size: 0.88rem; }
.alerta-sucesso { background: #d4edda; color: #155724; border-left: 4px solid #28a745; }
.alerta-erro    { background: #f8d7da; color: #721c24; border-left: 4px solid #dc3545; }
.alerta-info    { background: #d1ecf1; color: #0c5460; border-left: 4px solid #17a2b8; }

/* ── TOAST ── */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    animation: toastIn .3s ease, toastOut .3s ease 2.7s forwards;
    pointer-events: all;
    box-shadow: var(--sombra-md);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 220px;
    max-width: 360px;
}
.toast-sucesso { background: #d4edda; color: #155724; border-left: 4px solid #28a745; }
.toast-erro    { background: #f8d7da; color: #721c24; border-left: 4px solid #dc3545; }
.toast-info    { background: #d1ecf1; color: #0c5460; border-left: 4px solid #17a2b8; }
.toast-aviso   { background: #fff3cd; color: #856404; border-left: 4px solid #ffc107; }
@keyframes toastIn  { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(20px); } }

/* ── SPINNER ── */
.spinner { width: 32px; height: 32px; border: 3px solid var(--adm-borda); border-top-color: var(--adm-primaria); border-radius: 50%; animation: spin .7s linear infinite; margin: 0 auto; }
.spinner-sm { width: 18px; height: 18px; border: 2px solid var(--adm-borda); border-top-color: var(--adm-primaria); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── UTILITÁRIOS ── */
.w-100 { width: 100%; }
.text-center { text-align: center; }
.text-muted { color: var(--adm-muted); }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.fs-1 { font-size: 2.5rem; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.ms-auto { margin-left: auto; }
.badge { padding: 3px 8px; border-radius: 20px; font-size: 0.72rem; font-weight: 700; }
.badge-success { background: #d4edda; color: #155724; }
.badge-danger  { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info    { background: #d1ecf1; color: #0c5460; }
.badge-secondary { background: #e9ecef; color: #495057; }

/* ── RESPONSIVO ── */
@media (max-width: 992px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.ativo { transform: translateX(0); }
    .admin-content { margin-left: 0; max-width: 100%; }
    .admin-menu-toggle { display: flex !important; }
    .d-md-none { display: block; }
    .dashboard-row-2 { grid-template-columns: 1fr; }
    .metrics-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 576px) {
    .metrics-row { grid-template-columns: 1fr 1fr; }
    .campo-row { grid-template-columns: 1fr; }
    .admin-page-content { padding: 12px; }
}
