/* Correções específicas para o modo noturno no dashboard */

/* Garantir que elementos tenham as cores corretas no modo noturno */
body.night {
    background: #181c24 !important;
    color: #e0e0e0 !important;
}

/* Sidebar sempre com fundo escuro e texto branco */
.sidebar {
    background: #232a36 !important;
    color: #fff !important;
}

.sidebar.night {
    background: #181c24 !important;
}

.sidebar h2 {
    color: #fff !important;
}

.sidebar a {
    color: #fff !important;
}

/* Main content */
.main.night {
    background: #1e2430 !important;
    color: #e0e0e0 !important;
}

/* Seções */
.section.night {
    background: #232a36 !important;
    color: #e0e0e0 !important;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.4) !important;
}

.section.night h3 {
    color: #fff !important;
}

/* Tabelas */
table.night {
    background: #232a36 !important;
    color: #e0e0e0 !important;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.4) !important;
}

table.night th {
    background: #1e2430 !important;
    color: #fff !important;
}

table.night td {
    background: #232a36 !important;
    color: #e0e0e0 !important;
    border-bottom: 1px solid #2c3e50 !important;
}

table.night tr:hover {
    background: #2c3e50 !important;
}

/* Cards de status */
body.night .card.aberto {
    background: linear-gradient(120deg, #2c0000, #b71c1c 90%) !important;
    color: #fff !important;
}

body.night .card.analise {
    background: linear-gradient(120deg, #4a2c00, #f57c00 90%) !important;
    color: #fff !important;
}

body.night .card.resolvido {
    background: linear-gradient(120deg, #0d1f0f, #2e7d32 90%) !important;
    color: #fff !important;
}

/* Headers */
body.night .header h1 {
    color: #fff !important;
}

/* Formulários */
body.night input, 
body.night select, 
body.night textarea {
    background: #2a2a3d !important;
    color: #e0e0e0 !important;
    border: 1px solid #3e3e5c !important;
}

body.night label {
    color: #e0e0e0 !important;
}

/* Botões */

body.night .btn:hover {
    background: #1565c0 !important;
}

/* Modal de chat */
#chatModalContent.night {
    background: #232a36 !important;
    color: #e0e0e0 !important;
}

/* Status coloridos com melhor contraste no modo noturno */
body.night span[style*="color:#d32f2f"] {
    color: #ff6b6b !important;
}

body.night span[style*="color:#fbc02d"] {
    color: #ffd54f !important;
}

body.night span[style*="color:#388e3c"] {
    color: #81c784 !important;
}

/* Responsivo para mobile */
@media (max-width: 1200px) {
    .sidebar.night {
        background: #181c24 !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4) !important;
    }
    
    .sidebar.night a {
        color: #fff !important;
    }
    
    /* Cards em dispositivos móveis no modo noturno */
    body.night .card.aberto {
        background: linear-gradient(120deg, #2c0000, #b71c1c 90%) !important;
    }
    
    body.night .card.analise {
        background: linear-gradient(120deg, #4a2c00, #f57c00 90%) !important;
    }
    
    body.night .card.resolvido {
        background: linear-gradient(120deg, #0d1f0f, #2e7d32 90%) !important;
    }
}

/* Garantir visibilidade do switch de modo */
.mode-switch {
    position: fixed !important;
    left: 18px !important;
    bottom: 18px !important;
    z-index: 9999 !important;
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.mode-switch.night {
    background: #232a36 !important;
    color: #fff !important;
    border-color: #90caf9 !important;
}

.mode-switch.light {
    background: #e3f2fd !important;
    color: #1976d2 !important;
    border-color: #1976d2 !important;
}

/* Prevenção de flash branco */
.night-mode-preload,
.night-mode-preload * {
    transition: none !important;
}

html.night-mode-preload,
html.night-mode-preload body,
html.night-mode-preload .main,
html.night-mode-preload .section,
html.night-mode-preload .sidebar {
    background-color: #181c24 !important;
    color: #e0e0e0 !important;
}

html.night-mode-preload table,
html.night-mode-preload .ticket-table {
    background-color: #232a36 !important;
    color: #e0e0e0 !important;
}
