/*
 * MALIM — tema do painel (nov/2026).
 *
 * Visual inspirado em painéis administrativos modernos (menu lateral escuro,
 * topo branco, cartões de sombra leve, indicadores com ícone em círculo
 * colorido). Escrito do zero para o MALIM: nenhum arquivo de tema de
 * terceiros foi copiado.
 *
 * POR QUE FORA DO VITE
 * O CSS principal (resources/css/app.css) passa pelo Vite, que precisa do
 * Node para recompilar — e nem a hospedagem nem a máquina de deploy têm Node.
 * Este arquivo é servido direto de public/ e carregado DEPOIS do CSS do Vite,
 * então sobrepõe o que precisar sem exigir build. Sobe por FTP como qualquer
 * outro arquivo.
 *
 * COMO ESTÁ ORGANIZADO
 * 1. Cores e medidas (variáveis) — trocar a paleta é mexer só aqui.
 * 2. Estrutura: menu lateral, topo, área de conteúdo.
 * 3. Componentes do Bootstrap: cartões, botões, tabelas, formulários…
 * 4. Peças do MALIM: indicadores (stat-card), faixa de título.
 */

/* ─── 1. Cores e medidas ──────────────────────────────────────────── */
:root {
    --tema-primaria: #6559cc;
    --tema-primaria-rgb: 101, 89, 204;
    --tema-primaria-escura: #5246b8;

    --tema-menu-fundo: #1b1d2b;
    --tema-menu-texto: #abb9e8;
    --tema-menu-secao: #6d7aa3;
    --tema-menu-ativo-fundo: rgba(255, 255, 255, .06);

    --tema-fundo: #f3f3f9;
    --tema-texto: #212529;
    --tema-texto-suave: #878a99;
    --tema-borda: #e9ebec;
    --tema-sombra: 0 1px 2px rgba(56, 65, 74, .15);
    --tema-sombra-alta: 0 5px 18px rgba(56, 65, 74, .12);
    --tema-raio: .5rem;

    /* Bootstrap lê estas: utilitários (bg-*, text-*, border-*) seguem o tema. */
    --bs-primary: var(--tema-primaria);
    --bs-primary-rgb: var(--tema-primaria-rgb);
    --bs-success: #0ab39c;
    --bs-success-rgb: 10, 179, 156;
    --bs-info: #299cdb;
    --bs-info-rgb: 41, 156, 219;
    --bs-warning: #f7b84b;
    --bs-warning-rgb: 247, 184, 75;
    --bs-danger: #f06548;
    --bs-danger-rgb: 240, 101, 72;
    --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --bs-body-font-size: .875rem;
    --bs-body-color: var(--tema-texto);
    --bs-secondary-color: var(--tema-texto-suave);
    --bs-border-color: var(--tema-borda);
    --bs-link-color: var(--tema-primaria);
    --bs-link-color-rgb: var(--tema-primaria-rgb);
    --bs-link-hover-color: var(--tema-primaria-escura);

    --malim-sidebar-width: 250px;
    --malim-topbar-height: 70px;
}

body {
    background: var(--tema-fundo);
    font-family: var(--bs-body-font-family);
    font-size: var(--bs-body-font-size);
    color: var(--tema-texto);
    -webkit-font-smoothing: antialiased;
}

.text-muted { color: var(--tema-texto-suave) !important; }

/* ─── 2. Estrutura ────────────────────────────────────────────────── */

/* Menu lateral.
 * --faixa-acesso é a altura da faixa "Você está acessando como cliente"
 * (medida no layout); sem a faixa vale zero. Sem este recuo, a faixa,
 * fixa no topo, cobria a logo. */
.sidebar {
    top: var(--faixa-acesso, 0px);
    height: calc(100vh - var(--faixa-acesso, 0px));
    background: var(--tema-menu-fundo);
    color: var(--tema-menu-texto);
    box-shadow: 0 2px 4px rgba(15, 34, 58, .12);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .15) transparent;
}

.sidebar-brand {
    height: var(--malim-topbar-height);
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: .04em;
    border-bottom: 0;
    padding: 0 1.5rem;
}

.sidebar-brand i {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--tema-primaria), #8f7cf0);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    margin-right: .65rem !important;
}

