/* ==========================================
   1. VARIÁVEIS E BASE
   ========================================== */
:root {
    --primary: #0d6efd;
    --primary-600: #2563eb;
    --primary-800: #1e40af;
    --sidebar-width: 260px;
    --bg-light: #f8f9fa;
    --text: #212529;
    --border: #dee2e6;
    --transition: all 0.3s ease;
    
    /* Variáveis do Motor de Temas */
    --theme-bg: #f8f9fa;
    --theme-surface: #ffffff;
    --theme-text: #212529;
    --theme-text-muted: #6c757d;
    --theme-border: rgba(0,0,0,0.08);
    --sidebar-color: #212529; /* Cor do texto do menu */
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--theme-bg) !important;
    color: var(--theme-text) !important;
    margin: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================
   2. ESTRUTURA HÍBRIDA (Desktop / Mobile)
   ========================================== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background-color: var(--sidebar-bg, var(--theme-surface)) !important;
    border-right: 1px solid var(--theme-border);
    display: flex;
    flex-direction: column;
    z-index: 1050; 
    transition: var(--transition);
}

/* FORÇA O CONTRASTE NO MENU LATERAL */
.sidebar .nav-link-custom, 
.sidebar .text-muted, 
.sidebar .text-dark, 
.sidebar .text-primary,
.sidebar h4,
.sidebar i,
.sidebar span {
    color: var(--sidebar-color) !important;
}

/* Dropdown dentro do menu lateral segue o tema principal, não o menu */
.sidebar .dropdown-menu { background-color: var(--theme-surface) !important; }
.sidebar .dropdown-menu a { color: var(--theme-text) !important; }

.main-content {
    margin-left: var(--sidebar-width);
    padding: 2rem;
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 65px;
    background-color: var(--sidebar-bg, var(--theme-surface)) !important;
    display: none;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.05);
    z-index: 1040; 
    border-top: 1px solid var(--theme-border);
}

.bottom-nav .nav-mobile-link i {
    color: var(--sidebar-color) !important;
    opacity: 0.8;
}

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; padding: 1.5rem 1rem 80px 1rem; }
    .bottom-nav { display: flex; }
    .desktop-header { display: none !important; }
}

/* ==========================================
   3. COMPONENTES VISUAIS MODERNOS
   ========================================== */
.card-custom {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    transition: var(--transition);
}

.nav-link-custom {
    padding: 0.8rem 1.2rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 10px;
    margin: 0.2rem 1rem;
    transition: var(--transition);
    font-weight: 500;
}

.nav-link-custom.active, .nav-link-custom:hover {
    background: rgba(13, 110, 253, 0.08);
    font-weight: 600;
    opacity: 1 !important;
}

.fab-mobile {
    width: 55px;
    height: 55px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    position: relative;
    top: -20px;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);
    border: 4px solid var(--theme-bg);
    transition: transform var(--transition);
}
.fab-mobile:active { transform: scale(0.95); }

.custom-modal { border: none; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); }
.form-control-custom { border-radius: 12px; padding: 0.75rem 1rem; }
.form-control-custom:focus { box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15); border-color: var(--primary); }

/* ==========================================
   4. CHAT DE REGRAS E OVERLAY
   ========================================== */
#chatMessages::-webkit-scrollbar { width: 6px; }
#chatMessages::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 4px; }
.chat-bubble { width: fit-content; max-width: 90%; min-width: 80px; padding: 10px 14px; font-size: 0.95rem; line-height: 1.4; position: relative; box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 12px; }
.user-style { background-color: var(--primary); color: #ffffff; border-radius: 18px 2px 18px 18px; align-self: flex-end; }
.bot-style { background-color: var(--theme-surface); color: var(--theme-text); border: 1px solid var(--theme-border); border-radius: 2px 18px 18px 18px; align-self: flex-start; }

.sidebar-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.5); z-index: 1045; visibility: hidden; opacity: 0; transition: opacity 0.3s ease; }
.sidebar-overlay.active { visibility: visible; opacity: 1; }
@media (max-width: 991.98px) { .sidebar.mobile-open { transform: translateX(0) !important; box-shadow: 5px 0 30px rgba(0,0,0,0.15); } }

/* ==========================================
   5. UTILITÁRIOS
   ========================================== */
.fade-in { animation: fadeIn .4s ease-in; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.table-font-sm { font-size: 0.9rem; }
.w-120 { width: 120px !important; }
.w-150 { width: 150px !important; }
.cursor-pointer { cursor: pointer; }
.circle-32 { width: 32px; height: 32px; display:inline-flex; align-items:center; justify-content:center; }
.modern-filters-scroll { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.modern-filters-scroll::-webkit-scrollbar { display: none; }

/* ========================================================
   6. MOTOR DE TEMAS: CORES E CONTRASTES
   ======================================================== */

/* MODO ESCURO */
[data-bs-theme="dark"] {
    --theme-bg: #121212;
    --theme-surface: #1e1e1e;
    --theme-text: #e0e0e0;
    --theme-text-muted: #9e9e9e;
    --theme-border: rgba(255,255,255,0.08);
}

/* MODO SUAVE */
[data-bs-theme="suave"] {
    --theme-bg: #fbf8f1;
    --theme-surface: #f4ede4;
    --theme-text: #4a4036;
    --theme-text-muted: #8b7e71;
    --theme-border: rgba(74, 64, 54, 0.1);
}

/* Aplicação a Cards e Fundos Brancos Rígidos */
.bg-white, .card, .card-header, .card-body, .card-footer, .modal-content, .dropdown-menu, .list-group-item {
    background-color: var(--theme-surface) !important;
    color: var(--theme-text) !important;
    border-color: var(--theme-border) !important;
}

/* Aplicação a Textos */
.text-dark { color: var(--theme-text) !important; }
.text-secondary { color: var(--theme-text) !important; opacity: 0.85; }
.text-muted { color: var(--theme-text-muted) !important; }

/* Formulários e Tabelas */
.table, .table-hover>tbody>tr:hover>* { color: var(--theme-text) !important; }
.form-control, .form-select, .input-group-text {
    background-color: var(--theme-bg) !important;
    color: var(--theme-text) !important;
    border-color: var(--theme-border) !important;
}

/* ----------------------------------------------------
   CORREÇÃO CIRÚRGICA: ELEMENTOS BG-LIGHT (Fundo Claro)
   ---------------------------------------------------- */
.bg-light {
    background-color: #f8f9fa !important; /* Mantém sempre claro */
}

/* Se estiver dentro de bg-light, forçamos o texto a ser preto para não desaparecer */
.bg-light .text-dark, 
.bg-light .text-secondary, 
.bg-light .text-muted,
.bg-light .nav-link {
    color: #343a40 !important; 
}

.logo-dashboard {
    width: 60%;      /* Ajusta o tamanho da imagem dentro do círculo */
    height: auto;    /* Mantém a proporção */
}