/* ===== VARIÁVEIS ===== */
:root {
    --primary: #4e73df;
    --secondary: #858796;
    --success: #1cc88a;
    --info: #36b9cc;
    --warning: #f6c23e;
    --danger: #e74a3b;
    --light: #f8f9fc;
    --dark: #5a5c69;
    --sidebar-width: 250px;
    --transition: all 0.3s ease;
}

/* ===== ESTILOS GERAIS ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fc;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: var(--primary);
}

a:hover {
    color: #224abe;
}

/* ===== LAYOUT ===== */
.wrapper {
    display: flex;
    width: 100%;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary) 10%, #224abe 100%);
    color: #fff;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: var(--transition);
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

.sidebar-header {
    padding: 1.5rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
}

.sidebar-header h3 {
    margin-bottom: 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.sidebar-header strong {
    font-size: 2rem;
    font-weight: 800;
}

.sidebar .components {
    padding: 0;
}

.sidebar .components li {
    list-style: none;
}

.sidebar .components li a {
    padding: 1rem;
    display: block;
    color: rgba(255, 255, 255, 0.8);
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar .components li a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-left: 3px solid #fff;
}

.sidebar .components li a.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-left: 3px solid #fff;
}

.sidebar .components li a i {
    margin-right: 0.5rem;
    width: 1.5rem;
    text-align: center;
}

.sidebar .CTAs {
    padding: 1rem;
    position: absolute;
    bottom: 0;
    width: 100%;
}

.sidebar .CTAs .logout {
    display: block;
    padding: 0.75rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
    border-radius: 0.35rem;
    transition: var(--transition);
}

.sidebar .CTAs .logout:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
}

/* ===== CONTEÚDO PRINCIPAL ===== */
.content {
    width: calc(100% - var(--sidebar-width));
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

.main-content {
    padding: 1.5rem;
}

/* ===== NAVBAR ===== */
.navbar {
    background: #fff !important;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    padding: 0.75rem 1.5rem;
}

.navbar .navbar-toggler {
    border: none;
    font-size: 1.25rem;
}

.navbar .navbar-toggler:focus {
    box-shadow: none;
}

.navbar .dropdown-menu {
    border: none;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

/* ===== BOTÃO TOGGLE SIDEBAR ===== */
#sidebarCollapse {
    background: var(--primary);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.35rem;
    margin-right: 1rem;
    transition: var(--transition);
    cursor: pointer;
}

#sidebarCollapse:hover {
    background: #224abe;
    transform: scale(1.05);
}

#sidebarCollapse:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

/* ===== SIDEBAR TOGGLE FUNCIONAL ===== */
.sidebar.hidden {
    transform: translateX(-100%);
}

.content.expanded {
    width: 100%;
    margin-left: 0;
}

/* ===== OVERLAY PARA MOBILE ===== */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    cursor: pointer;
}

.overlay.active {
    display: block;
}

/* ===== CARDS ===== */
.card {
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
    border: 1px solid #e3e6f0;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 0.5rem 2rem 0 rgba(58, 59, 69, 0.15);
    transform: translateY(-2px);
}

.card .card-header {
    background: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
    font-weight: 700;
    color: var(--dark);
}

/* ===== BADGES ===== */
.badge {
    font-weight: 500;
}

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

.btn:hover {
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* ===== TABELAS ===== */
.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table th {
    font-weight: 700;
    color: var(--dark);
    border-top: 1px solid #e3e6f0;
    border-bottom: 2px solid #e3e6f0;
    padding: 0.75rem;
}

.table td {
    padding: 0.75rem;
    vertical-align: middle;
    border-top: 1px solid #e3e6f0;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: #f8f9fc;
}

.table-hover tbody tr:hover {
    background-color: rgba(78, 115, 223, 0.05);
}

/* ===== FORMULÁRIOS ===== */
.form-label {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    border-radius: 0.35rem;
    border: 1px solid #d1d3e2;
    padding: 0.75rem;
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
    transform: translateY(-1px);
}

.input-group-text {
    background: #eaecf4;
    border: 1px solid #d1d3e2;
    color: var(--dark);
}

/* ===== ALERTAS ===== */
.alert {
    border-radius: 0.35rem;
    border: none;
    margin-bottom: 1.5rem;
}

.alert-dismissible .btn-close {
    padding: 0.75rem;
}

/* ===== MODAIS ===== */
.modal-content {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.5);
}

.modal-header {
    border-bottom: 1px solid #e3e6f0;
    padding: 1rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #e3e6f0;
    padding: 1rem 1.5rem;
}

/* ===== PÁGINA DE LOGIN ===== */
.login-body {
    background: linear-gradient(135deg, var(--primary) 0%, #224abe 100%);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.5);
}

.login-card .card-header {
    border-radius: 1rem 1rem 0 0 !important;
    background: linear-gradient(135deg, var(--primary) 0%, #224abe 100%);
    border: none;
    padding: 2rem;
}

.login-card .card-body {
    padding: 2rem;
}

/* ===== FOOTER ===== */
.footer {
    background: #fff;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e3e6f0;
    margin-top: auto;
}

/* ===== UTILITÁRIOS ===== */
.text-small {
    font-size: 0.875rem;
}

.cursor-pointer {
    cursor: pointer;
}

/* ===== ANIMAÇÕES ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

/* ===== GRÁFICOS ===== */
.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
}

/* ===== SCROLLBAR PERSONALIZADA ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar:not(.hidden) {
        transform: translateX(0);
    }
    
    .content {
        width: 100%;
        margin-left: 0;
    }
    
    .overlay.active {
        display: block;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .navbar {
        padding: 0.5rem 1rem;
    }
    
    #sidebarCollapse {
        padding: 0.4rem 0.8rem;
        margin-right: 0.5rem;
    }
}

@media (max-width: 576px) {
    .main-content {
        padding: 0.75rem;
    }
    
    .card .card-body {
        padding: 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
}