@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

/* --- 1. VARIÁVEIS GLOBAIS --- */
:root {
    --primary: #4F46E5; 
    --primary-dark: #4338ca;
    --primary-light: #EEF2FF;
    --bg-body: #F3F4F6;
    --bg-panel: #FFFFFF;
    --text-main: #111827;
    --text-sec: #6B7280;
    --border-color: #E5E7EB;
    --radius: 16px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode {
    --bg-body: #0F172A;
    --bg-panel: #1E293B;
    --text-main: #F9FAFB;
    --text-sec: #94A3B8;
    --border-color: #334155;
    --primary-light: rgba(79, 70, 229, 0.15);
}

/* --- 2. RESET GERAL --- */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Plus Jakarta Sans', sans-serif; list-style: none; text-decoration: none; outline: none;}

body {
    background: var(--bg-body);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    overflow: hidden;
    transition: background 0.3s ease;
}

/* --- 3. LOGIN & FORMULÁRIOS --- */
.login-body { align-items: center; justify-content: center; padding: 20px; overflow-y: auto; }
.login-card {
    background: var(--bg-panel); width: 100%; max-width: 400px; padding: 40px;
    border-radius: var(--radius); box-shadow: var(--shadow-md); border: 1px solid var(--border-color);
    animation: slideUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.logo-area { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 30px; }
.logo-icon { width: 40px; height: 40px; background: var(--primary); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 24px; }
.logo-text { font-size: 22px; font-weight: 700; color: var(--text-main); letter-spacing: -0.5px; }

.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-main); margin-bottom: 8px; }

/* Wrapper do Ícone */
.input-wrapper { position: relative; display: flex; align-items: center; width: 100%; }
.input-wrapper i { 
    position: absolute; 
    left: 14px; 
    color: var(--text-sec); 
    font-size: 20px; 
    z-index: 10; 
    pointer-events: none; 
}

/* Estilo Base dos Inputs */
.form-input, .form-control {
    width: 100%; 
    padding: 12px; 
    border: 1px solid var(--border-color); 
    border-radius: 12px;
    font-size: 14px; 
    color: var(--text-main); 
    transition: all 0.3s; 
    background: var(--bg-body);
}

.input-wrapper .form-control,
.input-wrapper input,
.input-wrapper select {
    padding-left: 44px !important;
}

select option {
    background-color: var(--bg-panel);
    color: var(--text-main);
}

.form-input:focus, .form-control:focus { border-color: var(--primary); background: var(--bg-panel); box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1); }
.btn-login, .btn-primary {
    width: 100%; padding: 14px; background: var(--primary); color: white; border: none; border-radius: 12px;
    font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.3s; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-login:hover, .btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }

/* --- 4. SIDEBAR MENU --- */
.sidebar {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    transition: all 0.3s ease;
    z-index: 100;
}

.nav-menu { 
    padding: 24px 16px; 
    flex: 1; 
    overflow-y: auto; 
    scrollbar-width: none; 
}
.nav-menu::-webkit-scrollbar { display: none; width: 0; background: transparent; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-sec); margin: 0 0 10px 12px; font-weight: 600; }
.nav-item { margin-bottom: 4px; }
.nav-link {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px;
    color: var(--text-sec); font-weight: 500; transition: var(--transition); position: relative;
}
.nav-link:hover, .nav-link.active { background: var(--primary-light); color: var(--primary); }
.nav-link.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); height: 20px; width: 4px; background: var(--primary); border-radius: 0 4px 4px 0; }
.user-mini-card { padding: 20px; border-top: 1px solid var(--border-color); display: flex; align-items: center; gap: 12px; cursor: pointer; }
.user-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.user-info h4 { font-size: 14px; color: var(--text-main); }
.user-info span { font-size: 12px; color: var(--text-sec); }

