/* ===== FONTES E CORES GLOBAIS ===== */
body {
    font-family: 'Inter', sans-serif;
    color: #f1f5f9;
    /* changed to light text */
    background-color: #0f172a;
    /* midnight dark */
}

/* Ajustes pro Dark Mode/Inputs */
.bg-dark-mode,
.bg-midnight {
    background-color: #0f172a !important;
}

/* Força os Placeholders dos Inputs Dark Mode a ficarem visíveis (Cinza Claro) */
.form-control::placeholder,
.form-select::placeholder,
textarea::placeholder,
input::placeholder {
    color: #94a3b8 !important;
    opacity: 0.8 !important;
    /* Firefox exige !important na opacidade do placeholder */
}

/* Força sobrescrever fundos claros do Bootstrap caso existam nas marcações originais */
.bg-light-gray {
    background-color: #0f172a !important;
    /* midnight */
}

.bg-white {
    background-color: #1e293b !important;
    /* dark slate for cards/navbar */
}

.text-dark {
    color: #f1f5f9 !important;
    /* textos escuros do Bootstrap agora são claros */
}

.border-bottom {
    border-bottom-color: #334155 !important;
}

/* ===== CONFIGURAÇÕES DO NAVBAR SUPERIOR (header.php) ===== */
.top-navbar {
    height: 70px;
    padding-top: 0;
    padding-bottom: 0;
    background-color: #1e293b !important;
    border-bottom: 1px solid #334155 !important;
}

/* Cor logo principal */
.navbar-brand {
    color: #4ed4f5 !important;
    font-size: 1.4rem !important;
}

/* Fix pro Botão Hambúrguer (Mobile) no Dark Mode */
.navbar-toggler {
    border-color: rgba(255, 255, 255, 0.5) !important;
    /* Borda visível clarinha */
}

/* Força o ícone sanduíche a ser branco filtrando SVG preto padrão */
.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* Menu expandido no mobile (colapso) deve ter fundo escuro também e ficar acima de tudo */
@media (max-width: 991px) {
    .navbar-collapse {
        background-color: #1e293b;
        padding: 10px;
        border-radius: 8px;
        margin-top: 10px;
        border: 1px solid #334155;
        position: absolute;
        /* Evita que empurre a tela toda pra baixo simulando a animação */
        width: calc(100% - 20px);
        /* Largura da tela menos as margens do container */
        left: 10px;
        top: 60px;
        /* Posição fixa abaixo do header pra evitar o pulo visual */
        z-index: 1050;
        /* Superioridade ao header do chat (z-index 10) e toda interface */
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    }

    /* Remove a animação arrastada nativa do Bootstrap de deslizar o menu para baixo/cima */
    .navbar-collapse.collapsing {
        transition: none !important;
        height: auto !important;
        overflow: visible;
        display: none;
    }

    .navbar-collapse.show {
        display: block !important;
    }
}

/* Links do menu esquerdo (Início, Álbuns, Eventos...) */
.menu-esquerdo .nav-link {
    color: #94a3b8;
    font-weight: 500;
    padding: 23.5px 15px !important;
    font-size: 0.95rem;
    border-bottom: 3px solid transparent;
}

.menu-esquerdo .nav-link:hover {
    color: #f8fafc;
}

/* Estilo ativo (Aba "Eventos" selecionada com barra azul embaixo) */
.menu-esquerdo .nav-link.active {
    color: #4ed4f5 !important;
    border-bottom: 3px solid #4ed4f5;
}

/* Dropdown styling geral */
.dropdown-menu {
    background-color: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 10px 0;
    min-width: 180px;
}

.dropdown-item {
    padding: 8px 20px;
    color: #cbd5e1;
    font-size: 0.95rem;
}

.dropdown-item:hover {
    background-color: #334155;
    color: #ffffff;
}

.active-text-info {
    color: #4ed4f5 !important;
}