.sidebar .nav-section {
    color: var(--tema-menu-secao);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .09em;
    padding: 1.1rem 1.5rem .45rem;
}

.sidebar .nav-link {
    color: var(--tema-menu-texto);
    margin: 0 .75rem;
    padding: .62rem .85rem;
    font-size: .875rem;
    font-weight: 500;
    border-radius: .375rem;
    gap: .75rem;
}

.sidebar .nav-link i {
    font-size: 1.05rem;
    width: 1.25rem;
    text-align: center;
    opacity: .85;
}

.sidebar .nav-link:hover {
    background: transparent;
    color: #fff;
}

.sidebar .nav-link.active {
    background: var(--tema-menu-ativo-fundo);
    color: #fff;
    position: relative;
}

/* Marca do item ativo: um traço na cor do tema à esquerda. */
.sidebar .nav-link.active::before {
    content: '';
    position: absolute;
    left: -.75rem;
    top: 20%;
    bottom: 20%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--tema-primaria);
}

.sidebar .nav-link.active i { opacity: 1; color: #fff; }

/* Topo */
.topbar {
    top: var(--faixa-acesso, 0px);
    height: var(--malim-topbar-height);
    background: #fff;
    border-bottom: 0;
    box-shadow: 0 1px 2px rgba(56, 65, 74, .08);
    padding: 0 1.5rem;
}

.topbar .dropdown-toggle::after { margin-left: .5rem; color: var(--tema-texto-suave); }

/* Conteúdo */
.main-content {
    background: var(--tema-fundo);
    padding: 1.5rem;
    min-height: calc(100vh - var(--malim-topbar-height));
}

/* ─── 3. Componentes ──────────────────────────────────────────────── */

/* Cartões: sem borda, sombra leve. Os que já têm shadow-sm ficam iguais. */
.card {
    border: 0;
    border-radius: var(--tema-raio);
    box-shadow: var(--tema-sombra);
    margin-bottom: 0;
}

.card.border, .card[class*="border-"] { border-width: 1px; }

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--tema-borda);
    padding: 1rem 1.25rem;
}

.card-header h5, .card-header h6, .card-header .card-title {
    font-size: .95rem;
    font-weight: 600;
    margin-bottom: 0;
}

.card-body { padding: 1.25rem; }

/* Botões */
.btn { font-weight: 500; border-radius: .375rem; font-size: .875rem; }

.btn-primary {
    --bs-btn-bg: var(--tema-primaria);
    --bs-btn-border-color: var(--tema-primaria);
    --bs-btn-hover-bg: var(--tema-primaria-escura);
    --bs-btn-hover-border-color: var(--tema-primaria-escura);
    --bs-btn-active-bg: var(--tema-primaria-escura);
    --bs-btn-active-border-color: var(--tema-primaria-escura);
    --bs-btn-disabled-bg: var(--tema-primaria);
    --bs-btn-disabled-border-color: var(--tema-primaria);
}

.btn-outline-primary {
    --bs-btn-color: var(--tema-primaria);
    --bs-btn-border-color: var(--tema-primaria);
    --bs-btn-hover-bg: var(--tema-primaria);
    --bs-btn-hover-border-color: var(--tema-primaria);
    --bs-btn-active-bg: var(--tema-primaria);
    --bs-btn-active-border-color: var(--tema-primaria);
}

.btn-success {
    --bs-btn-bg: #0ab39c;
    --bs-btn-border-color: #0ab39c;
    --bs-btn-hover-bg: #099885;
    --bs-btn-hover-border-color: #099885;
    --bs-btn-active-bg: #099885;
    --bs-btn-disabled-bg: #0ab39c;
    --bs-btn-disabled-border-color: #0ab39c;
}

.btn-danger {
    --bs-btn-bg: #f06548;
    --bs-btn-border-color: #f06548;
    --bs-btn-hover-bg: #cc563d;
    --bs-btn-hover-border-color: #cc563d;
}

/* Formulários */
.form-control, .form-select {
    border-color: #ced4da;
    border-radius: .375rem;
    font-size: .875rem;
}

.form-control:focus, .form-select:focus {
    border-color: rgba(var(--tema-primaria-rgb), .55);
    box-shadow: 0 0 0 .2rem rgba(var(--tema-primaria-rgb), .12);
}

