/* ============================================
   DARK MODE - Bonito 360
   ============================================ */

/* Variáveis do Modo Escuro */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

/* ============================================
   FORÇAR FUNDO ESCURO (sobrescreve !important inline)
   ============================================ */

/* Força o fundo do body e html */
html[data-theme="dark"],
html[data-theme="dark"] body {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

/* Força fundo de todas as classes de fundo do sistema */
html[data-theme="dark"] .bg-background,
html[data-theme="dark"] .bg-surface,
html[data-theme="dark"] .bg-surface-bright,
html[data-theme="dark"] .bg-surface-container-lowest,
html[data-theme="dark"] .bg-surface-container-low,
html[data-theme="dark"] .bg-surface-container,
html[data-theme="dark"] .bg-surface-container-high,
html[data-theme="dark"] .bg-surface-container-highest,
html[data-theme="dark"] .bg-surface-dim {
    background-color: var(--bg-primary) !important;
}

/* Cards e containers brancos */
html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-slate-50,
html[data-theme="dark"] .bg-gray-50,
html[data-theme="dark"] .bg-white\/95,
html[data-theme="dark"] .bg-white\/90,
html[data-theme="dark"] .bg-white\/80 {
    background-color: var(--bg-card) !important;
}

/* Fundo da busca */
html[data-theme="dark"] .bg-search-card {
    background-color: var(--bg-secondary) !important;
}

/* ============================================
   CORREÇÃO DE TEXTOS
   ============================================ */

html[data-theme="dark"] .text-gray-900,
html[data-theme="dark"] .text-slate-900,
html[data-theme="dark"] .text-gray-800,
html[data-theme="dark"] .text-slate-800,
html[data-theme="dark"] .text-on-surface,
html[data-theme="dark"] .text-on-background {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .text-gray-700,
html[data-theme="dark"] .text-slate-700,
html[data-theme="dark"] .text-gray-600,
html[data-theme="dark"] .text-slate-600 {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] .text-gray-500,
html[data-theme="dark"] .text-slate-500,
html[data-theme="dark"] .text-gray-400,
html[data-theme="dark"] .text-slate-400,
html[data-theme="dark"] .text-outline,
html[data-theme="dark"] .text-outline-variant {
    color: var(--text-muted) !important;
}

/* ============================================
   CORREÇÃO DE BORDAS
   ============================================ */

html[data-theme="dark"] .border-gray-100,
html[data-theme="dark"] .border-slate-100,
html[data-theme="dark"] .border-gray-200,
html[data-theme="dark"] .border-slate-200,
html[data-theme="dark"] .border-gray-50,
html[data-theme="dark"] .border-slate-50,
html[data-theme="dark"] .border-outline-variant {
    border-color: var(--border-color) !important;
}

/* ============================================
   CORREÇÃO DE SOMBRAS
   ============================================ */

html[data-theme="dark"] .shadow-sm,
html[data-theme="dark"] .shadow,
html[data-theme="dark"] .shadow-md,
html[data-theme="dark"] .shadow-lg,
html[data-theme="dark"] .shadow-xl,
html[data-theme="dark"] .shadow-2xl {
    box-shadow: 0 1px 3px var(--shadow-color) !important;
}

/* ============================================
   CORREÇÃO DE HEADER / TOPBAR
   ============================================ */

html[data-theme="dark"] header.sticky,
html[data-theme="dark"] .bg-white\/90 {
    background-color: rgba(15, 23, 42, 0.9) !important;
    border-bottom-color: var(--border-color) !important;
}

html[data-theme="dark"] .backdrop-blur-xl,
html[data-theme="dark"] .backdrop-blur-md,
html[data-theme="dark"] .backdrop-blur-lg {
    background-color: rgba(15, 23, 42, 0.9) !important;
}

/* ============================================
   CORREÇÃO DE INPUTS E FORMULÁRIOS
   ============================================ */

html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

html[data-theme="dark"] input::placeholder {
    color: var(--text-muted) !important;
}

/* ============================================
   CORREÇÃO DE HOVERS
   ============================================ */

html[data-theme="dark"] .hover\:bg-gray-50:hover,
html[data-theme="dark"] .hover\:bg-slate-50:hover,
html[data-theme="dark"] .hover\:bg-gray-100:hover,
html[data-theme="dark"] .hover\:bg-slate-100:hover {
    background-color: var(--bg-card-hover) !important;
}

html[data-theme="dark"] .group:hover .group-hover\:text-primary {
    color: #3b82f6 !important;
}

/* ============================================
   CORREÇÃO DE DIVISORES
   ============================================ */

html[data-theme="dark"] .divide-slate-50 > *,
html[data-theme="dark"] .divide-gray-100 > *,
html[data-theme="dark"] .divide-gray-200 > * {
    border-color: var(--border-color) !important;
}

html[data-theme="dark"] .border-t,
html[data-theme="dark"] .border-b,
html[data-theme="dark"] .border-l,
html[data-theme="dark"] .border-r {
    border-color: var(--border-color) !important;
}

/* ============================================
   CORREÇÃO DE BOTÃO DARK MODE
   ============================================ */

.dark-mode-toggle {
    position: fixed;
    bottom: 100px;  /* Subido para 100px para ficar bem acima do menu mobile (que está em bottom: 4px) */
    left: 20px;
    z-index: 9999;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #1e293b;
    border: 2px solid #334155;
    color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

/* Tema claro - botão com fundo claro */
[data-theme="dark"] .dark-mode-toggle {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

/* Em desktop, manter posição original */
@media (min-width: 1024px) {
    .dark-mode-toggle {
        bottom: 20px;
        left: 20px;
    }
}

.dark-mode-toggle:hover {
    transform: scale(1.1);
}

/* ============================================
   CORREÇÃO DE SEÇÕES ESPECÍFICAS
   ============================================ */

/* Footer */
html[data-theme="dark"] footer {
    background-color: var(--bg-secondary) !important;
}

html[data-theme="dark"] footer .text-gray-600 {
    color: var(--text-secondary) !important;
}

/* Menu Mobile Inferior */
html[data-theme="dark"] nav.md\:hidden.fixed {
    background-color: rgba(15, 23, 42, 0.95) !important;
    border-color: var(--border-color) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
}

html[data-theme="dark"] nav.md\:hidden.fixed .text-gray-400 {
    color: var(--text-muted) !important;
}

html[data-theme="dark"] nav.md\:hidden.fixed .border-4 {
    border-color: var(--bg-primary) !important;
}

/* Cards de categorias na home */
html[data-theme="dark"] a.group.flex-col {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

html[data-theme="dark"] a.group.flex-col:hover {
    border-color: transparent !important;
}

/* Seção de destaques */
html[data-theme="dark"] .bg-gray-50.rounded-\[2rem\] {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}

/* ============================================
   ANIMAÇÕES
   ============================================ */

html[data-theme="dark"] * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
