/* --- IMPORTAÇÃO DA FONTE GLOBAL (INTER) --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --- RESET GLOBAL E FONTE --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

/* --- VARIAVEIS GLOBAIS (Light Mode Padrão) --- */
:root { 
    --primary: #C42021; 
    --secondary: #FFB300; 
    --bg-body: #E5E7EB; 
    --bg-card: #FFFFFF; 
    --text-dark: #111827; 
    --text-gray: #6B7280; 
    --border: #D1D5DB; 
}

/* --- VARIAVEIS DO TEMA ESCURO --- */
body.dark-mode {
    --bg-body: #111827;
    --bg-card: #1F2937;
    --text-dark: #F9FAFB;
    --text-gray: #9CA3AF;
    --border: #374151;
}

/* Ajustes para Inputs no Modo Escuro */
body.dark-mode input, 
body.dark-mode select, 
body.dark-mode textarea {
    background-color: #374151;
    color: white;
    border-color: #4B5563;
}

body.dark-mode th {
    background-color: #111827 !important;
    border-color: #374151;
}

body.dark-mode td {
    border-color: #374151;
}

/* --- CENTRAL DE NOTIFICAÇÕES --- */
.notification-wrapper {
    position: relative;
    cursor: pointer;
    margin-right: 20px;
    display: flex;
    align-items: center;
}

.notification-icon {
    font-size: 1.4rem;
    color: var(--text-gray);
    transition: 0.2s;
}
.notification-icon:hover { color: var(--primary); }

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #EF4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid var(--bg-card);
    display: none;
}

/* Dropdown de Notificações */
.notification-dropdown {
    position: absolute;
    top: 50px;
    right: -10px;
    width: 340px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    z-index: 2001;
    overflow: hidden;
}
.notification-dropdown.active { display: flex; animation: fadeIn 0.2s; }