/* Botões do lado Direito (Valores financeiros) */
.btn-financeiro {
    background-color: #45c4f5 !important;
    border: none;
    color: white !important;
    font-size: 0.85rem;
    height: 35px;
    display: inline-flex;
    align-items: center;
}

.btn-financeiro:hover {
    background-color: #3ab1df !important;
}

/* Divisor de menu (|) */
.vertical-divider {
    width: 1px;
    height: 25px;
    background-color: #334155;
}

/* Ícones de ação (sino, chat, pergunta) - Incorporando suas mudanças recentes */
.icone-acao {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    transition: background-color 0.2s;
    color: #cbd5e1;
    /* Cor mais clara para modo dark */
}

.icone-acao-chat {
    display: flex;
    width: 94px;
    height: 35px;
    border-radius: 10px;
    border: 1px solid #334155;
    /* Borda ajustada pro dark */
    transition: background-color 0.2s;
    margin-right: 30px;
    font-size: 15px;
    text-decoration: none;
    color: #cbd5e1;
    /* Texto mais claro */
    align-items: center;
    justify-content: space-evenly;
}

.icone-acao:hover,
.icone-acao-chat:hover {
    background-color: #334155;
    color: #ffffff;
}

/* Sobrescreve o texto dark do icone do bootstrap pra herdar a cor certa no dark mode */
.icone-acao i,
.icone-acao-chat i {
    color: inherit !important;
}

/* Avatar circular do usuário com a câmera */
.avatar-circle {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #3d8bfd;
}

/* ===== CONFIGURAÇÕES DO CORPO DO DASHBOARD (index.php) ===== */

/* Garante que títulos antes dark fiquem brancos */
main h2.text-dark {
    color: #f8fafc !important;
}

.btn-adicionar {
    background-color: #3d8bfd !important;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
}

.btn-adicionar:hover {
    background-color: #3275d8 !important;
}

/* O quadro branco grande que domina a parte central do painel convertido para dark */
.card-conteudo {
    border-radius: 8px;
    background-color: transparent !important;
    /* Novo painel de busca sem fundo branco original */
    border: none !important;
    box-shadow: none !important;
}

.card-conteudo .card-body.bg-white {
    background-color: transparent !important;
    /* Remove o fundo branco inline do Boostrap no index.php */
}

/* --- ESTILOS DA NOVA CAIXA DE BUSCA INTERATIVA (index.php) --- */
.search-container {
    padding: 20px;
}

.search-title {
    font-size: 1.8rem;
    font-weight: 400;
}

/* Destaque azul na palavra PERGUNTE */
.search-title .text-highlight {
    color: #2183af;
    font-weight: 500;
}

.search-title .text-light {
    color: #e2e8f0 !important;
}

/* Nova caixa de busca compacta (estilo pill) do print */
.search-box {
    width: 100%;
    border-radius: 50px;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 0 20px;
    transition: all 0.3s ease;
    height: 56px; /* Altura de 1 linha compacta */
    display: flex;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.search-box:focus-within {
    border-color: #64748b;
    box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.2);
}

.search-box form {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
}

.search-icon {
    font-size: 1.3rem;
    color: #64748b;
    margin-right: 5px;
}

.search-input {
    background: transparent !important;
    border: none !important;
    color: #334155 !important;
    padding: 0 10px;
    font-size: 1.15rem;
    box-shadow: none !important;
    flex-grow: 1;
    height: 100%;
}

.search-input::placeholder {
    color: #64748b !important;
    font-size: 1.15rem;
}

/* Oculta botão de busca visualmente mas o enter submete */
.btn-search {
    display: none !important;
}


/* ===== CONFIGURAÇÕES DO CHAT (chat.php) ===== */
.chat-container {
    background-color: #0b141a !important;
    /* Fundo característico escuro do WhatsApp Web */
    border: 1px solid #2a3942 !important;
    height: 75vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    /* Pattern escuro clássico de fundo */
    background-size: cover;
    background-blend-mode: overlay;
    background-color: rgba(11, 20, 26, 0.95) !important;
}

