/* ====================================================================
   SISTEMA FINANCEIRO - ESTILOS PERSONALIZADOS
   ==================================================================== */

:root {
    /* Cores principais */
    --primary-color: #4F46E5;
    --primary-dark: #4338CA;
    --secondary-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --info-color: #3B82F6;
    
    /* Cores de fundo */
    --bg-primary: #F9FAFB;
    --bg-secondary: #FFFFFF;
    --bg-sidebar: #1F2937;
    --bg-sidebar-hover: #374151;
    
    /* Cores de texto */
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-light: #9CA3AF;
    --text-white: #FFFFFF;
    
    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    /* Tamanhos */
    --sidebar-width: 280px;
    --topbar-height: 70px;
    --border-radius: 8px;
    
    /* Transições */
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
}

/* ====================================================================
   SIDEBAR
   ==================================================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--bg-sidebar);
    color: var(--text-white);
    padding: 0;
    overflow-y: auto;
    z-index: 1000;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header i {
    font-size: 28px;
    color: var(--primary-color);
}

.sidebar-header h4 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 16px 0;
}

.menu-item,
.menu-item-group {
    margin-bottom: 4px;
}

.menu-item a,
.menu-group-title {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

.menu-item a:hover,
.menu-group-title:hover {
    background-color: var(--bg-sidebar-hover);
    color: var(--text-white);
}

.menu-item.active a {
    background-color: var(--primary-color);
    color: var(--text-white);
    font-weight: 500;
}

.menu-item a i,
.menu-group-title i:first-child {
    font-size: 18px;
    min-width: 24px;
    margin-right: 12px;
}

.menu-group-title {
    justify-content: space-between;
    font-weight: 500;
}

.toggle-icon {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.menu-item-group.active .toggle-icon {
    transform: rotate(180deg);
}

.submenu {
    list-style: none;
    padding-left: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.menu-item-group.active .submenu {
    max-height: 500px;
}

.submenu .menu-item a {
    padding-left: 56px;
    font-size: 13px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: auto;
}

/* ====================================================================
   MAIN CONTENT
   ==================================================================== */

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

/* ====================================================================
   TOPBAR
   ==================================================================== */

.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background-color: var(--bg-secondary);
    border-bottom: 1px solid #E5E7EB;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 999;
    box-shadow: var(--shadow-sm);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-menu-toggle {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

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

.page-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.topbar-item {
    position: relative;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.topbar-item:hover {
    background-color: var(--bg-primary);
}

.topbar-item i {
    font-size: 20px;
    color: var(--text-secondary);
}

.badge-notification {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: var(--danger-color);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.user-role {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ====================================================================
   CONTENT AREA
   ==================================================================== */

.content-area {
    padding: 30px;
    min-height: calc(100vh - var(--topbar-height));
}

/* ====================================================================
   CARDS
   ==================================================================== */

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border-left: 4px solid transparent;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card.card-receitas {
    border-left-color: var(--secondary-color);
}

.stat-card.card-despesas {
    border-left-color: var(--danger-color);
}

.stat-card.card-saldo {
    border-left-color: var(--primary-color);
}

.stat-card.card-caixa {
    border-left-color: var(--warning-color);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.stat-card-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.card-receitas .stat-card-icon {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--secondary-color);
}

.card-despesas .stat-card-icon {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.card-saldo .stat-card-icon {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
}

.card-caixa .stat-card-icon {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.stat-card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.stat-card-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.stat-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.stat-badge.badge-up {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--secondary-color);
}

.stat-badge.badge-down {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

/* ====================================================================
   CARDS DE CONTEÚDO
   ==================================================================== */

.content-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
}

.content-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #E5E7EB;
}

.content-card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* ====================================================================
   TABELAS
   ==================================================================== */

.table-responsive {
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
}

.custom-table thead {
    background-color: var(--bg-primary);
}

.custom-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #E5E7EB;
}

.custom-table td {
    padding: 16px;
    border-bottom: 1px solid #E5E7EB;
    font-size: 14px;
    color: var(--text-primary);
}

.custom-table tbody tr {
    transition: var(--transition);
}

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

/* ====================================================================
   BADGES
   ==================================================================== */

.badge {
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-em-aberto {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

.badge-pago,
.badge-recebido {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--secondary-color);
}

.badge-atrasado,
.badge-vencido {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.badge-cancelado {
    background-color: rgba(107, 114, 128, 0.1);
    color: var(--text-secondary);
}

/* ====================================================================
   BOTÕES
   ==================================================================== */

.btn-custom {
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

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

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

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

.btn-outline-custom {
    background-color: transparent;
    border: 1px solid #D1D5DB;
    color: var(--text-primary);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ====================================================================
   FILTROS
   ==================================================================== */

.filters-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-input,
.filter-select {
    padding: 10px 12px;
    border: 1px solid #D1D5DB;
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
}

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

.filters-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ====================================================================
   FORMULÁRIOS
   ==================================================================== */

.form-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-label.required::after {
    content: " *";
    color: var(--danger-color);
}

.form-control-custom {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #D1D5DB;
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
}

.form-control-custom:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-control-custom.is-invalid {
    border-color: var(--danger-color);
}

.invalid-feedback {
    font-size: 12px;
    color: var(--danger-color);
    margin-top: 4px;
    display: none;
}

.form-control-custom.is-invalid ~ .invalid-feedback {
    display: block;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #E5E7EB;
}

/* ====================================================================
   GRÁFICOS
   ==================================================================== */

.chart-container {
    position: relative;
    height: 300px;
    margin-top: 20px;
}

/* ====================================================================
   PAGINAÇÃO
   ==================================================================== */

.pagination-custom {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination-custom .page-link {
    padding: 8px 14px;
    border: 1px solid #D1D5DB;
    border-radius: var(--border-radius);
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

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

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

/* ====================================================================
   RESPONSIVIDADE
   ==================================================================== */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .topbar {
        padding: 0 16px;
    }
    
    .content-area {
        padding: 16px;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .filters-row {
        grid-template-columns: 1fr;
    }
    
    .user-info {
        display: none;
    }
    
    .table-responsive {
        font-size: 12px;
    }
    
    .custom-table th,
    .custom-table td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 16px;
    }
    
    .stat-card-value {
        font-size: 24px;
    }
    
    .btn-custom {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* ====================================================================
   OVERLAY PARA MOBILE
   ==================================================================== */

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.overlay.active {
    display: block;
}

/* ====================================================================
   UTILITÁRIOS
   ==================================================================== */

.text-success {
    color: var(--secondary-color) !important;
}

.text-danger {
    color: var(--danger-color) !important;
}

.text-warning {
    color: var(--warning-color) !important;
}

.text-muted {
    color: var(--text-secondary) !important;
}

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 24px !important; }
.mb-4 { margin-bottom: 32px !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; }
.mt-4 { margin-top: 32px !important; }
