/**
 * JunquiNet Portal Imobiliario - Custom Theme Overrides
 * Suporte aprimorado para Modo Claro / Modo Escuro (Dia / Noite) integrado ao Color-Theme
 */

/* =========================================================
   1. Alternador de Tema (Ícones Sol / Lua)
   ========================================================= */
#btn-color-scheme #icon-dark {
    display: none !important;
}
#btn-color-scheme #icon-light {
    display: inline-flex !important;
}

[data-bs-theme="dark"] #btn-color-scheme #icon-light {
    display: none !important;
}
[data-bs-theme="dark"] #btn-color-scheme #icon-dark {
    display: inline-flex !important;
}

/* =========================================================
   2. Tipografia e Base no Modo Escuro (Global)
   ========================================================= */
[data-bs-theme="dark"] body {
    color: var(--bs-body-color, #dee2e6) !important;
    background-color: var(--bs-body-bg, #212529);
}

/* Títulos no Modo Escuro (Front e Admin) */
[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6,
[data-bs-theme="dark"] .h1,
[data-bs-theme="dark"] .h2,
[data-bs-theme="dark"] .h3,
[data-bs-theme="dark"] .h4,
[data-bs-theme="dark"] .h5,
[data-bs-theme="dark"] .h6 {
    color: var(--bs-emphasis-color, #ffffff) !important;
}

/* Subtítulos no Modo Escuro */
[data-bs-theme="dark"] .lead,
[data-bs-theme="dark"] p.lead,
[data-bs-theme="dark"] .section-subtitle,
[data-bs-theme="dark"] .page-hero .lead {
    color: var(--bs-secondary-color, rgba(222, 226, 230, 0.78)) !important;
}

[data-bs-theme="dark"] .text-muted {
    color: rgba(222, 226, 230, 0.65) !important;
}

[data-bs-theme="dark"] hr {
    border-color: rgba(255, 255, 255, 0.12) !important;
    opacity: 0.3;
}

[data-bs-theme="dark"] .border-bottom {
    border-bottom-color: rgba(255, 255, 255, 0.12) !important;
}

/* =========================================================
   3. Frontend - Seções e Faixas (Dia / Noite)
   ========================================================= */
/* Ajuste de faixas de seções com fundo suave no modo escuro */
[data-bs-theme="dark"] .bg-theme-light {
    background-color: rgba(255, 255, 255, 0.035) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

[data-bs-theme="dark"] .search-box {
    background: rgba(18, 22, 28, 0.8) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(8px);
}

/* =========================================================
   4. Frontend - Cards de Imóveis e Informações
   ========================================================= */
[data-bs-theme="dark"] .card-imovel {
    background-color: var(--bs-card-bg, #212529) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
}

[data-bs-theme="dark"] .card-imovel .card-body {
    background-color: var(--bs-card-bg, #212529) !important;
    color: var(--bs-card-color, #dee2e6) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

[data-bs-theme="dark"] .card-imovel .card-title,
[data-bs-theme="dark"] .card-imovel h2.card-title,
[data-bs-theme="dark"] .card-imovel h5.card-title {
    color: var(--bs-emphasis-color, #ffffff) !important;
}

[data-bs-theme="dark"] .card-imovel .preco-valor {
    color: var(--theme-primary-light, #6ea8fe) !important;
}

[data-bs-theme="dark"] .card-imovel hr {
    border-color: rgba(255, 255, 255, 0.08) !important;
}

[data-bs-theme="dark"] .contact-info-card,
[data-bs-theme="dark"] .testimonial-card {
    background-color: var(--bs-card-bg, #212529) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: var(--bs-card-color, #dee2e6) !important;
}

[data-bs-theme="dark"] .testimonial-card .card-text {
    color: var(--bs-body-color, #dee2e6) !important;
}

/* =========================================================
   5. Admin - Cabeçalhos de Página, Cards e Elementos
   ========================================================= */
/* Títulos das páginas no Admin */
[data-bs-theme="dark"] main h1,
[data-bs-theme="dark"] main h2,
[data-bs-theme="dark"] main h3,
[data-bs-theme="dark"] main .h2,
[data-bs-theme="dark"] main .h1 {
    color: var(--bs-emphasis-color, #ffffff) !important;
}

/* Cards gerais no Admin */
[data-bs-theme="dark"] main .card {
    background-color: var(--bs-card-bg, #212529) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: var(--bs-card-color, #dee2e6) !important;
}

/* Cabeçalhos e rodapés de card com bg-white no Admin */
[data-bs-theme="dark"] .card-header.bg-white,
[data-bs-theme="dark"] .card-footer.bg-white {
    background-color: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: var(--bs-emphasis-color, #ffffff) !important;
}

[data-bs-theme="dark"] main .card-header {
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
    color: var(--bs-emphasis-color, #ffffff) !important;
}

/* Corrige títulos e textos com classe text-dark e text-gray-800 em cards */
[data-bs-theme="dark"] .card-title,
[data-bs-theme="dark"] .card-title.text-dark,
[data-bs-theme="dark"] .card-header .card-title,
[data-bs-theme="dark"] .card-header h5.text-dark,
[data-bs-theme="dark"] .card-header h6.text-dark,
[data-bs-theme="dark"] .card-header.text-dark,
[data-bs-theme="dark"] .card-body h2.text-dark,
[data-bs-theme="dark"] .card-body h3.text-dark,
[data-bs-theme="dark"] .card-body h4.text-dark,
[data-bs-theme="dark"] .card-body h5.text-dark,
[data-bs-theme="dark"] .card-body h6.text-dark,
[data-bs-theme="dark"] .card-body strong.text-dark,
[data-bs-theme="dark"] .card-body div.text-dark:not(.badge),
[data-bs-theme="dark"] .card-body .text-dark:not(.badge),
[data-bs-theme="dark"] .card-header .text-dark:not(.badge),
[data-bs-theme="dark"] .text-gray-800 {
    color: var(--bs-emphasis-color, #ffffff) !important;
}

/* Blocos informativos com .bg-light que contêm text-dark dentro de cards */
[data-bs-theme="dark"] .bg-light:not(.badge) {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--bs-body-color, #dee2e6) !important;
}

/* Listas suspensas de autocompletar no Admin */
[data-bs-theme="dark"] .ac-dropdown.bg-white {
    background-color: #2b3035 !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #dee2e6 !important;
}
[data-bs-theme="dark"] .ac-dropdown li {
    color: #dee2e6 !important;
}
[data-bs-theme="dark"] .ac-dropdown li:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
}

/* Tabelas e list-groups no modo escuro */
[data-bs-theme="dark"] .table {
    --bs-table-color: var(--bs-body-color, #dee2e6);
    --bs-table-striped-color: var(--bs-body-color, #dee2e6);
    --bs-table-active-color: var(--bs-body-color, #dee2e6);
    --bs-table-hover-color: var(--bs-emphasis-color, #ffffff);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .list-group-item {
    background-color: var(--bs-card-bg, #212529);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--bs-body-color, #dee2e6);
}

/* Modais no modo escuro */
[data-bs-theme="dark"] .modal-content {
    background-color: #212529 !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: #dee2e6 !important;
}
[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
    border-color: rgba(255, 255, 255, 0.1) !important;
}