.chat-header {
    background-color: #202c33;
    border-bottom: 1px solid #2a3942;
    z-index: 10;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Espaço entre mensagens */
}

/* Esconde scrollbar nativa na área de mensagens igual zap */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

/* Container de cada mensagem controlando alinhamento Direita/Esquerda */
.message-wrapper {
    display: flex;
    margin-bottom: 2px;
    width: 100%;
}

/* Mensagens Enviadas pelo usuário (Direita / Verde Zap escuro) */
.message-sent {
    justify-content: flex-end;
}

.message-sent .message-bubble {
    background-color: #005c4b;
    border-radius: 8px 0px 8px 8px;
    /* Bico superior direito padrão zap */
}

/* Mensagens Recebidas da IA (Esquerda / Cinza Escuro Zap) */
.message-received {
    justify-content: flex-start;
}

.message-received .message-bubble {
    background-color: #202c33;
    border-radius: 0px 8px 8px 8px;
    /* Bico superior esquerdo */
}

/* A bolha de texto em si */
.message-bubble {
    max-width: 80%;
    /* Avança no máximo 80% como solicitado */
    padding: 8px 12px;
    position: relative;
    color: #e9edef;
    font-size: 0.95rem;
    line-height: 1.3;
    word-wrap: break-word;
    box-shadow: 0 1px 1px rgba(11, 20, 26, 0.5);
    display: inline-block;
}

/* Força que o negrito não quebre a linha acidentalmente por regras globais do Bootstrap ou do navegador */
.message-bubble strong,
.message-bubble b {
    display: inline !important;
}

/* Corrige espaçamentos absurdos de parágrafos ou BRs gerados dinamicamente */
.message-bubble p {
    margin-bottom: 0px !important;
}

.message-bubble br {
    display: block;
    /* Fix para o BR ter comportamento previsível */
    margin: 2px 0;
    content: "";
    /* Impede alturas duplas exageradas */
}

/* Tratamento visual para Links pra não quebrarem o layout escuro */
.message-bubble a {
    color: #53bdeb;
    /* Azul claro bonito WhatsApp */
    text-decoration: underline;
}

/* Hora formatada no cantinho da mensagem */
.message-time {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.6);
    float: right;
    margin-top: -5px;
    /* Puxa levemente pra cima pra economizar espaço vertical se tiver em linha nova */
    margin-left: 15px;
    /* Dá respiro caso o texto bata na hora */
    align-self: flex-end;
    /* Fica no fundo à direita mesmo se for multi-linha */
    position: relative;
    bottom: -3px;
    right: -2px;
}

/* Divisores de data estilo balaozinho central (HOJE, ONTEM) */
.chat-data-divider {
    margin: 15px 0;
}

.chat-data-divider span {
    background-color: #182229;
    color: rgba(233, 237, 239, 0.8);
    font-size: 0.75rem;
    font-weight: 500;
    box-shadow: 0 1px 1px rgba(11, 20, 26, 0.5);
}

/* Área de digitar mensagem */
.chat-input-area {
    background-color: #202c33;
    padding: 10px 15px !important;
}

.chat-input {
    background-color: #2a3942 !important;
    border: none !important;
    border-radius: 20px !important;
    color: #d1d7db !important;
    padding: 10px 20px !important;
    box-shadow: none !important;
    height: 45px;
}

.chat-input::placeholder {
    color: #8696a0 !important;
}

.chat-input:focus {
    background-color: #2a3942 !important;
    color: #d1d7db !important;
}

.btn-chat-send {
    background-color: #00a884 !important;
    /* Verde mais vivo pro botão enviar dark mode */
    border: none;
    border-radius: 50% !important;
    width: 45px;
    height: 45px;
    color: white !important;
    transition: background-color 0.2s;
}

