/* ============================================================
   1. VARIÁVEIS E CONFIGURAÇÕES GERAIS
   ============================================================ */
:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --info: #3b82f6;
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: row; /* Mantém Sidebar e Conteúdo lado a lado */
    margin: 0;
    overflow-x: hidden;
    /* Segurança contra seleção de texto */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Permite seleção apenas em campos de entrada */
input, textarea, select {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* ============================================================
   2. ESTRUTURA PRINCIPAL (LAYOUT)
   ============================================================ */

/* Sidebar Fixa */
.sidebar {
    width: 260px;
    background: #1e1e2d;
    color: white;
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    transition: all 0.3s ease;
    z-index: 1000;
}

/* Conteúdo Principal */
.main-content {
    flex: 1;
    margin-left: 260px; /* Abre espaço para a sidebar fixa */
    padding: 30px;
    background: #151521;
    min-height: 100vh;
    transition: all 0.3s ease;
}

/* Container de Conteúdo */
.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto 40px auto;
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeIn 0.4s ease-in-out;
}

/* ============================================================
   3. ELEMENTOS DE INTERFACE (Botões, Tabelas, etc)
   ============================================================ */

h2, h3 {
    margin-bottom: 20px;
    font-weight: 700;
    color: #6366f1;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-primary { background: var(--accent-gradient); color: white; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4); }

.table-responsive { overflow-x: auto; margin-top: 20px; }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
table th { background: rgba(255, 255, 255, 0.05); padding: 15px; color: var(--text-muted); text-align: left; }
table td { padding: 15px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }

/* Botão Mobile (Toggle) */
.mobile-toggle {
    display: none; 
    position: fixed;
    top: 15px; 
    right: 15px;
    width: 45px;
    height: 45px;
    background: var(--accent-gradient); 
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.2rem;
    z-index: 2000; 
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   4. RESPONSIVIDADE (MEDIA QUERIES)
   ============================================================ */

/* Tablet e Mobile Geral (992px) */
@media (max-width: 992px) {
    .mobile-toggle { display: flex; }

    .sidebar {
        left: -260px; /* Esconde a sidebar */
        background: var(--bg-card) !important;
    }

    .sidebar.active { left: 0; box-shadow: 5px 0 20px rgba(0,0,0,0.5); }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding-top: 80px !important;
    }

    .container {
        width: 100%;
        margin: 10px 0;
        border-radius: 0;
    }
}

/* Celulares (600px) e Tela de Login */
@media (max-width: 600px) {
    h2, h3 { font-size: 1.2rem; }
    .btn { width: 100%; justify-content: center; }

    /* Centralização apenas no Login */
    body.pagina-login {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 20px;
        flex-direction: column;
    }

    .pagina-login .login-container {
        width: 95% !important;
        max-width: 350px;
        margin: 0 auto !important;
        padding: 25px !important;
    }

    /* Dashboard volta ao normal no Mobile */
    body:not(.pagina-login) {
        display: block; 
    }
    
    input { font-size: 16px !important; }
}

/* Animações */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   ADICIONAR ESTES BLOCOS AO SEU STYLE.CSS
   ============================================================ */

/* 1. Ajuste de espaçamento para Formulários */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 14px;
}

/* 2. Garantir que os inputs ocupem a largura correta dentro do container */
.container input, 
.container select, 
.container textarea {
    width: 100%;
    padding: 12px 15px;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    transition: all 0.3s ease;
}

.container input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
    outline: none;
}

/* 3. Ajuste para o cabeçalho das páginas de cadastro */
header h2 {
    margin-bottom: 5px;
}

header p {
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* 4. Correção para alinhar botões em formulários */
.container .btn {
    margin-top: 10px;
}

/* ============================================================
   REVISÃO DA DASHBOARD (Garante que nada quebre)
   ============================================================ */
@media (max-width: 992px) {
    .main-content {
        padding: 20px !important; /* Respiro lateral no mobile */
    }
    
    .container {
        padding: 20px !important;
    }
}

/* ============================================================
   CORREÇÃO DE CAMPOS SUPRIMIDOS NA DASHBOARD (MOBILE)
   ============================================================ */

@media (max-width: 992px) {
    /* Garante que os cards de meta e progresso ocupem a largura total */
    .dashboard-grid, 
    .stats-container,
    .row {
        display: flex !important;
        flex-direction: column !important; /* Empilha os elementos um sobre o outro */
        gap: 15px !important;
        width: 100% !important;
    }

    /* Impede que os cards fiquem "esmagados" */
    .card, 
    .progress-card, 
    .recent-activity {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        display: block !important; /* Garante visibilidade */
    }

    /* Ajusta o padding do conteúdo para não sufocar os dados */
    .main-content {
        padding: 15px !important;
    }
}

/* Força a exibição de elementos que possam ter sido escondidos por overflow */
.container {
    overflow: visible !important;
}
/* ============================================================
   CORREÇÃO DEFINITIVA PARA GERENCIAR_USUARIOS (MOBILE)
   ============================================================ */

@media (max-width: 992px) {
    /* 1. Faz o conteúdo principal usar 100% da largura real do telemóvel */
    .main-content {
        margin-left: 0 !important;
        padding: 10px !important;
        width: 100vw !important;
    }

    /* 2. Ajusta o container para não ter margens que "esmagam" a tabela */
    .container {
        margin: 0 !important;
        padding: 15px !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 0 !important;
    }

    /* 3. Ativa o scroll horizontal na tabela para ela não ser suprimida */
    .table-responsive {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important; /* Permite deslizar para o lado */
        -webkit-overflow-scrolling: touch; /* Scroll suave no iOS */
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
    }

    /* 4. Garante que a tabela tenha um tamanho mínimo para ser legível */
    table {
        min-width: 600px !important; /* Impede que as colunas fiquem muito estreitas */
        font-size: 13px !important;
    }

    /* 5. Ajuste nos botões de ação dentro da tabela para não quebrarem linha */
    table td .btn {
        padding: 6px 10px !important;
        font-size: 12px !important;
        margin: 2px !important;
    }
}

/* Garante que os títulos da tabela fiquem sempre visíveis e alinhados */
th {
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.08) !important;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: bold;
    display: inline-block;
}

/* Mova isso para o style.css */
.badge-notificacao { 
    background: #ef4444; 
    color: white; 
    font-size: 10px; 
    padding: 2px 6px; 
    border-radius: 20px; 
    font-weight: bold; 
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4); 
    animation: pulse-red 2s infinite; 
}

@keyframes pulse-red { 
    0% { transform: scale(1); } 
    50% { transform: scale(1.1); } 
    100% { transform: scale(1); } 
}