/* assets/css/style.css - Versão Responsiva Mobile-First (Alinhamento Corrigido) */

:root {
    --primary: #2e7d32;      /* Verde FVM */
    --primary-light: #e8f5e9;
    --text-main: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --bg-body: #f1f5f9;
    --bg-sidebar: #0f172a;   /* Azul noturno */
    
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    --sidebar-width: 240px;
    --header-height-mobile: 60px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* --- LOGIN PAGE STYLES --- */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-color: #717171;
}

.login-container {
    background: #2b6d2e;
    padding: 35px 40px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 380px;
    text-align: center;
    border: 1px solid #f1f5f9; 
    transition: all 0.3s ease;
}

.login-container h3 {
    color: #ffffff;
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 1.4em;
    font-weight: 700;
}

.login-container form {
    display: flex;
    flex-direction: column;
}

.login-container input {
    width: 100%; 
    padding: 12px 15px;
    margin-bottom: 15px;
    font-size: 1em;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-container input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
    outline: none;
}

.login-container button {
    width: 100%;
    padding: 12px 15px;
    margin-top: 5px;
    margin-bottom: 5px;
    font-size: 1em;
    font-weight: 600;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.login-container #step1, 
.login-container #step2 {
    display: flex;
    flex-direction: column;
}

.login-container .hidden { display: none !important; }

.login-container #email-display {
    color: #ffffff;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.login-container #step2 button[type="button"] {
    background: #e2e8f0 !important;
    color: var(--text-secondary) !important;
    border: 1px solid #cbd5e1;
}
.login-container #step2 button[type="button"]:hover {
    background: #cbd5e1 !important;
}


/* --- Layout Principal --- */
.wrapper { display: flex; min-height: 100vh; width: 100%; }

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    box-shadow: 4px 0 15px rgba(0,0,0,0.1);
    overflow-y: auto; 
    overflow-x: hidden;
    transition: transform 0.3s ease;
}