.notif-header {
    padding: 12px 15px;
    background: rgba(0,0,0,0.03);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.btn-mark-read {
    font-size: 0.75rem;
    color: var(--primary);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
}
.btn-mark-read:hover { color: var(--secondary); }

.notif-list {
    max-height: 350px;
    overflow-y: auto;
}
.notif-list::-webkit-scrollbar { width: 5px; }
.notif-list::-webkit-scrollbar-thumb { background-color: var(--border); border-radius: 4px; }

.notif-item {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 12px;
    align-items: start;
    transition: 0.2s;
    cursor: pointer;
    background: var(--bg-card);
}
.notif-item:hover { background: rgba(0,0,0,0.03); }
.notif-item:last-child { border-bottom: none; }

/* Item Não Lido (Destaque) */
.notif-item.unread {
    background: #FEF2F2;
    border-left: 3px solid var(--primary);
}
body.dark-mode .notif-item.unread {
    background: rgba(196, 32, 33, 0.15);
}

/* Ícones redondos dentro da notificação */
.notif-icon-box {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.bg-create { background: #E6FFFA; color: #319795; }
.bg-reopen { background: #FFF5F5; color: #E53E3E; }

body.dark-mode .bg-create { background: rgba(49, 151, 149, 0.2); color: #81E6D9; }
body.dark-mode .bg-reopen { background: rgba(229, 62, 62, 0.2); color: #FC8181; }

.notif-content { flex: 1; }
.notif-content p { margin: 0 0 4px 0; font-size: 0.85rem; color: var(--text-dark); line-height: 1.4; font-weight: 500; }
.notif-content small { font-size: 0.75rem; color: var(--text-gray); }

.empty-notif { padding: 30px; text-align: center; color: var(--text-gray); font-size: 0.9rem; }

/* --- TOASTS --- */
.toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
    display: flex; flex-direction: column; gap: 10px;
}
.toast {
    min-width: 300px; background: white; padding: 15px 20px;
    border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    display: flex; align-items: center; gap: 15px;
    animation: slideIn 0.3s ease-out; border-left: 5px solid;
    font-size: 0.95rem; font-weight: 500; font-family: 'Inter', sans-serif;
    color: #111827;
}
.toast-success { border-color: #48BB78; color: #2F855A; }
.toast-error { border-color: #F56565; color: #C53030; }
.toast-info { border-color: #4299E1; color: #2B6CB0; }
.toast i { font-size: 1.2rem; }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* --- MENU DE PERFIL --- */
.user-info { position: relative; cursor: pointer; }

.profile-popup {
    position: absolute; top: 100%; right: 0; 
    margin-top: 15px;
    background: var(--bg-card);
    width: 220px;
    border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    border: 1px solid var(--border); display: none;
    flex-direction: column; z-index: 2000; overflow: hidden;
    font-family: 'Inter', sans-serif;
}
.profile-popup.active { display: flex; animation: fadeIn 0.2s; }

.profile-header { padding: 15px; border-bottom: 1px solid var(--border); background: rgba(0,0,0,0.03); }
.profile-header p { margin: 0; font-size: 0.85rem; color: var(--text-gray); }
.profile-header strong { display: block; color: var(--text-dark); font-size: 1rem; }

.profile-menu-item {
    padding: 12px 20px; text-decoration: none; color: var(--text-gray);
    display: flex; align-items: center; gap: 10px; transition: 0.2s; cursor: pointer; font-size: 0.9rem;
}
.profile-menu-item:hover { background: rgba(0,0,0,0.05); color: var(--primary); }
.profile-menu-item.logout { color: #E53E3E; border-top: 1px solid var(--border); }
.profile-menu-item.logout:hover { background: #FFF5F5; }

/* --- BOTÃO FLUTUANTE DE TEMA --- */
.theme-toggle-btn {
    position: fixed; bottom: 30px; right: 30px;
    width: 50px; height: 50px;
    border-radius: 50%; border: 1px solid var(--border);
    background-color: var(--bg-card); color: var(--text-dark);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    cursor: pointer; z-index: 9998;
    display: flex; justify-content: center; align-items: center;
    font-size: 1.2rem; transition: all 0.3s ease;
}
.theme-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
    color: var(--primary);
}

/* --- BOTÕES DO MODAL --- */
.modal-buttons-container {
    display: flex; justify-content: center; gap: 15px; margin-top: 25px;
}
.btn-modal {
    padding: 12px 24px; border-radius: 10px; font-weight: 600; font-size: 0.95rem;
    cursor: pointer; border: none; transition: all 0.2s ease;
    display: flex; align-items: center; gap: 8px; font-family: 'Inter', sans-serif;
}
.btn-modal:active { transform: scale(0.98); }

.btn-modal-cancel { background-color: #F3F4F6; color: #4B5563; border: 1px solid #E5E7EB; }
.btn-modal-cancel:hover { background-color: #E5E7EB; color: #1F2937; }

.btn-modal-confirm { background-color: #EF4444; color: white; box-shadow: 0 4px 6px rgba(239, 68, 68, 0.2); }
.btn-modal-confirm:hover { background-color: #DC2626; box-shadow: 0 6px 12px rgba(239, 68, 68, 0.3); transform: translateY(-1px); }

.icon-alert-container {
    background-color: #FEF2F2; width: 80px; height: 80px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px auto;
}

body.dark-mode .icon-alert-container { background-color: rgba(239, 68, 68, 0.15); }
body.dark-mode .btn-modal-cancel { background-color: #374151; color: #D1D5DB; border-color: #4B5563; }
body.dark-mode .btn-modal-cancel:hover { background-color: #4B5563; color: white; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* --- ESTRUTURA DOS MODAIS (CORRIGIDA PARA SCROLL) --- */
.modal-overlay {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Fundo escuro */
    display: none; justify-content: center; align-items: center;
    z-index: 10000; backdrop-filter: blur(4px);
    animation: fadeInOverlay 0.3s forwards;
}

.modal-box {
    background-color: var(--bg-card); color: var(--text-dark);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* --- CORREÇÃO DO FORMULÁRIO CORTADO --- */
    max-height: 90vh;  /* Altura máxima de 90% da tela */
    overflow-y: auto;  /* Barra de rolagem se necessário */
    width: 600px;
    max-width: 95%;
    padding: 30px;
    border-radius: 16px;
    /* -------------------------------------- */

    transform: scale(0.95);
    animation: scaleInModal 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Estilo Bonito para a Barra de Rolagem do Modal */
.modal-box::-webkit-scrollbar { width: 8px; }
.modal-box::-webkit-scrollbar-track { background: transparent; }
.modal-box::-webkit-scrollbar-thumb { background-color: var(--border); border-radius: 10px; }

body.dark-mode .modal-box { background: #1F2937; color: #F9FAFB; }

@keyframes fadeInOverlay { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleInModal { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }