/* Reset e estilos globais */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    /* ADIÇÃO DE NOVA VARIÁVEL PARA DESTAQUE AZUL CLARO */
    --primary-light: #eff6ff;
    --success-color: #16a34a;
    --danger-color: #dc2626;
    --warning-color: #ea580c;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --sidebar-width: 250px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    overflow-x: hidden; /* Impede a barra de rolagem horizontal */
    width: 100%;        /* Garante que o corpo não exceda 100% */
}

/* ADIÇÃO: Ajustes para o Select2 */
.select2-container {
    width: 100% !important; /* Força o Select2 a usar a largura total */
}

/* Garante que o select dentro do modal tenha espaço */
.modal-content .select2-container {
    z-index: 1051; /* Garante que o dropdown apareça sobre o modal */
}

/* Navbar */
.navbar {
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.nav-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-logout {
    color: var(--danger-color);
}

.nav-user {
    color: var(--gray-500);
    font-size: 0.9rem;
}

/* Layout com Sidebar */
.layout-container {
    display: flex;
    margin-top: 70px; /* Altura da navbar */
    min-height: calc(100vh - 70px);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: white;
    border-right: 1px solid var(--gray-200);
    position: fixed;
    left: 0;
    top: 70px;
    bottom: 0;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
}

.sidebar-nav {
    padding: 1.5rem 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: var(--gray-700);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background-color: var(--gray-50);
    color: var(--primary-color);
}

.sidebar-link.active {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 500;
}

.sidebar-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    max-width: calc(100% - var(--sidebar-width));
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.alert-error {
    background-color: #fee2e2;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.alert-success {
    background-color: #dcfce7;
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.alert-warning {
    background-color: #fed7aa;
    color: var(--warning-color);
    border: 1px solid var(--warning-color);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

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

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

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #15803d;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #b91c1c;
}

.btn-secondary {
    background-color: var(--gray-500);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--gray-700);
}

.btn-block {
    width: 100%;
    display: block;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 1050;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    color: var(--gray-900);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
}

.modal-close:hover {
    color: var(--gray-900);
}

/* Tabelas */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

thead {
    background: var(--gray-50);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

tr:hover {
    background: var(--gray-50);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-success {
    background: #dcfce7;
    color: var(--success-color);
}

.badge-danger {
    background: #fee2e2;
    color: var(--danger-color);
}

/* Paginação */
.pagination {
    font-size: 0.9rem;
    color: var(--gray-500);
    text-align: center;
    margin-top: 2rem;
}
.pagination .step-links a {
    color: var(--primary-color);
    text-decoration: none;
    margin: 0 0.5rem;
}
.pagination .step-links a:hover {
    text-decoration: underline;
}
.pagination .current-page {
    font-weight: bold;
    color: var(--gray-900);
    margin: 0 0.5rem;
}

/* ... (mantenha todo o CSS anterior até chegar em Responsive) ... */

/* Responsive */
@media (max-width: 768px) {
    /* Ajuste para Tablets e Celulares */
    
    /* 1. A Sidebar vira uma barra de navegação inferior */
    .sidebar {
        width: 100%;        /* Ocupa toda a largura */
        height: auto;       /* Altura automática */
        top: auto;          /* Remove o posicionamento do topo */
        bottom: 0;          /* Fixa no fundo da tela */
        border-right: none; /* Remove borda lateral */
        border-top: 1px solid var(--gray-200); /* Adiciona borda no topo */
        padding: 0;         /* Remove padding extra */
        z-index: 1000;      /* Garante que fique sobre o conteúdo */
        display: flex;      /* Flexbox para alinhar itens horizontalmente */
        justify-content: space-around; /* Espalha os itens */
    }
    
    /* 2. Ajusta os itens da navegação na barra inferior */
    .sidebar-nav {
        display: flex;
        width: 100%;
        padding: 0;
        justify-content: space-around;
    }

    .sidebar-link {
        flex-direction: column; /* Ícone em cima, texto embaixo */
        align-items: center;
        padding: 0.75rem;
        font-size: 0.75rem; /* Texto menor */
        border-left: none;  /* Remove a borda ativa lateral */
        border-top: 3px solid transparent; /* Borda ativa vai para o topo */
        gap: 0.25rem;
    }

    .sidebar-link.active {
        background-color: transparent;
        color: var(--primary-color);
        border-left-color: transparent;
        border-top-color: var(--primary-color); /* Indicador ativo no topo */
    }
    
    .sidebar-icon {
        width: 24px;
        height: 24px;
    }
    
    /* 3. Ajusta o Conteúdo Principal para não bater na barra inferior */
    .main-content {
        margin-left: 0; /* Remove a margem lateral */
        max-width: 100%;
        padding: 1rem;
        padding-bottom: 80px; /* Adiciona espaço extra no fundo para a barra não cobrir o conteúdo */
    }
    
    /* 4. Ajustes na Navbar superior */
    .nav-container {
        padding: 0 1rem;
    }
    
    .nav-brand h1 {
        font-size: 1.2rem;
    }

    .nav-menu {
        gap: 1rem;
    }
    
    /* Esconde o nome do usuário no mobile para economizar espaço */
    .nav-user {
        display: none;
    }

    /* Ajustes nos Grids */
    .filiais-grid,
    .turno-info-grid,
    .relatorios-grid {
        grid-template-columns: 1fr !important; /* Força uma coluna só */
        grid-template-areas: 
            "timeline"
            "users_done"
            "users_pass"
            "filial"; /* Reorganiza áreas do grid de relatórios */
    }
    
    .dashboard-info {
        flex-direction: column;
        gap: 0.25rem;
    }
}



/* --- ESTILOS PARA NOTIFICAÇÕES E DESTAQUE --- */



/* Animação suave para o destaque */
@keyframes pulse-border {
    from {
        /* Usa o RGB do seu primary-color: #2563eb */
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); 
    }
    to {
        box-shadow: 0 0 0 5px rgba(37, 99, 235, 0);
    }
}

/* Ajustes no alerta para ser clicável */
.alert.alert-clickable {
    cursor: pointer;
    position: relative;
    padding-right: 3rem; 
}

.alert-message {
    font-weight: 500;
}

.alert-close {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    transition: opacity 0.2s;
    line-height: 1; 
}

.alert-close:hover {
    opacity: 1;
}

/* Corrige o padding-right quando o alerta tem botão de fechar */
.alert.dismissible {
    padding-right: 3rem;
}

.alert.dismissible .alert-message {
    display: block; 
}