/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4361ee;
    --primary-light: #4895ef;
    --secondary: #3f37c9;
    --success: #4cc9f0;
    --danger: #f72585;
    --warning: #f8961e;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --gray-light: #e9ecef;
    --border: #dee2e6;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: 'Segoe UI', 'Inter', -apple-system, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    color: var(--dark);
    min-height: 100vh;
    line-height: 1.6;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 100vw;
}

/* ===== HEADER ===== */
.main-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 1.25rem 2rem;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    backdrop-filter: blur(10px);
}

.logo-text {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo-text span {
    color: #4cc9f0;
    font-weight: 900;
}

.tagline {
    font-size: 0.95rem;
    opacity: 0.9;
    margin-top: 0.25rem;
}

.header-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    backdrop-filter: blur(10px);
    min-width: 180px;
}

.stat-card i {
    font-size: 1.5rem;
    color: #4cc9f0;
}

.stat-label {
    font-size: 0.85rem;
    opacity: 0.8;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
    padding: 2rem;
    flex: 1;
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ===== SIDEBAR ===== */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-section {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.sidebar-section h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    color: var(--primary);
    font-size: 1.25rem;
}

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

/* Form Styles */
.transaction-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.95rem;
}

.form-group label i {
    color: var(--primary);
    width: 16px;
}

.form-group input,
.form-group select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: all 0.3s;
    background: var(--light);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.type-selector {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.type-option {
    flex: 1;
}

.type-option input {
    display: none;
}

.type-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.income {
    background: rgba(76, 201, 240, 0.1);
    color: #4cc9f0;
    border: 2px solid rgba(76, 201, 240, 0.3);
}

.expense {
    background: rgba(247, 37, 133, 0.1);
    color: #f72585;
    border: 2px solid rgba(247, 37, 133, 0.3);
}

.type-option input:checked + .income {
    background: #4cc9f0;
    color: white;
    border-color: #4cc9f0;
}

.type-option input:checked + .expense {
    background: #f72585;
    color: white;
    border-color: #f72585;
}

.btn-submit {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s;
    margin-top: 0.5rem;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.3);
}

/* Goal Section */
.goal-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.goal-input {
    display: flex;
    gap: 0.75rem;
}

.goal-input input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
}

.btn-goal {
    background: var(--warning);
    color: white;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

.btn-goal:hover {
    background: #e68a00;
    transform: translateY(-1px);
}

.goal-progress {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
}

.progress-bar {
    height: 10px;
    background: var(--gray-light);
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4cc9f0, #4361ee);
    border-radius: 5px;
    width: 0%;
    transition: width 0.5s ease;
}

/* Quick Stats */
.quick-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--light);
    border-radius: var(--radius-sm);
    transition: all 0.3s;
}

.stat-item:hover {
    background: var(--gray-light);
    transform: translateX(5px);
}

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

.stat-item i.success {
    color: #4cc9f0;
    background: rgba(76, 201, 240, 0.1);
}

.stat-item i.danger {
    color: #f72585;
    background: rgba(247, 37, 133, 0.1);
}

.stat-item i.warning {
    color: #f8961e;
    background: rgba(248, 150, 30, 0.1);
}

.stat-item i.primary {
    color: #4361ee;
    background: rgba(67, 97, 238, 0.1);
}

.stat-title {
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 0.25rem;
}

.stat-number {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark);
}

/* ===== DASHBOARD ===== */
.dashboard {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.dashboard-section {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

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

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
    font-size: 1.5rem;
}

.time-filter {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--light);
    font-weight: 600;
    color: var(--dark);
    cursor: pointer;
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background: var(--light);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    border: 1px solid var(--border);
}

.chart-card h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--dark);
    font-size: 1.1rem;
}

.chart-container {
    height: 250px;
    position: relative;
}

/* Transactions */
.filter-actions {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1.25rem;
    border: 2px solid var(--border);
    background: var(--light);
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

.filter-btn:hover:not(.active) {
    background: var(--gray-light);
}

.transactions-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.transactions-list {
    padding: 1rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray);
}

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

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: var(--dark);
}

/* Transaction Item */
.transaction-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.3s;
    border-radius: var(--radius-sm);
}

.transaction-item:hover {
    background: var(--light);
    transform: translateX(5px);
}

.transaction-item:last-child {
    border-bottom: none;
}

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

.transaction-icon.income {
    background: rgba(76, 201, 240, 0.1);
    color: #4cc9f0;
}

.transaction-icon.expense {
    background: rgba(247, 37, 133, 0.1);
    color: #f72585;
}

.transaction-details {
    flex: 1;
}

.transaction-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--dark);
}

.transaction-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--gray);
}

.transaction-amount {
    font-weight: 700;
    font-size: 1.1rem;
}

.transaction-amount.income {
    color: #4cc9f0;
}

.transaction-amount.expense {
    color: #f72585;
}

/* Insights */
.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.insight-card {
    background: var(--light);
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary);
    transition: all 0.3s;
}

.insight-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.insight-card i {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.insight-card h3 {
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.insight-card p {
    color: var(--gray);
    line-height: 1.5;
}

/* ===== FOOTER ===== */
.main-footer {
    background: var(--dark);
    color: white;
    padding: 1.5rem 2rem;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.footer-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

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

.footer-btn.danger {
    background: rgba(247, 37, 133, 0.1);
    color: #f72585;
    border: 2px solid rgba(247, 37, 133, 0.3);
}

.footer-btn:hover:not(.danger) {
    background: var(--secondary);
}

.footer-btn.danger:hover {
    background: #f72585;
    color: white;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
}

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

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.modal-header h3 {
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
    padding: 0.25rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.btn-danger {
    background: #f72585;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

.btn-danger:hover {
    background: #d1146a;
}

.btn-secondary {
    background: var(--gray-light);
    color: var(--dark);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: var(--gray);
    color: white;
}

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

::-webkit-scrollbar-track {
    background: var(--light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--gray);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    
    .header-stats {
        flex-direction: column;
        width: 100%;
    }
    
    .stat-card {
        min-width: auto;
        width: 100%;
    }
    
    .charts-grid,
    .insights-grid {
        grid-template-columns: 1fr;
    }
    
    .type-selector {
        flex-direction: column;
    }
    
    .goal-input {
        flex-direction: column;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}