/* styles.css - COMPLETE External CSS for $mart Money App (All 8 Pages + Dark Mode) */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --danger: #ef4444;
    --darkyellow: #f59e0b;
    --dark: #1f2937;
    --gray: #6b7280;
    --light: #f9fafb;
    --border: #e5e7eb;
}

[data-theme="dark"] {
    --dark: #f1f5f9;
    --gray: #94a3b8;
    --light: #0f172a;
    --border: #334155;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

/* ==================== COMMON LAYOUT ==================== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-wrap: wrap;
}

[data-theme="dark"] header {
    background: #1e293b;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon img {
    height: 40px;
}

.logo-text {
    font-size: 1.8rem;
    font-weight: bold;
}

.logo-text span {
    font-size: 2.2rem;
    color: var(--primary);
}

nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
    flex-wrap: wrap;
}

nav a {
    text-decoration: none;
    color: var(--gray);
    font-weight: 500;
    transition: color 0.2s;
}

nav a:hover, nav a.active {
    color: var(--primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--gray);
    font-size: 1rem;
    margin-bottom: 2rem;
}

.section {
    margin: 2.5rem 0;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* App Info Footer */
.app-info {
    text-align: center;
    padding: 2rem;
    background: white;
    margin-top: 4rem;
    border-top: 1px solid var(--border);
}

[data-theme="dark"] .app-info {
    background: #1e293b;
}

.app-info .app-logo {
    height: 60px;
    margin-bottom: 0.5rem;
}

.app-name {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.3rem;
}

.app-version {
    color: var(--gray);
    margin-bottom: 1rem;
}

/* ==================== HOME PAGE ==================== */
.intro-homepage {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.intro-content {
    display: flex;
    width: 100%;
    gap: 4rem;
    align-items: center;
}

.intro-text {
    flex: 1;
}

.intro-text h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.intro-text h2 {
    font-size: 1.2rem;
    color: var(--gray);
}

.intro-image img {
    max-width: 500px;
    border-radius: 16px;
}

.intro-text-quote {
    text-align: center;
    font-style: italic;
    color: var(--gray);
    padding: 2rem;
    font-size: 1.3rem;
}

.intro-steps-box {
    max-width: 800px;
    margin: 0 auto 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

/* ==================== MANAGER PAGE ==================== */
.add-expense-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--dark);
}

.form-group input,
.form-group select {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
}

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

.expenses-table-container {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--light);
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    color: var(--dark);
    font-size: 0.95rem;
}

tbody tr:hover {
    background: var(--light);
}

.amount {
    font-weight: 600;
    white-space: nowrap;
}

.amount.negative {
    color: var(--danger);
}

.category-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    background: #e0e7ff;
    color: var(--primary);
}

.actions {
    display: flex;
    gap: 0.5rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ==================== TIMELINE PAGE ==================== */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 1.5rem;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--border);
    border-radius: 2px;
}

.timeline-date {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark);
    margin: 2.5rem 0 1rem;
    position: relative;
}

.timeline-date::before {
    content: '';
    position: absolute;
    left: -2.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: var(--primary);
    border: 4px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 4px var(--border);
}

.transaction-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.transaction-item {
    background: white;
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

[data-theme="dark"] .transaction-item {
    background: #1e293b;
}

.transaction-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px -3px rgba(0,0,0,0.1);
}

.transaction-item::before {
    content: '';
    position: absolute;
    left: -2.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: white;
    border: 3px solid var(--border);
    border-radius: 50%;
}