/* Estilização da Barra de Rolagem */
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-track { background: #0f172a; }
.sidebar::-webkit-scrollbar-thumb { background-color: #475569; border-radius: 10px; }

/* Fix Logo Achatado */
.sidebar-header { text-align: center; padding: 20px; background: rgba(0,0,0,0.2); }
.sidebar-header img { 
    max-width: 100%; 
    height: auto; 
    max-height: 50px; 
    object-fit: contain; 
}

.user-info { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.9em; }
.user-info strong { display: block; color: #f8fafc; font-size: 1.1em; }

/* --- LINKS DE MENU (CORREÇÃO DE ALINHAMENTO) --- */
.menu-group > a {
    padding: 12px 20px;
    color: #94a3b8;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: flex-start; /* FIX: Alinha à esquerda por padrão */
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

/* NOVO: Aplica space-between APENAS nos menus que têm a seta (toggle) */
.menu-group > a.menu-toggle {
    justify-content: space-between;
}

.menu-group > a:hover, .menu-group > a.active {
    background: rgba(255,255,255,0.05);
    color: #fff;
    border-left-color: var(--primary);
}

.sub-menu { list-style: none; padding: 0; margin: 0; background: #020617; display: none; }
.sub-menu a { padding: 10px 20px 10px 45px; display: block; color: #64748b; text-decoration: none; font-size: 0.9em; }
.sub-menu a:hover { color: #fff; }

.logout { margin-top: auto; padding: 15px; background: #dc2626; color: white !important; text-align: center; text-decoration: none; font-weight: 600; }

/* --- Conteúdo --- */
.content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 30px 40px;
    transition: margin-left 0.3s ease, width 0.3s ease;
}

/* --- Elementos Mobile (Ocultos no Desktop) --- */
.mobile-header { display: none; }
#sidebar-overlay { display: none; }

/* --- Demais Componentes (Mantidos Inalterados) --- */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}
.stat-card {
    background: #fff;
    padding: 20px 24px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}
.stat-card .title { font-size: 0.8em; text-transform: uppercase; letter-spacing: 1px; color: var(--text-secondary); font-weight: 600; margin-bottom: 8px; }
.stat-card .value { font-size: 1.8em; font-weight: 800; color: var(--text-main); }


.project-container {
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    overflow: hidden; 
}

.project-header {
    background: #fff;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    font-size: 1.1em;
    font-weight: 700;
    color: var(--text-main);
}
.project-header i { margin-right: 10px; color: #cbd5e1; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    background: #f8fafc;
    text-align: left;
    padding: 12px 20px;
    font-size: 0.75em;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 700;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

.row-parent td { padding: 16px 20px; border-bottom: 1px solid var(--border-color); cursor: pointer; transition: background 0.15s; vertical-align: middle; }
.row-parent:hover td { background-color: #f1f5f9; }

/* Linha Expandida (Detalhes) */
.row-detail { display: none; background-color: #f8fafc; }
.row-detail td { padding: 0; border-bottom: 1px solid var(--border-color); }

/* Container Interno dos Detalhes */
.detail-content {
    padding: 20px 20px 20px 50px;
    border-left: 4px solid var(--primary);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.inner-table {
    width: 100%;
    font-size: 0.9em;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}
.inner-table th { background: #f1f5f9; padding: 8px 15px; font-size: 0.7em; }
.inner-table td { padding: 8px 15px; border-bottom: 1px solid #f1f5f9; color: #475569; }

/* Badges e Componentes */
.badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 4px; font-size: 0.85em; font-weight: 600; white-space: nowrap; }
.badge-success { background: #d1fae5; color: #065f46; } 
.badge-danger { background: #fee2e2; color: #991b1b; } 

.text-right { text-align: right; }
.text-center { text-align: center; }
.font-mono { font-family: 'Roboto Mono', monospace; letter-spacing: -0.5px; }

/* Inputs e Buttons Globais */
input, select, textarea { width: 100%; padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 4px; margin-top: 5px; }
button { background: var(--primary); color: white; padding: 10px 15px; border: none; border-radius: 4px; cursor: pointer; }
.alert { padding: 15px; margin-bottom: 20px; border-radius: 6px; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }


/* ==========================================================================
   REGRAS DE IMPRESSÃO
   ========================================================================== */
@media print {
    /* Oculta o cabeçalho móvel na impressão */
    .mobile-header,
    .sidebar, 
    .no-print, 
    button, 
    a[href*="delete"], 
    a[href*="edit"] { 
        display: none !important; 
        visibility: hidden;
    }
    
    .wrapper, .content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    .data-table th { background-color: #eee !important; color: black !important; -webkit-print-color-adjust: exact; }
    .project-container { box-shadow: none; border: none; page-break-inside: avoid; }
}

/* ==========================================================================
   RESPONSIVIDADE (MOBILE)
   ========================================================================== */
@media (max-width: 768px) {
    
    /* 1. Cabeçalho Mobile (Ativado) */
    .mobile-header {
        display: flex; 
        align-items: center;
        justify-content: space-between;
        height: var(--header-height-mobile);
        background: var(--bg-sidebar);
        color: white;
        padding: 0 15px;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 1100;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    }
    
    #mobile-menu-btn { background: none; border: none; color: white; font-size: 1.5em; padding: 5px; }
    
    /* 2. Sidebar (Mobile) */
    .sidebar {
        transform: translateX(-100%); 
        width: 280px; 
        padding-top: var(--header-height-mobile); 
        z-index: 1001;
    }
    .sidebar.show { transform: translateX(0); }

    /* Overlay Escuro */
    #sidebar-overlay {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1000;
        display: none;
        backdrop-filter: blur(2px);
    }
    #sidebar-overlay.active { display: block; }

    /* 3. Conteúdo Principal */
    .content {
        margin-left: 0;
        width: 100%;
        padding: 15px;
        padding-top: calc(var(--header-height-mobile) + 15px);
    }

    /* 4. Tabelas e Forms */
    .project-container { 
        overflow-x: auto; 
        -webkit-overflow-scrolling: touch; 
    }
    .data-table { min-width: 700px; } 
    .data-table th, .data-table td { padding: 8px; font-size: 0.8em; }
    
    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    /* 5. Flex Headers (Botões de Ação) */
    .project-header, 
    div[style*="display:flex"]:not(.stats-container) {
        flex-wrap: wrap;
        gap: 10px;
        padding: 15px;
    }
    
    div[style*="display:flex"] a.badge,
    div[style*="display:flex"] button {
        margin-left: 0 !important;
        width: 100%;
        justify-content: center;
        text-align: center;
        padding: 12px;
    }
    
    .stats-container { grid-template-columns: 1fr; }
}