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

:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --success: #48bb78;
    --danger: #f56565;
    --warning: #ed8936;
    --info: #4299e1;
    --dark: #2d3748;
    --gray: #718096;
    --light: #f7fafc;
    --white: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.6;
}

/* Layout */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    background: linear-gradient(180deg, var(--dark) 0%, #1a202c 100%);
    color: var(--white);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-header i {
    color: var(--primary);
}

.logo-link {
    color: #ffffff;
    transition: opacity 0.2s;
}

.logo-link:hover {
    opacity: 0.9;
}

.logo-link img {
    color: #ffffff !important;
    filter: brightness(0) invert(1) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
    flex: 1;
}

.sidebar-menu li {
    margin: 0.25rem 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s;
}

.sidebar-menu a:hover,
.sidebar-menu li.active a {
    color: var(--white);
    background: rgba(255, 255, 255, 0.1);
    border-left: 3px solid var(--primary);
}

.sidebar-menu i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
}

.btn-logout {
    width: 100%;
    padding: 0.625rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 6px;
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.2);
}

.main-content {
    margin-left: 250px;
    padding: 2rem;
    min-height: 100vh;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-header h1 i {
    color: var(--primary);
}

.page-header p {
    color: var(--gray);
    margin-top: 0.25rem;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* Dashboard Cards */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-cards .card {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    margin-bottom: 0;
    border-left: 4px solid;
}

.card-primary { border-left-color: var(--primary) !important; }
.card-success { border-left-color: var(--success) !important; }
.card-danger { border-left-color: var(--danger) !important; }
.card-warning { border-left-color: var(--warning) !important; }

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: 1rem;
}

.card-primary .card-icon { background: rgba(102, 126, 234, 0.1); color: var(--primary); }
.card-success .card-icon { background: rgba(72, 187, 120, 0.1); color: var(--success); }
.card-danger .card-icon { background: rgba(245, 101, 101, 0.1); color: var(--danger); }
.card-warning .card-icon { background: rgba(237, 137, 54, 0.1); color: var(--warning); }

.card-info h3 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray);
    margin-bottom: 0.25rem;
}

.card-info .amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    border: none;
    font-size: 0.875rem;
}

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

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

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

.btn-secondary:hover {
    background: #cbd5e0;
}

.btn-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
}

.btn-link:hover {
    text-decoration: underline;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    background: transparent;
    color: var(--gray);
}

.btn-icon:hover {
    background: var(--light);
}

.btn-edit:hover { color: var(--info); }
.btn-delete:hover { color: var(--danger); }

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-weight: 600;
    color: var(--gray);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table tr:hover {
    background: var(--light);
}

.text-right { text-align: right !important; }
.text-center { text-align: center !important; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-income {
    background: rgba(72, 187, 120, 0.1);
    color: var(--success);
}

.badge-expense {
    background: rgba(245, 101, 101, 0.1);
    color: var(--danger);
}

.badge-transfer {
    background: rgba(66, 153, 225, 0.1);
    color: var(--info);
}

.badge-default {
    background: var(--border);
    color: var(--gray);
}

/* Transaction colors */
.income { color: var(--success); }
.expense { color: var(--danger); }
.transfer { color: var(--info); }

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 2rem;
}

.auth-box {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.auth-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--gray);
}

.auth-form .form-group {
    margin-bottom: 1.25rem;
}

.auth-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--dark);
}

.auth-form input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.error-message {
    color: var(--danger);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--gray);
    font-size: 0.875rem;
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    color: var(--gray);
}

.filter-group select,
.filter-group input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
}

/* Advanced Filters */
.filters-advanced {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.filter-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: flex-end;
}

.filter-row:last-child {
    margin-bottom: 0;
}

.filters-advanced .filter-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
}

.filters-advanced .filter-group.flex-2 {
    flex: 2;
}

.filters-advanced label {
    font-size: 0.75rem;
    color: var(--gray);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    font-weight: 600;
}

.filters-advanced input,
.filters-advanced select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
}

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

.modal-content {
    background: var(--white);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

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

.modal form {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Account Cards */
.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.account-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    border-left: 4px solid;
}

.account-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.account-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.25rem;
}

.account-info h4 {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.account-type {
    font-size: 0.75rem;
    color: var(--gray);
}

.account-balance {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    margin-bottom: 1rem;
}

.balance-label {
    font-size: 0.875rem;
    color: var(--gray);
}

.balance-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.account-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Categories */
.categories-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 0.625rem 1.25rem;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

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

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.category-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    border-left: 4px solid;
}

.category-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.category-info {
    flex: 1;
}

.category-info h4 {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.category-info p {
    font-size: 0.75rem;
    color: var(--gray);
}

/* Budget Cards */
.budgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.budget-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    border-top: 4px solid var(--success);
}

.budget-card.warning {
    border-top-color: var(--warning);
}

.budget-card.danger {
    border-top-color: var(--danger);
}

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

.budget-category {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.category-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.category-name {
    font-weight: 600;
}

.budget-period {
    font-size: 0.75rem;
    color: var(--gray);
    background: var(--light);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
}

.budget-amounts {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.budget-amounts .spent .value.danger {
    color: var(--danger);
}

.budget-amounts .spent .value.warning {
    color: var(--warning);
}

.budget-amounts .label {
    font-size: 0.75rem;
    color: var(--gray);
    display: block;
}

.budget-amounts .value {
    font-size: 1.25rem;
    font-weight: 700;
}

.budget-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--light);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-fill.warning {
    background: var(--warning);
}

.progress-fill.danger {
    background: var(--danger);
}

.progress-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray);
    min-width: 45px;
    text-align: right;
}

.budget-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.remaining {
    font-size: 0.875rem;
}

.remaining.danger {
    color: var(--danger);
    font-weight: 600;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .filter-row {
        flex-direction: column;
    }
    
    .header-actions {
        flex-direction: column;
    }
}

/* Small text helper */
.form-group small {
    font-size: 0.75rem;
    color: var(--gray);
    margin-top: 0.25rem;
    display: block;
}

/* Currency indicator */
.currency-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    background: var(--light);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray);
}
