/* static/css/core/theme_dark.css */
/* Variáveis de tema escuro, cartões profundos, SweetAlert2 e alternância sol/lua */

html.dark {
    color-scheme: dark !important;
    --black-page-bg: #0f172a;
    --card-dark-bg: #161b26;
    --container-dark-bg: #3a3a3a;
    --color-text-dark: #e2e8f0;
    background-color: #0f172a !important;
    --green-dark-bg: #1F3B2E;
    --red-dark-bg: #3F1F1F;
    --cor-primaria-app-rgb: 157, 56, 220;
    --cor-primaria-app-transparente: rgba(157, 56, 220, 0.25);
}

html.dark .dashboard-card-bg, 
html.dark .card-dark-force, 
html.dark .bg-white:not(.bg-dark-force-transparent):not(.no-dark-force):not(.bg-white\/80), 
html.dark .bg-slate-50:not(.bg-dark-force-transparent), 
html.dark .bg-gray-50:not(.bg-dark-force-transparent) { 
    background-color: #161B26 !important; 
}

html.dark .card-aco-escovado { 
    background-color: #161B26 !important; 
    border: 1px solid rgba(255, 255, 255, 0.1) !important; 
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1) !important; 
}

/* NOVO MECANISMO DE FUNDO (FIXO E ESTÁVEL PARA MOBILE) */
.fixed-background { 
    position: fixed; 
    top: 0; left: 0; 
    width: 100vw; height: 100vh; 
    z-index: -1; 
    pointer-events: none; 
    background-color: #f3f4f6; 
    transition: background 0.3s ease; 
}
html.dark .fixed-background { 
    background: #0f172a !important; 
    background-color: #0f172a !important; 
    background-size: cover !important; 
}
html.dark body { 
    background: transparent !important; 
    min-height: 100vh; 
}

@media (min-width: 1024px) {
    body.logged-in .page-content-pusher { 
        position: relative !important; 
        left: auto !important; 
        margin-left: var(--sidebar-width, 13.2rem) !important; 
        padding-left: 1.5rem !important; 
        padding-right: 1.5rem !important; 
        width: auto !important; 
        padding-top: 40px !important; 
    }
}

html.dark .status-atrasado, 
html.dark span[class*="status-atrasado"], 
html.dark .text-atrasado-force { 
    color: #f87171 !important; 
}

html.dark .swal2-popup { 
    background-color: #161b26 !important; 
    color: #e2e8f0 !important; 
    border: 1px solid rgba(255, 255, 255, 0.1) !important; 
}
html.dark .swal2-title, 
html.dark .swal2-html-container { 
    color: #f1f5f9 !important; 
}

.card-aco-escovado { 
    transition: transform 0.2s, box-shadow 0.2s; 
    position: relative; 
    background-clip: padding-box; 
}
html.dark .card-aco-escovado { 
    background: radial-gradient(circle at 50% 0%, #4b5563, #1f2937, #000000) !important; 
    border: 1px solid rgba(255, 255, 255, 0.15) !important; 
}

/* Sidebar and Header Fixes */
html:not(.sidebar-is-collapsed) .sidebar-principal { width: 13.2rem; }
html.sidebar-is-collapsed .sidebar-principal { width: 5rem; }
html:not(.sidebar-is-collapsed) .sidebar-header { height: 9rem !important; }
html.sidebar-is-collapsed .sidebar-header { height: 5rem !important; }
.page-content-pusher { margin-left: 0 !important; }

/* Correção do Botão de Dark Mode (Sol/Lua) */
.dark-mode-icon-sun, .dark-mode-icon-moon { 
    pointer-events: none; 
    transition: transform 0.2s ease, opacity 0.2s ease; 
}
html:not(.dark) .dark-mode-icon-sun { display: none !important; }
html:not(.dark) .dark-mode-icon-moon { display: inline-block !important; }
html.dark .dark-mode-icon-sun { display: inline-block !important; }
html.dark .dark-mode-icon-moon { display: none !important; }

/* Blindagem Global de Autofill no Modo Escuro */
html.dark input:-webkit-autofill,
html.dark input:-webkit-autofill:hover, 
html.dark input:-webkit-autofill:focus, 
html.dark input:-webkit-autofill:active,
html.dark textarea:-webkit-autofill,
html.dark textarea:-webkit-autofill:hover,
html.dark textarea:-webkit-autofill:focus,
html.dark textarea:-webkit-autofill:active,
html.dark select:-webkit-autofill,
html.dark select:-webkit-autofill:hover,
html.dark select:-webkit-autofill:focus,
html.dark select:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #0b0f1a inset !important;
    -webkit-text-fill-color: #ffffff !important;
    caret-color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    transition: background-color 5000s ease-in-out 0s;
}

html.dark input:-webkit-autofill:focus,
html.dark textarea:-webkit-autofill:focus,
html.dark select:-webkit-autofill:focus {
    border-color: var(--cor-destaque, #9D38DC) !important;
    -webkit-box-shadow: 0 0 0 1000px #0b0f1a inset, 0 0 0 1px var(--cor-destaque, #9D38DC) !important;
}

html.dark input:autofill,
html.dark input:autofill:hover,
html.dark input:autofill:focus,
html.dark input:autofill:active,
html.dark textarea:autofill,
html.dark textarea:autofill:hover,
html.dark textarea:autofill:focus,
html.dark textarea:autofill:active,
html.dark select:autofill,
html.dark select:autofill:hover,
html.dark select:autofill:focus,
html.dark select:autofill:active {
    box-shadow: 0 0 0 1000px #0b0f1a inset !important;
    -webkit-text-fill-color: #ffffff !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

html.dark input:autofill:focus,
html.dark textarea:autofill:focus,
html.dark select:autofill:focus {
    border-color: var(--cor-destaque, #9D38DC) !important;
    box-shadow: 0 0 0 1000px #0b0f1a inset, 0 0 0 1px var(--cor-destaque, #9D38DC) !important;
}
