/* Utilitários de Layout */
.container-fluid { width: 100%; padding: 20px; box-sizing: border-box; }
.flex-center { display: flex; justify-content: center; align-items: center; }

/* Botões Premium */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.btn-primary {
    background-color: var(--primary);
    color: #000; /* Texto preto no dourado fica mais legível */
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

/* Inputs Modernos */
.form-control {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

/* --- LAYOUT DO DASHBOARD --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100%;
    z-index: 100;
}

.sidebar-header {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h3 {
    margin-top: 10px;
    font-size: 1.2rem;
    color: var(--text-main);
    line-height: 1.2;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
}

.nav-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 15px 25px 10px;
    letter-spacing: 1px;
    font-weight: 600;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: var(--text-muted);
    transition: all 0.3s;
    font-size: 0.95rem;
}

.sidebar-nav a i { width: 25px; }

.sidebar-nav a:hover, .sidebar-nav a.active {
    background-color: rgba(245, 158, 11, 0.1); /* Dourado transparente */
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
}

.btn-logout {
    display: block;
    text-align: center;
    padding: 10px;
    color: var(--danger);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: 0.3s;
}

.btn-logout:hover {
    background-color: var(--danger);
    color: white;
}

/* Área Principal (Conteúdo) */
.main-content {
    flex: 1;
    margin-left: 260px; /* Largura da sidebar */
    padding: 30px;
    background-color: var(--bg-body);
}

/* Cards do Dashboard */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.kpi-card {
    background-color: var(--bg-card);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.kpi-info h3 { font-size: 2rem; margin: 0; color: var(--text-main); }
.kpi-info p { margin: 5px 0 0; color: var(--text-muted); font-size: 0.9rem; }
.kpi-icon {
    background-color: rgba(255,255,255,0.05);
    width: 50px; height: 50px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: var(--primary);
    font-size: 1.5rem;
}

/* =========================================
   RESPONSIVIDADE (MOBILE)
   ========================================= */

/* Botão de Menu (Só aparece no mobile) */
.mobile-menu-btn {
    display: none; /* Escondido no Desktop */
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 15px;
}

/* Telas menores que 768px (Celulares e Tablets Verticais) */
@media (max-width: 768px) {
    
    /* 1. Ajuste Geral do Layout */
    .main-content {
        margin-left: 0 !important; /* Remove margem da sidebar */
        padding: 15px !important;
        width: 100%;
    }

    /* 2. Sidebar (Menu Lateral) vira uma "Gaveta" */
    .sidebar {
        transform: translateX(-100%); /* Esconde para a esquerda */
        transition: transform 0.3s ease;
        box-shadow: 5px 0 15px rgba(0,0,0,0.5);
    }

    /* Classe que o JS vai adicionar para mostrar o menu */
    .sidebar.active {
        transform: translateX(0);
    }

    /* Botão Hambúrguer visível */
    .mobile-menu-btn {
        display: block;
    }

    /* 3. Header e Topo */
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 15px;
    }
    
    .dashboard-header .btn, 
    .dashboard-header .btn-primary,
    .dashboard-header .btn-secondary {
        width: 100%; /* Botões ocupam largura total */
        text-align: center;
    }

    .flex-center {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    /* 4. Grids (Cards e KPIs) */
    .kpi-grid, 
    .car-grid {
        grid-template-columns: 1fr !important; /* 1 coluna por vez */
    }

    .project-grid {
        grid-template-columns: 1fr !important; /* View.php vira coluna única */
    }

    /* 5. Tabelas Responsivas (Scroll Horizontal) */
    .table-wrapper, 
    .kpi-card {
        overflow-x: auto; /* Permite rolar pro lado se a tabela for grande */
    }
    
    .table-premium {
        min-width: 600px; /* Força a tabela a ter um tamanho mínimo para não espremer */
    }

    /* 6. Modais */
    .modal-content {
        width: 90% !important;
        margin: 20px;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* 7. Formulários (Create/Edit) */
    form div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important; /* Força inputs a ficarem um embaixo do outro */
    }

    /* Overlay Escuro quando menu abre */
    .sidebar-overlay {
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 90; /* Atrás da sidebar (100) mas na frente do conteúdo */
        display: none;
        backdrop-filter: blur(2px);
    }
    .sidebar-overlay.active { display: block; }
}