/* ==========================================================================
   MATRIZ SNIPER - CSS CONSOLIDADO (VERSÃO CENTRALIZADA)
   ========================================================================== */

:root {
    /* Cores dos Quadrantes Sniper */
    --q1: #e74c3c; /* Vermelho - Urgente/Importante */
    --q2: #2ecc71; /* Verde - Agendar */
    --q3: #f39c12; /* Laranja - Delegar */
    --q4: #95a5a6; /* Cinza - Eliminar */
    
    --primary: #2c3e50; 
    --accent: #3498db;
    --bg: #f8f9fa; 
    --card: #ffffff; 
    --text: #333; 
    --border: #eee;
    --header-text: #ffffff;
}

/* TEMA ESCURO (DARK MODE) */
body.dark-mode {
    --bg: #121212; 
    --card: #1e1e1e; 
    --text: #e0e0e0; 
    --border: #333;
    --primary: #000000; 
    --header-text: #3498db;
}

/* REGRAS GLOBAIS E UTILITÁRIOS */
* { box-sizing: border-box; }
.hidden { display: none !important; } /* Força a ocultação absoluta */

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background: var(--bg); 
    margin: 0; 
    color: var(--text); 
    transition: background 0.3s, color 0.3s; 
}

header { 
    background: var(--primary); 
    color: var(--header-text); 
    padding: 0.8rem 5%; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.3); 
    position: sticky; 
    top: 0; 
    z-index: 900; 
}

main { 
    padding: 2rem 20px; 
    max-width: 1200px; 
    margin: 0 auto; 
}

/* BOTÕES */
.actions { display: flex; align-items: center; gap: 10px; }

.btn-primary { 
    background: var(--accent); 
    color: white; 
    border: none; 
    padding: 8px 15px; 
    border-radius: 5px; 
    cursor: pointer; 
    font-weight: bold; 
    text-decoration: none; 
    font-size: 0.85rem;
    transition: transform 0.1s, filter 0.2s;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: scale(0.98); }

.btn-theme { background: transparent; border: 1px solid var(--accent); color: var(--accent); font-size: 1.2rem; padding: 5px 10px; }
.btn-logout { background: #c0392b; }

/* NAVEGADOR DE LISTAS */
.list-navigator {
    margin-bottom: 25px;
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--card);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

/* GRID DA MATRIZ */
.matrix-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }

.quadrant { 
    background: var(--card); 
    border-radius: 10px; 
    min-height: 250px; 
    overflow: hidden; 
    border: 1px solid var(--border); 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

/* Cores e Cabeçalhos dos Quadrantes */
.q1 { border-top: 8px solid var(--q1); } 
.q2 { border-top: 8px solid var(--q2); } 
.q3 { border-top: 8px solid var(--q3); } 
.q4 { border-top: 8px solid var(--q4); }

.quadrant h3 { padding: 12px; margin: 0; color: white; font-size: 0.9rem; text-align: center; font-weight: bold; }
.q1 h3 { background: var(--q1); } 
.q2 h3 { background: var(--q2); } 
.q3 h3 { background: var(--q3); } 
.q4 h3 { background: var(--q4); }

.task-list { padding: 15px; min-height: 200px; }
.task-card { 
    background: var(--card); 
    border: 1px solid var(--border); 
    padding: 12px; 
    margin-bottom: 10px; 
    border-radius: 8px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}

/* LISTAS DE TABELA (MASTER LIST E ARQUIVO) */
#master-list-container { background: var(--card); border-radius: 10px; padding: 1.5rem; margin-top: 2rem; border: 1px solid var(--border); }
.list-header, .task-item { 
    display: grid; 
    grid-template-columns: 2fr 1fr 1.2fr 60px 60px; 
    gap: 15px; padding: 12px; border-bottom: 1px solid var(--border); align-items: center; 
}
.list-header { font-weight: bold; background: rgba(0,0,0,0.03); }

/* ==========================================================================
   MELHORIA CRITICAL: CENTRALIZAÇÃO DE MODAIS
   ========================================================================== */
#modal-task, #modal-list, #modal-overdue { 
    position: fixed; /* Fixa o container na frente de tudo */
    top: 0; 
    left: 0; 
    width: 100vw; 
    height: 100vh; 
    background: rgba(0, 0, 0, 0.7); /* Fundo escurecido */
    backdrop-filter: blur(3px); /* Efeito moderno de desfoque */
    display: flex; 
    align-items: center;    /* Centraliza Verticalmente */
    justify-content: center; /* Centraliza Horizontalmente */
    z-index: 2000; /* Garante que fique acima de headers e matriz */
}

.modal-content { 
    background: var(--card); 
    padding: 2.5rem; 
    border-radius: 15px; 
    width: 100%;
    max-width: 500px; /* Largura controlada para não esticar */
    color: var(--text); 
    border: 1px solid var(--border); 
    box-shadow: 0 20px 40px rgba(0,0,0,0.4); 
    animation: modalAppear 0.25s ease-out; /* Animação de entrada */
}

@keyframes modalAppear {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* FORMULÁRIOS DENTRO DOS MODAIS */
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; margin-bottom: 8px; font-weight: bold; font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea { 
    background: var(--bg); 
    color: var(--text); 
    border: 1px solid var(--border); 
    width: 100%; 
    padding: 12px; 
    border-radius: 6px; 
    font-size: 0.95rem;
    outline: none;
}
.form-group input:focus { border-color: var(--accent); }

/* ANIMAÇÕES E ALERTAS */
.notification-bell { position: relative; cursor: pointer; font-size: 1.3rem; margin: 0 10px; }
.notification-bell span { position: absolute; top: -5px; right: -8px; background: #e74c3c; color: white; font-size: 0.65rem; padding: 2px 5px; border-radius: 50%; }
.pulse { animation: bell-shake 0.5s infinite; }
@keyframes bell-shake { 0% { transform: rotate(0); } 25% { transform: rotate(10deg); } 50% { transform: rotate(-10deg); } 100% { transform: rotate(0); } }
.overdue-blink { border-left: 5px solid #e74c3c !important; animation: blink-border 1.5s infinite; }
@keyframes blink-border { 50% { border-left-color: transparent; } }

/* RESPONSIVIDADE */
@media (max-width: 800px) { 
    .matrix-grid { grid-template-columns: 1fr; } 
    .modal-content { width: 90%; padding: 1.5rem; }
}