/* backend/static/css/admin.css (Design "Prestige") */

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

/* ... (Seus estilos existentes para .admin-body, .sidebar, etc. são mantidos) ... */

/* --- CORREÇÃO: Estilos do Cabeçalho Principal --- */
.main-header {
    display: flex;
    align-items: center;
    background-color: var(--card-bg);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    
    /* --- LÓGICA DO CABEÇALHO FIXO --- */
    position: sticky;
    top: 0;
    z-index: 1050; /* Garante que fique acima do conteúdo principal */
}

.main-content {
    flex-grow: 1;
    overflow-y: auto;
}

/* Adiciona o espaçamento de volta para as seções dentro do main-content */
.main-content > section {
    padding: 2.5rem;
}

/* --- NOVO: Estilos para o botão de menu --- */
.menu-toggle-btn {
    background: none;
    border: none;
    color: #333;
    font-size: 1.5rem;
    cursor: pointer;
    display: block; /* Garante que o botão seja sempre visível */
    margin-right: 1.5rem;
}

/* --- NOVO: Estilos para a sidebar recolhida --- */
.admin-body.sidebar-collapsed .sidebar {
    width: 80px;
}
.admin-body.sidebar-collapsed .sidebar-header h2 {
    display: none;
}
.admin-body.sidebar-collapsed .sidebar-nav span {
    display: none;
}
.admin-body.sidebar-collapsed .sidebar-nav i {
    font-size: 1.5rem;
    width: 100%;
    text-align: center;
}
.admin-body.sidebar-collapsed .main-content {
    margin-left: 80px;
}


/* --- Estilos para telas menores (mobile) --- */
/* ============================================================
   CORREÇÃO RESPONSIVA DO DASHBOARD (MOBILE)
   ============================================================ */

@media (max-width: 768px) {
    
    /* 1. Ajuste do Espaçamento Principal e Largura */
    .main-content {
        padding: 1rem !important; /* Menos margem no celular */
        width: 100vw;             /* Garante que não ultrapasse a tela */
        overflow-x: hidden;       /* Evita rolagem horizontal da página inteira */
    }

    .main-content > section {
        padding: 1.5rem 1rem;     /* Reduz padding interno dos cards */
    }

    /* 2. Empilhar Cards e Gráficos (Um por linha) */
    /* Removemos o limite de 400px que estava quebrando o layout */
    .summary-cards, 
    .reports-section {
        grid-template-columns: 1fr !important; /* Força 1 coluna única */
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    /* 3. Correção dos Gráficos (Evita que fiquem gigantes) */
    .chart-container {
        position: relative;
        height: 300px !important; /* Altura fixa menor para celular */
        width: 100% !important;
    }

    /* 4. Ajuste de Tamanho de Fontes */
    .main-header h1 {
        font-size: 1.5rem; 
    }
    
    h2 {
        font-size: 1.2rem;
    }
}

/* 5. CLASSE MÁGICA PARA TABELAS (Permite rolagem horizontal SÓ na tabela) */
.table-responsive {
    width: 100%;
    overflow-x: auto; /* Cria barra de rolagem se a tabela for grande */
    -webkit-overflow-scrolling: touch; /* Rolagem suave no iPhone */
    margin-bottom: 1rem;
    border: 1px solid #e5e7eb; 
    border-radius: 0.5rem;
}

/* Garante que a tabela mantenha a largura das colunas e ative a rolagem */
.data-table {
    min-width: 600px; /* Se a tela for menor que 600px, a barra de rolagem aparece */
}




:root {
    --sidebar-bg: #111827;
    --sidebar-text: #9CA3AF;
    --sidebar-text-hover: #FFFFFF;
    --sidebar-active-bg: #374151;
    
    --content-bg: #F9FAFB;
    --card-bg: #FFFFFF;
    
    --primary-color: #4F46E5; /* Roxo/Índigo */
    --primary-light: #C7D2FE;
    
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    
    --border-color: #E5E7EB;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--content-bg);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Sidebar --- */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid #1F2937;
}

.sidebar-header {
    margin-bottom: 2.5rem;
    padding-left: 0.5rem;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sidebar-text-hover);
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    text-decoration: none;
    color: var(--sidebar-text);
    border-radius: 0.5rem;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar-nav a:hover {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-text-hover);
}

.sidebar-nav a.active {
    background-color: var(--primary-color);
    color: var(--sidebar-text-hover);
}

/* --- Main Content --- */
.main-content {
    flex-grow: 1;
    padding: 2.5rem;
    overflow-y: auto;
}

.main-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2.5rem;
}

/* --- Summary Cards --- */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.card {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.card-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-light);
    color: var(--primary-color);
    font-size: 1.5rem;
    flex-shrink: 0;
}

.card-content h3 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.card-content p {
    font-size: 2rem;
    font-weight: 700;
}

/* --- Recent Data & Forms --- */
.data-management-section, .reports-section, .form-section {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.reports-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.recent-list h2, .form-section h1, .data-management-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.recent-list ul {
    list-style: none;
}

.recent-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}
.recent-list li:last-child {
    border-bottom: none;
}

/* --- Formulários --- */
.form-section {
    max-width: 800px;
}

.admin-form .form-group {
    margin-bottom: 1.5rem;
}

.admin-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.admin-form input,
.admin-form select,
.admin-form textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    background-color: #F9FAFB;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    opacity: 0.9;
    box-shadow: none;
}

.message {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    display: none;
}

.message.success {
    background-color: #ECFDF5;
    color: #065F46;
}

.message.error {
    background-color: #FEF2F2;
    color: #991B1B;
}

.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}

/* --- Tabelas Modernas --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table td {
    font-weight: 500;
}


@media (min-width: 768px) {
    .mobile-only {
        display: none !important;
    }
}