/* --- 5. MAIN CONTENT --- */
.main-content { flex: 1; display: flex; flex-direction: column; height: 100vh; overflow: hidden; position: relative; }
.top-header {
    height: 80px; background: var(--bg-panel); display: flex; justify-content: space-between; align-items: center;
    padding: 0 32px; border-bottom: 1px solid var(--border-color); flex-shrink: 0;
}
.header-title h1 { font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.header-title p { font-size: 13px; color: var(--text-sec); margin: 0; }

.header-actions { display: flex; align-items: center; gap: 16px; }
.btn-icon {
    width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: center; color: var(--text-sec);
    background: var(--bg-panel); cursor: pointer; transition: var(--transition);
}
.btn-icon:hover { background: var(--bg-body); color: var(--primary); border-color: var(--primary); }
.scroll-area { flex: 1; overflow-y: auto; padding: 32px; }

/* Container que se adapta à tela */
.form-container { 
    background: var(--bg-panel); 
    padding: 30px; 
    border-radius: var(--radius); 
    border: 1px solid var(--border-color); 
    width: 100%;       
    max-width: 1400px; 
    margin: 0;         
}

@media (min-width: 1600px) { .form-grid { gap: 30px; } }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media(max-width: 768px) { .form-grid { grid-template-columns: 1fr; } }
.error-msg { background: #FEF2F2; color: #991B1B; padding: 12px; border-radius: 8px; border: 1px solid #FEE2E2; margin-bottom: 20px; text-align: center; }
.success-msg { background: #DCFCE7; color: #166534; padding: 12px; border-radius: 8px; border: 1px solid #BBF7D0; margin-bottom: 20px; text-align: center; }

/* --- 6. LOGIN SPLIT SCREEN --- */
.split-screen { display: flex; height: 100vh; width: 100%; overflow: hidden; }
.split-left {
    flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center;
    background: var(--bg-panel); padding: 40px; position: relative; z-index: 2;
}
.split-right {
    flex: 1.5; position: relative; background-color: var(--primary);
    background-image: url('https://images.unsplash.com/photo-1545324418-cc1a3fa10c00?q=80&w=2070&auto=format&fit=crop'); 
    background-size: cover; background-position: center;
}
.split-right::after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(to bottom, rgba(0,0,0,0.2), rgba(0,0,0,0.6)); }
.login-card-clean { width: 100%; max-width: 380px; background: transparent; border: none; box-shadow: none; animation: slideUp 0.6s ease; }
.hero-text { position: absolute; bottom: 50px; left: 50px; color: white; z-index: 3; max-width: 500px; }
.hero-text h2 { font-size: 32px; font-weight: 700; margin-bottom: 10px; }
.hero-text p { font-size: 16px; opacity: 0.9; }
@media (max-width: 900px) { .split-right { display: none; } .split-left { flex: 1; background: var(--bg-body); } }

/* --- 7. RESPONSIVO MOBILE E MENU LATERAL --- */
.overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh;
    background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); z-index: 90;
    display: none; opacity: 0; transition: opacity 0.3s;
}
.overlay.active { display: block; opacity: 1; }

.menu-toggle { display: none; font-size: 28px; cursor: pointer; color: var(--text-main); }

/* TODAS as regras para celular ficam aqui dentro: */
@media (max-width: 992px) {
    
    /* Força o menu a ficar escondido ao carregar na versão mobile */
    .sidebar { 
        position: fixed !important; 
        left: -300px !important; 
        width: 260px; 
        z-index: 100; 
        box-shadow: 5px 0 15px rgba(0,0,0,0.5);
        transition: left 0.3s ease !important;
    }
    
    /* Quando a classe active é adicionada via JS, o menu aparece */
    .sidebar.active { left: 0 !important; }
    
    /* Mostra o ícone de hambúrguer */
    .menu-toggle { display: block; }
    
    /* Ajustes no layout principal */
    .main-content { margin-left: 0 !important; width: 100%; }
    .top-header { padding: 0 20px; }
    .header-title h1 { font-size: 18px; } 
    .header-title p { display: none; } 

    /* Destrava o corpo da página para permitir o Pull-to-Refresh */
    body, .main-content { height: auto !important; overflow: visible !important; display: block !important; }
    .scroll-area { overflow-y: visible !important; padding-bottom: 80px; }
    
    /* Prende o cabeçalho no teto para não sumir ao rolar a página */
    .top-header { position: sticky !important; top: 0; z-index: 50; }
}
