/* ===== VARIÁVEIS CSS ===== */
:root {
    /* Cores principais */
    --primary-color: #0d6efd;
    --primary-dark: #0b5ed7;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    
    /* Backgrounds */
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --bg-gray-50: #f9fafb;
    --bg-gray-100: #f3f4f6;
    
    /* Navbar */
    --navbar-height: 60px;
    
    /* Texto */
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #6c757d;
    
    /* Bordas */
    --border-color: #dee2e6;
    --border-radius: 0.375rem;
    --border-radius-lg: 0.5rem;
    
    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Transições */
    --transition: all 0.3s ease;
    --transition-fast: all 0.15s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
}

/* ===== LAYOUT PRINCIPAL ===== */
.main-content {
    padding-top: var(--navbar-height);
    min-height: 100vh;
}

.main-content .container-fluid {
    padding: 2rem 1rem;
}

/* ===== NAVBAR CUSTOMIZADO ===== */
.navbar {
    height: var(--navbar-height);
    box-shadow: var(--shadow-sm);
    z-index: 1030;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

.navbar .btn-link {
    color: var(--text-secondary);
    text-decoration: none;
    border: none;
    background: none;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition-fast);
}

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

/* ===== SIDEBAR OFFCANVAS ===== */
.offcanvas {
    width: 280px;
}

.offcanvas-header {
    padding: 1.5rem;
    background-color: var(--bg-white);
}

.offcanvas-body {
    background-color: var(--bg-white);
}

/* ===== NAVEGAÇÃO DA SIDEBAR ===== */
.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition-fast);
    border-radius: var(--border-radius);
    font-weight: 500;
}

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

/* Estilo para abas ativas - melhor legibilidade */
.nav-link.active {
    background-color: var(--primary-color) !important;
    color: white !important;
    font-weight: 600 !important;
}

.nav-link.active:hover {
    background-color: var(--primary-dark) !important;
    color: white !important;
}

/* Ícones das abas ativas também ficam brancos */
.nav-link.active i {
    color: white !important;
}

.nav-link.bg-primary {
    background-color: var(--primary-color) !important;
    color: white !important;
}

.nav-link.bg-primary:hover {
    background-color: var(--primary-dark) !important;
    color: white !important;
}

.nav-link i {
    width: 20px;
    text-align: center;
}

/* ===== CARDS E COMPONENTES ===== */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

/* ===== BOTÕES CUSTOMIZADOS ===== */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition-fast);
}

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

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

/* ===== TABELAS ===== */
.table {
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table thead th {
    background-color: var(--bg-gray-50);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
}

.table tbody tr:hover {
    background-color: var(--bg-gray-50);
}

/* ===== FORMULÁRIOS ===== */
.form-control {
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

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

/* ===== BADGES E STATUS ===== */
.badge {
    font-weight: 500;
    border-radius: var(--border-radius);
}

.status-pendente {
    background-color: var(--warning-color);
    color: var(--dark-color);
}

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

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

/* ===== CALENDÁRIO ===== */
.calendar {
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.calendar-header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    text-align: center;
    font-weight: 600;
}

.calendar-day {
    aspect-ratio: 1;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    background-color: var(--bg-white);
}

.calendar-day:hover {
    background-color: var(--bg-gray-50);
}

.calendar-day.today {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

.calendar-day.has-ponto {
    background-color: var(--success-color);
    color: white;
}

.calendar-day.feriado {
    background-color: var(--bg-white);
    color: var(--text-color);
}

/* ===== MODAIS ===== */
.modal-content {
    border-radius: var(--border-radius-lg);
    border: none;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-white);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-gray-50);
}

/* Correção para conflitos entre SweetAlert e Bootstrap Modal */
.modal {
    z-index: 1055 !important;
}

.modal-backdrop {
    z-index: 1050 !important;
}

/* Garantir que SweetAlert apareça acima dos modais quando necessário */
.swal2-container {
    z-index: 2000 !important;
}

.swal2-container-custom {
    z-index: 2100 !important;
}

/* Evitar sobreposição de elementos */
.swal2-toast {
    z-index: 2200 !important;
}

/* Configuração responsiva para modais */
.modal-dialog {
    margin: 1.75rem auto;
}

/* Modal padrão - largura média */
.modal-dialog:not(.modal-sm):not(.modal-lg):not(.modal-xl) {
    max-width: 600px;
}

/* Garantir que as classes do Bootstrap funcionem corretamente */
.modal-dialog.modal-lg {
    max-width: 800px;
}

.modal-dialog.modal-xl {
    max-width: 1140px;
}

@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    /* Em telas pequenas, todos os modais ficam responsivos */
    .modal-dialog.modal-lg,
    .modal-dialog.modal-xl {
        max-width: calc(100% - 1rem);
    }
}

/* ===== DROPDOWNS ===== */
.dropdown-menu {
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    transition: var(--transition-fast);
}

.dropdown-item:hover {
    background-color: var(--bg-gray-50);
}

.dropdown-header {
    font-weight: 600;
    color: var(--text-primary);
    padding: 0.5rem 1rem;
}

/* ===== ALERTAS E NOTIFICAÇÕES ===== */
.alert {
    border-radius: var(--border-radius-lg);
    border: none;
    box-shadow: var(--shadow-sm);
}

.toast {
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
}

/* ===== PAGINAÇÃO ===== */
.pagination .page-link {
    border-radius: var(--border-radius);
    margin: 0 2px;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.pagination .page-link:hover {
    background-color: var(--bg-gray-50);
    border-color: var(--primary-color);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ===== UTILITÁRIOS ===== */
.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.border-primary {
    border-color: var(--primary-color) !important;
}

.shadow-custom {
    box-shadow: var(--shadow) !important;
}

.rounded-custom {
    border-radius: var(--border-radius-lg) !important;
}

/* ===== SIDEBAR FIXA NO DESKTOP ===== */
@media (min-width: 768px) {
    .sidebar-fixed {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        overflow-y: auto !important;
        z-index: 1020 !important;
    }
    
    .content-with-fixed-sidebar {
        margin-left: 25% !important; /* col-md-3 = 25% */
    }
}

@media (min-width: 992px) {
    .content-with-fixed-sidebar {
        margin-left: 16.666667% !important; /* col-lg-2 = 16.666667% */
    }
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 768px) {
    .main-content .container-fluid {
        padding: 1rem 0.5rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .table-responsive {
        border-radius: var(--border-radius-lg);
    }
}

@media (max-width: 576px) {
    .navbar-brand span {
        display: none;
    }
    
    .main-content .container-fluid {
        padding: 0.5rem;
    }
}

/* ===== ANIMAÇÕES ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* ===== LOADING STATES ===== */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .navbar,
    .offcanvas,
    .btn,
    .dropdown {
        display: none !important;
    }
    
    .main-content {
        padding-top: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid var(--border-color) !important;
    }
}