.transaction-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.cat-food { background: #10b981; }
.cat-entertainment { background: #8b5cf6; }
.cat-transport { background: #f59e0b; }
.cat-shopping { background: #ef4444; }
.cat-bills { background: #06b6d4; }
.cat-health { background: #ec4899; }
.cat-other { background: var(--gray); }
.cat-income { background: var(--success); }

.transaction-details {
    flex: 1;
}

.transaction-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.transaction-meta {
    color: var(--gray);
    font-size: 0.9rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.transaction-amount {
    font-size: 1.3rem;
    font-weight: 800;
    white-space: nowrap;
}

.amount-expense { color: var(--danger); }
.amount-income { color: var(--success); }

.add-transaction-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 2rem;
    border: none;
    box-shadow: 0 6px 12px rgba(99,102,241,0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 100;
}

.add-transaction-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.empty-timeline {
    text-align: center;
    padding: 3rem;
    color: var(--gray);
}

.empty-timeline i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ==================== WALLETS PAGE ==================== */
.wallet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.wallet-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

[data-theme="dark"] .wallet-card {
    background: #1e293b;
}

.wallet-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

.wallet-header {
    padding: 1.5rem 1.5rem 1rem;
    color: white;
    position: relative;
}

.wallet-type {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wallet-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.wallet-balance {
    font-size: 2rem;
    font-weight: 800;
}

.wallet-currency {
    font-size: 1.125rem;
    opacity: 0.9;
}

.badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255,255,255,0.25);
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.wallet-body {
    padding: 1.25rem 1.5rem;
}

.stats {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    font-size: 0.95rem;
}

.stat-item {
    text-align: center;
}

.stat-label {
    color: var(--gray);
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
}

.stat-value.income { color: var(--success); }
.stat-value.expense { color: var(--danger); }

/* ==================== BUDGETS PAGE ==================== */
.monthly-budget-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    margin-bottom: 3rem;
    text-align: center;
}

[data-theme="dark"] .monthly-budget-card {
    background: #1e293b;
}

.monthly-budget-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.monthly-budget-period {
    color: var(--gray);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.budget-input-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.currency-symbol {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.budget-input {
    font-size: 2.5rem;
    font-weight: 800;
    width: 200px;
    padding: 0.5rem 1rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    text-align: center;
}

.budget-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99,102,241,0.2);
}

.save-budget-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
}

.save-budget-btn:hover {
    background: var(--primary-dark);
}

.budget-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.summary-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    text-align: center;
}

[data-theme="dark"] .summary-card {
    background: #1e293b;
}

.summary-value {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0.5rem 0;
}

.summary-label {
    color: var(--gray);
}

.value-positive { color: var(--success); }
.value-negative { color: var(--danger); }
.value-neutral { color: var(--primary); }

.budget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.budget-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

[data-theme="dark"] .budget-card {
    background: #1e293b;
}

.budget-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

.budget-header {
    padding: 1.5rem;
    color: white;
    position: relative;
}

.budget-header.food { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.budget-header.entertainment { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }
.budget-header.transport { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.budget-header.shopping { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
.budget-header.utilities { background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%); }
.budget-header.others { background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%); }

.budget-icon {
    font-size: 2.5rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.budget-name {
    font-size: 1.5rem;
    font-weight: 700;
}

.budget-period {
    font-size: 0.95rem;
    opacity: 0.9;
    margin-top: 0.25rem;
}

.budget-body {
    padding: 1.5rem;
}

.progress-container {
    margin: 1rem 0;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.progress-bar {
    height: 12px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}

.progress-fill.safe { background: var(--success); }
.progress-fill.warning { background: var(--darkyellow); }
.progress-fill.danger { background: var(--danger); }

.budget-amounts {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

/* ==================== MULTICURRENCY PAGE ==================== */
.default-currency-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;
}

[data-theme="dark"] .default-currency-card {
    background: #1e293b;
}

.currency-select {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    min-width: 180px;
}

.currency-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.currency-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 1rem;
}

[data-theme="dark"] .currency-card {
    background: #1e293b;
}

.currency-card:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}

.currency-flag {
    width: 48px;
    height: 36px;
    border-radius: 4px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.flag-myr { background-image: url('https://flagcdn.com/w320/my.png'); }
.flag-eur { background-image: url('https://flagcdn.com/w320/eu.png'); }
.flag-usd { background-image: url('https://flagcdn.com/w320/us.png'); }
.flag-gbp { background-image: url('https://flagcdn.com/w320/gb.png'); }
.flag-jpy { background-image: url('https://flagcdn.com/w320/jp.png'); }
.flag-aud { background-image: url('https://flagcdn.com/w320/au.png'); }
.flag-cad { background-image: url('https://flagcdn.com/w320/ca.png'); }
.flag-chf { background-image: url('https://flagcdn.com/w320/ch.png'); }
.flag-cny { background-image: url('https://flagcdn.com/w320/cn.png'); }

.currency-info {
    flex: 1;
}

.currency-code {
    font-size: 1.25rem;
    font-weight: 700;
}

.currency-name {
    color: var(--gray);
    font-size: 0.95rem;
}

.currency-rate {
    font-size: 0.9rem;
    color: var(--gray);
    margin-top: 0.25rem;
}

.add-currency-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    transition: all 0.3s;
}

.add-currency-btn:hover {
    background: var(--primary-dark);
}

/* ==================== ACTIVITY PAGE ==================== */
.activity-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.activity-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    text-align: center;
}

[data-theme="dark"] .activity-card {
    background: #1e293b;
}

.activity-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.activity-value {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0.5rem 0;
}

.activity-label {
    color: var(--gray);
    font-size: 1rem;
}

.chart-container {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    text-align: center;
    margin-bottom: 3rem;
}

[data-theme="dark"] .chart-container {
    background: #1e293b;
}

.chart-placeholder {
    width: 100%;
    max-width: 500px;
    height: 400px;
    margin: 0 auto;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary);
    flex-direction: column;
    gap: 1rem;
}

[data-theme="dark"] .chart-placeholder {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
}

.chart-placeholder i {
    font-size: 4rem;
    opacity: 0.6;
}

.category-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.category-item {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: transform 0.2s;
}

[data-theme="dark"] .category-item {
    background: #1e293b;
}

.category-item:hover {
    transform: translateY(-4px);
}

.category-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    flex-shrink: 0;
}

.cat-food { background: #10b981; }
.cat-shopping { background: #ef4444; }
.cat-entertainment { background: #8b5cf6; }
.cat-transport { background: #f59e0b; }
.cat-utilities { background: #06b6d4; }
.cat-other { background: var(--gray); }

.category-details {
    flex: 1;
}

.category-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.category-amount {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--danger);
}

.category-percent {
    color: var(--gray);
    font-size: 0.95rem;
}

.recent-activity {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

[data-theme="dark"] .recent-activity {
    background: #1e293b;
}

.recent-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.day-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.day-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.day-item:last-child {
    border-bottom: none;
}

.day-date {
    font-weight: 600;
    min-width: 120px;
}

.day-spending {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--danger);
}

.day-spending.positive {
    color: var(--success);
}

.day-transactions {
    color: var(--gray);
    font-size: 0.95rem;
}

/* ==================== MORE PAGE ==================== */
.settings-section {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 2rem;
}

[data-theme="dark"] .settings-section {
    background: #1e293b;
}

.settings-list {
    list-style: none;
}

.settings-item {
    padding: 1.4rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    cursor: pointer;
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item:hover {
    background: #f8fafc;
}

[data-theme="dark"] .settings-item:hover {
    background: #334155;
}

.item-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.item-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.item-text {
    flex: 1;
}

.item-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.item-desc {
    color: var(--gray);
    font-size: 0.95rem;
}

.item-right {
    color: var(--gray);
    font-size: 1.3rem;
}

/* Modals (shared for wallets, multicurrency, more FAQ) */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

[data-theme="dark"] .modal {
    background: #1e293b;
}

.modal-header {
    padding: 1.5rem;
    background: var(--primary);
    color: white;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    position: relative;
}

.modal-close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-body {
    padding: 1.5rem;
}

.color-options {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border 0.2s;
}

.color-option.selected {
    border-color: white;
    box-shadow: 0 0 0 3px var(--dark);
}

.currency-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.currency-option:hover {
    background: var(--light);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: transparent;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 16px;
    padding: 1rem;
}

.faq-item {
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding: 1rem 0;
}

[data-theme="light"] .faq-item {
    border-bottom-color: rgba(0,0,0,0.2);
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    padding: 0.5rem 0;
}

.faq-answer {
    padding: 0.8rem 0;
    display: none;
    opacity: 0.9;
}

.faq-item.active .faq-answer {
    display: block;
}

.spinner-modal {
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

/* ===== FEATURES SECTION (REFINED) ===== */

.features h2 {
    text-align: center;
    margin-bottom: 1.3rem;
}

.features {
    margin-top: 2.5rem;
    padding: 0 1.5rem; /* space left & right of screen */
}

.features h2 {
    margin-bottom: 1.3rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;

    /* keep content centered and not too wide */
    max-width: 900px;
    margin: 0 auto;
}

/* Feature cards */
.features-grid h3 {
    background: white;
    border-radius: 12px;
    padding: 0.9rem 1rem;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;

    /* rectangle shape */
    aspect-ratio: 3 / 2;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

/* ================= RESPONSIVE ================= */

/* Tablet: 2 columns */
@media (max-width: 900px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 600px;
    }
}

/* Mobile: 1 column */
@media (max-width: 500px) {
    .features-grid {
        grid-template-columns: 1fr;
        max-width: 350px;
    }
}


@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    table {
        font-size: 0.9rem;
    }
    th, td {
        padding: 0.75rem;
    }
    .actions {
        flex-direction: column;
    }
    .intro-content {
        flex-direction: column;
        text-align: center;
    }
    .intro-image img {
        max-width: 100%;
    }
    .budget-input-group {
        flex-direction: column;
    }
    .budget-input {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 600px) {
    header {
        flex-direction: column;
        gap: 1rem;
    }
    nav ul {
        gap: 1.5rem;
        justify-content: center;
        flex-wrap: wrap;
    }
    .wallet-grid,
    .budget-grid,
    .activity-summary,
    .category-breakdown {
        grid-template-columns: 1fr;
    }
    .add-transaction-btn,
    .add-wallet-btn,
    .add-budget-btn {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 56px;
        height: 56px;
        font-size: 1.8rem;
    }
    .timeline {
        padding-left: 1.5rem;
    }
    .timeline::before,
    .timeline-date::before,
    .transaction-item::before {
        left: 1rem;
    }
    .transaction-item {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    .transaction-amount {
        align-self: flex-end;
    }
    .chart-placeholder {
        height: 300px;
    }
}