/* ====== Global Styles ====== */
* { box-sizing: border-box; }

body { overflow-x: hidden; }

/* Navigation active state */
.nav-link {
    color: #4b5563;
}
.nav-link:hover {
    background-color: #f0f7ff;
    color: #0874c6;
}
.nav-link.active {
    background-color: #e0effe;
    color: #075ca0;
    font-weight: 600;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Table styles */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}
.data-table tbody td {
    padding: 12px 16px;
    font-size: 0.875rem;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
}
.data-table tbody tr:hover { background-color: #f9fafb; }
.data-table tbody tr.receita-row td:first-child { border-left: 3px solid #10b981; }
.data-table tbody tr.despesa-row td:first-child { border-left: 3px solid #ef4444; }

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}
.badge-green { background: #d1fae5; color: #065f46; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-gray { background: #f3f4f6; color: #374151; }
.badge-purple { background: #ede9fe; color: #5b21b6; }

/* Cards */
.stat-card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
}
.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

/* Form styles */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
}
.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.15s;
    background: white;
}
.form-control:focus {
    outline: none;
    border-color: #0874c6;
    box-shadow: 0 0 0 3px rgba(8,116,198,0.1);
}
select.form-control { cursor: pointer; }

/* Tree view for chart of accounts */
.tree-item {
    border-left: 2px solid #e5e7eb;
    margin-left: 1rem;
    padding-left: 1rem;
}
.tree-item.level-1 { border-left-color: #3b82f6; margin-left: 0; }
.tree-item.level-2 { border-left-color: #8b5cf6; }
.tree-item.level-3 { border-left-color: #10b981; }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in { animation: fadeIn 0.3s ease-out; }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}
.animate-slide-in { animation: slideIn 0.3s ease-out; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}
.toast-animate { animation: toastIn 0.3s ease-out; }

/* Print styles */
@media print {
    #sidebar, header, .no-print, #toastContainer { display: none !important; }
    #mainContent { margin-left: 0 !important; padding-top: 0 !important; }
    .stat-card { box-shadow: none; border: 1px solid #ccc; }
    body { background: white; }
}

/* Mobile responsive fixes */
@media (max-width: 1024px) {
    #mainContent { margin-left: 0 !important; }
}

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #0874c6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Chart containers */
.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: #d1d5db;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s;
}
.toggle-switch.active { background: #0874c6; }
.toggle-switch::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch.active::after { transform: translateX(20px); }

/* Tab styles */
.tab-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
}
.tab-btn:hover { color: #0874c6; }
.tab-btn.active {
    color: #0874c6;
    border-bottom-color: #0874c6;
}