.form-check-input:checked {
    background-color: var(--tema-primaria);
    border-color: var(--tema-primaria);
}

.form-label { font-weight: 500; color: #495057; }

/* Tabelas: cabeçalho discreto, linhas espaçadas. */
.table { --bs-table-color: var(--tema-texto); font-size: .875rem; }

.table > thead > tr > th,
.table-light {
    --bs-table-bg: #f3f6f9;
    color: #495057;
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    border-bottom-width: 0;
}

.table > :not(caption) > * > * { padding: .75rem .9rem; border-bottom-color: var(--tema-borda); }

.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f8f9fc; }

/* Etiquetas */
.badge { font-weight: 600; letter-spacing: .02em; }

/* Menus suspensos */
.dropdown-menu {
    border: 0;
    border-radius: var(--tema-raio);
    box-shadow: var(--tema-sombra-alta);
    font-size: .875rem;
    padding: .5rem 0;
}

.dropdown-item { padding: .45rem 1.2rem; }
.dropdown-item:active { background: var(--tema-primaria); }

/* Abas e paginação */
.nav-tabs .nav-link.active, .nav-pills .nav-link.active { color: var(--tema-primaria); }
.nav-pills .nav-link.active { background: rgba(var(--tema-primaria-rgb), .1); }
.page-link { color: var(--tema-primaria); }
.active > .page-link, .page-link.active { background: var(--tema-primaria); border-color: var(--tema-primaria); }

/* Alertas mais suaves */
.alert { border: 0; border-radius: var(--tema-raio); }

/* Modais */
.modal-content { border: 0; border-radius: .75rem; box-shadow: var(--tema-sombra-alta); }
.modal-header, .modal-footer { border-color: var(--tema-borda); }

/* ─── 4. Peças do MALIM ───────────────────────────────────────────── */

/*
 * Indicadores: número grande à esquerda, ícone num círculo de cor sólida à
 * direita. A marcação continua a mesma (ícone primeiro, texto depois) —
 * a ordem visual troca aqui, para não reescrever cada tela.
 */
.stat-card {
    border-radius: var(--tema-raio);
    box-shadow: var(--tema-sombra);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--tema-sombra-alta); }

.stat-card > .card-body {
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: flex-start !important;
    padding: 1.25rem;
}

.stat-card .stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    flex-shrink: 0;
    font-size: 1.2rem;
    --bs-bg-opacity: 1;
    box-shadow: 0 4px 10px rgba(56, 65, 74, .15);
}

/* Ícone branco sobre o círculo colorido (vence o text-* do Bootstrap). */
.stat-card .stat-icon[class*="text-"] { color: #fff !important; }

/* Exceção: ícone neutro (bg-light) continua discreto. */
.stat-card .stat-icon.bg-light { color: var(--tema-texto-suave) !important; box-shadow: none; }

.stat-card .fs-4 { font-size: 1.6rem !important; font-weight: 600 !important; margin-top: .35rem; }

.stat-card .text-muted.small {
    order: -1;
    text-transform: uppercase;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .04em;
}

/* O rótulo vem antes do número, como nos painéis de referência. */
.stat-card .card-body > div:last-child { display: flex; flex-direction: column; }

/* Faixa de título da página (ex.: "VISÃO GERAL" com a trilha à direita). */
.page-title-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    margin: -1.5rem -1.5rem 1.5rem;
    padding: .9rem 1.5rem;
    box-shadow: 0 1px 2px rgba(56, 65, 74, .08);
}

.page-title-box h4 {
    font-size: .95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
    margin: 0;
}

.page-title-box .trilha { font-size: .82rem; color: var(--tema-texto-suave); }
.page-title-box .trilha a { color: var(--tema-texto); text-decoration: none; }

/* Título de seção dentro da página ("HOJE", "GERAL"). */
.tema-secao {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--tema-texto-suave);
}

/* Rolagem fina nas áreas internas */
.overflow-y-auto { scrollbar-width: thin; scrollbar-color: #d5d8e1 transparent; }

@media (max-width: 768px) {
    .page-title-box { margin: -1rem -1rem 1rem; }
    .main-content { padding: 1rem; }
}
