/* ============================================================
   Módulos - Sidebar + Cards + Tabelas
   ============================================================ */

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed;
    left: 0;
    top: 91px;
    bottom: 45px;
    width: 220px;
    background: #1a1f2e;
    overflow-y: auto;
    z-index: 500;
    box-shadow: 2px 0 8px rgba(0,0,0,0.4);
    transition: transform 0.3s ease;
}

.sidebar-logo {
    padding: 14px 18px 10px;
    border-bottom: 1px solid #2c3347;
    color: var(--cor-primaria);
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.sidebar-section {
    padding: 10px 18px 4px;
    font-size: 10px;
    color: #556070;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-top: 6px;
}

.sidebar-section-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 18px;
    user-select: none;
}

.sidebar-section-toggle .glyphicon-chevron-down {
    font-size: 8px;
    transition: transform 0.2s ease;
}

.sidebar-section-toggle[aria-expanded="true"] .glyphicon-chevron-down {
    transform: rotate(180deg);
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 11px 20px;
    color: #a0aec0;
    text-decoration: none;
    font-size: 13.5px;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.sidebar-menu li a .glyphicon {
    margin-right: 10px;
    font-size: 14px;
    width: 18px;
    text-align: center;
    color: #556070;
    transition: color 0.2s;
}

.sidebar-menu li a:hover {
    background: #242b3d;
    color: #e2e8f0;
    border-left-color: var(--cor-primaria);
    text-decoration: none;
}

.sidebar-menu li a:hover .glyphicon {
    color: var(--cor-primaria);
}

.sidebar-menu li.active a {
    background: #242b3d;
    color: var(--cor-primaria);
    border-left-color: var(--cor-primaria);
    font-weight: 600;
}

.sidebar-menu li.active a .glyphicon {
    color: var(--cor-primaria);
}

.sidebar-divider {
    height: 1px;
    background: #2c3347;
    margin: 8px 0;
}

/* ---------- Layout com Sidebar ---------- */
.with-sidebar {
    margin-left: 220px;
    transition: margin-left 0.3s ease;
}

/* ---------- Cards de Estatísticas ---------- */
.stat-card {
    border-radius: 8px;
    padding: 20px 22px;
    color: #fff;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 13px;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .stat-icon {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 42px;
    opacity: 0.2;
}

.stat-blue    { background: linear-gradient(135deg, #2980b9, #1a6ea3); }
.stat-green   { background: linear-gradient(135deg, #27ae60, #1e9450); }
.stat-orange  { background: linear-gradient(135deg, #e67e22, #d06b12); }
.stat-red     { background: linear-gradient(135deg, #c0392b, #a93226); }
.stat-purple  { background: linear-gradient(135deg, #8e44ad, #7d3c98); }
.stat-teal    { background: linear-gradient(135deg, #16a085, #138a72); }

/* ---------- Cabeçalho de Módulo ---------- */
.modulo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #eee;
}

.modulo-header h3 {
    margin: 0;
    font-size: 20px;
    color: #2c3e50;
    font-weight: 600;
}

.modulo-header h3 .glyphicon {
    margin-right: 8px;
    color: var(--cor-primaria);
}

/* ---------- Tabela Módulos ---------- */
.tabela-modulo {
    border: 1px solid #dce0e6;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

.tabela-modulo thead tr {
    background: #2c3e50;
    color: #fff;
}

.tabela-modulo thead th {
    padding: 11px 14px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none !important;
}

.tabela-modulo tbody tr:hover {
    background: #f0f7ff;
}

.tabela-modulo tbody td {
    padding: 10px 14px;
    vertical-align: middle;
    border-color: #eaecef;
}

/* ---------- Badges de Status ---------- */
.badge-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}

.badge-ativo, .badge-Ativo, .badge-pago, .badge-Concluída, .badge-Aprovado, .badge-Recebida {
    background: #d4edda; color: #155724;
}
.badge-inativo, .badge-Encerrado, .badge-cancelado, .badge-Cancelada, .badge-Reprovado {
    background: #f8d7da; color: #721c24;
}
.badge-pendente, .badge-Pendente, .badge-Aberta, .badge-Rascunho, .badge-Solicitada {
    background: #fff3cd; color: #856404;
}
.badge-Em\ Andamento, .badge-Enviado, .badge-Aprovada, .badge-Em\ Renovação, .badge-Resolvido {
    background: #cce5ff; color: #004085;
}
.badge-Aguardando\ Peça, .badge-Suspenso, .badge-Expirado {
    background: #e2e3e5; color: #383d41;
}
.badge-Urgente { background: #f8d7da; color: #721c24; }
.badge-Alta    { background: #fff3cd; color: #856404; }
.badge-Normal  { background: #cce5ff; color: #004085; }
.badge-Baixa   { background: #d4edda; color: #155724; }

/* ---------- Botões de Ação ---------- */
.btn-acoes {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
}

.btn-acoes .btn {
    padding: 4px 8px;
    font-size: 12px;
}

/* ---------- Alerta de Estoque Baixo ---------- */
.estoque-baixo {
    color: #e74c3c;
    font-weight: 600;
}

/* ---------- Painel do Dashboard ---------- */
.dashboard-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid #eee;
}

.recente-item {
    padding: 10px 12px;
    border-left: 3px solid var(--cor-primaria);
    background: #f8f9fa;
    margin-bottom: 8px;
    border-radius: 0 4px 4px 0;
}

.recente-item small {
    color: #666;
    display: block;
    margin-top: 2px;
}

/* ---------- Filtros ---------- */
.filtro-bar {
    background: #f8f9fa;
    padding: 14px 16px;
    border-radius: 6px;
    margin-bottom: 18px;
    border: 1px solid #e0e3e7;
}

.filtro-bar .form-control {
    border-radius: 4px;
}

/* ---------- Totalizador Financeiro ---------- */
.total-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.total-box {
    flex: 1;
    min-width: 160px;
    padding: 14px 18px;
    border-radius: 6px;
    text-align: center;
}

.total-receita  { background: #d4edda; border: 1px solid #c3e6cb; }
.total-despesa  { background: #f8d7da; border: 1px solid #f5c6cb; }
.total-saldo    { background: #cce5ff; border: 1px solid #b8daff; }

.total-box .valor {
    font-size: 22px;
    font-weight: 700;
    display: block;
}

.total-box .rotulo {
    font-size: 11px;
    text-transform: uppercase;
    color: #555;
    letter-spacing: 0.5px;
}

/* ---------- Responsividade ---------- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-220px);
    }
    .sidebar.aberto {
        transform: translateX(0);
        z-index: 9998;
    }
    .with-sidebar {
        margin-left: 0;
    }
    .overlay-sidebar {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 9997;
    }
    .overlay-sidebar.visivel { display: block; }
}