.btn-chat-send:hover {
    background-color: #06cf9c !important;
}

.btn-chat-send i {
    margin-left: -2px;
    /* Ajuste óptico do ícone de avião de papel */
}


/* ===== CONFIGURAÇÕES DA TELA DE LOGIN (login.php) ===== */
.login-wrapper {
    /* Gradiente escuro maravilhoso */
    background: linear-gradient(135deg, #020617 0%, #0f172a 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 15px;
}

/* Card estilo Glassmorphism Dark */
.login-card {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    background: rgba(30, 41, 59, 0.85);
    /* semi-transparente dark */
    backdrop-filter: blur(12px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.login-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5) !important;
}

.login-card h2.text-primary {
    color: #38bdf8 !important;
    /* Ciano claro mais legível no dark mode */
}

.login-card p.text-muted {
    color: #94a3b8 !important;
}

.login-card label {
    color: #e2e8f0;
}

/* Campos de preenchimento (inputs) adaptados pro dark mode - retirar borda central parecem contínuos */
.login-card .input-group-text {
    background-color: #0f172a;
    border: 1px solid #334155;
    border-right: none;
    color: #94a3b8;
}

.login-card .form-control {
    background-color: #0f172a;
    border: 1px solid #334155;
    border-left: none;
    color: #e2e8f0;
}

.login-card .form-control:focus {
    box-shadow: none;
    border-color: #38bdf8;
    background-color: #0f172a;
    color: #ffffff;
}

.login-card .input-group:focus-within {
    box-shadow: 0 0 0 0.25rem rgba(56, 189, 248, 0.25);
    border-radius: 0.375rem;
}

.login-card .input-group:focus-within .input-group-text,
.login-card .input-group:focus-within .form-control {
    border-color: #38bdf8;
}

/* fix placeholder color */
.login-card .form-control::placeholder {
    color: #64748b;
}

/* outline button in password */
.login-card .btn-outline-secondary {
    border-color: #334155;
    background-color: #0f172a;
    color: #94a3b8;
}

.login-card .btn-outline-secondary:hover {
    background-color: #1e293b;
    color: #e2e8f0;
}

.login-card .input-group:focus-within .btn-outline-secondary {
    border-color: #38bdf8;
}

/* ===== ANIMAÇÕES E INDICADORES (CHAT) ===== */
.typing-indicator {
    padding: 2px 2px 0 2px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: #8bb1c5;
    /* Azul/cinza bonitinho pra combinar com o dark */
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===== DATATABLES (Dark Theme Tweaks) ===== */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    color: #cbd5e1 !important;
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    background-color: #0f172a;
    border: 1px solid #334155;
    color: #f1f5f9;
    border-radius: 6px;
}

.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
    box-shadow: 0 0 0 0.25rem rgba(56, 189, 248, 0.25);
    border-color: #38bdf8;
    outline: none;
}

.table-dark {
    --bs-table-bg: transparent;
    --bs-table-color: #f8fafc;
    --bs-table-border-color: #334155;
}

.page-item .page-link {
    background-color: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}

.page-item.active .page-link {
    background-color: #38bdf8;
    border-color: #38bdf8;
    color: #0f172a;
    font-weight: bold;
}

.page-item.disabled .page-link {
    background-color: #0f172a;
    border-color: #334155;
    color: #64748b;
}

table.dataTable>thead>tr>th:before,
table.dataTable>thead>tr>th:after {
    opacity: 0.3 !important;
}

table.dataTable>thead>tr>th.sorting_asc:before,
table.dataTable>thead>tr>th.sorting_desc:after {
    opacity: 1 !important;
    color: #38bdf8 !important;
}

/* ===== FORMS NO TEMA ESCURO (PLACEHOLDERS E AJUDAS) ===== */
#formFAQ .form-control::placeholder {
    color: #64748b !important;
    opacity: 1 !important;
}

#formFAQ .text-muted {
    color: #94a3b8 !important;
}