@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

:root {
    --bg:        #f5f7fa;
    --surface:   #ffffff;
    --surface2:  #f0f4f8;
    --blue:      #5a8fc4;
    --blue-soft: #d4e4f7;
    --green:     #5ac49e;
    --green-soft:#d4f5e4;
    --pink:      #e47ba8;
    --pink-soft: #f5d4e4;
    --amber:     #e8a857;
    --amber-soft:#f9e5c8;
    --text:      #1a1a2e;
    --text-muted:#6b7280;
    --border:    #e5e7eb;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.05);
    --radius:    16px;
    --radius-sm: 10px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse at 15% 15%, rgba(90,143,196,0.07) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 85%, rgba(92,196,154,0.07) 0%, transparent 50%);
    padding: 24px 20px;
    min-height: 100vh;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

.container { max-width: 1400px; margin: 0 auto; }

/* ── Header ── */
.header { text-align: center; margin-bottom: 32px; }
.header-info { margin-bottom: 16px; }
.main-title { font-size: 40px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; margin-bottom: 8px; }
.subtitle { font-size: 10.5px; letter-spacing: 3px; color: var(--text-muted); text-transform: uppercase; font-weight: 700; margin: 6px 0; }
.current-date { font-size: 14px; color: var(--text-muted); font-weight: 500; margin-top: 4px; }

.controls {
    display: flex; gap: 8px; justify-content: center;
    margin: 20px 0; flex-wrap: wrap; padding: 0 10px;
}
.select-box {
    padding: 10px 14px; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); font-size: 13px;
    font-weight: 600; background: var(--surface);
    color: var(--text); font-family: inherit; cursor: pointer;
    transition: 0.2s;
    box-shadow: var(--shadow-sm);
}

.download-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white; border: none; padding: 10px 22px;
    border-radius: var(--radius-sm); font-size: 14px;
    font-weight: 700; cursor: pointer; font-family: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(102,126,234,0.3);
}
.download-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(102,126,234,0.4); }

/* ── Dashboard ── */
.dashboard { display: grid; grid-template-columns: 420px 1fr; gap: 20px; }
.left-section { display: flex; flex-direction: column; gap: 16px; }

/* ── Balance Card ── */
.balance-card {
    background: linear-gradient(135deg, var(--blue) 0%, #4a7ab5 100%);
    padding: 32px 26px; border-radius: var(--radius);
    text-align: center; color: white;
    box-shadow: 0 8px 30px rgba(90,143,196,0.35);
    transition: transform 0.2s, box-shadow 0.2s;
}
.balance-card:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(90,143,196,0.45); }
.balance-card h3 { font-size: 10.5px; letter-spacing: 3px; margin-bottom: 16px; opacity: 0.8; text-transform: uppercase; font-weight: 700; }
.balance-amount { font-size: 52px; font-weight: 800; letter-spacing: -1.5px; line-height: 1; }

/* ── Summary Cards ── */
.summary-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.summary-card {
    padding: 22px 18px; border-radius: var(--radius);
    text-align: center; box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}
.summary-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.income-card  { background: linear-gradient(160deg, var(--green-soft), #c8f0e0); border: 1px solid rgba(92,196,154,0.25); }
.expense-card { background: linear-gradient(160deg, var(--pink-soft), #f0c8d8); border: 1px solid rgba(228,123,168,0.25); }
.summary-label { font-size: 10px; letter-spacing: 2.5px; color: var(--text-muted); margin-bottom: 12px; text-transform: uppercase; font-weight: 700; }
.summary-value { font-size: 30px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; }

/* ── Add Form ── */
.add-form-card {
    background: var(--surface); padding: 22px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md); border: 1px solid var(--border);
}
.add-form-card h3 { font-size: 10.5px; letter-spacing: 2.5px; margin-bottom: 18px; color: var(--text-muted); text-transform: uppercase; font-weight: 700; }
.add-form-card input,
.add-form-card select {
    width: 100%; padding: 12px 14px; margin-bottom: 12px;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; font-family: inherit;
    color: var(--text); background: var(--surface2);
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.add-form-card input:focus,
.add-form-card select:focus {
    outline: none; border-color: var(--blue);
    background: white; box-shadow: 0 0 0 3px rgba(90,143,196,0.1);
}
.type-selector { display: flex; gap: 20px; margin-bottom: 14px; }
.type-selector label {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; cursor: pointer; font-weight: 600;
    color: var(--text);
}
.type-selector input[type="radio"] { accent-color: var(--blue); width: 17px; height: 17px; }

.add-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--blue) 0%, #4a7ab5 100%);
    color: white !important; border: none; padding: 13px;
    border-radius: var(--radius-sm); font-size: 14px;
    font-weight: 700; cursor: pointer; font-family: inherit;
    transition: all 0.2s;
    box-shadow: 0 4px 14px rgba(90,143,196,0.3);
    text-decoration: none;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.add-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(90,143,196,0.45); }

/* ── Transactions ── */
.right-section { display: flex; flex-direction: column; }
.transactions-card {
    background: var(--surface); padding: 22px;
    border-radius: var(--radius); height: 100%;
    box-shadow: var(--shadow-md); border: 1px solid var(--border);
}
.transactions-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.transactions-header h3 { font-size: 10.5px; letter-spacing: 2.5px; color: var(--text-muted); text-transform: uppercase; font-weight: 700; }
.clear-btn {
    background: var(--pink-soft); color: var(--pink);
    border: 1px solid rgba(228,123,168,0.3);
    padding: 8px 18px; border-radius: 8px;
    font-size: 12px; font-weight: 700; cursor: pointer;
    font-family: inherit; transition: all 0.2s;
}
.clear-btn:hover { background: var(--pink); color: white; }

.transactions-list { max-height: 700px; overflow-y: auto; }
.empty-state { text-align: center; color: var(--text-muted); padding: 50px 20px; font-size: 14px; font-weight: 500; }

.transaction-item {
    background: var(--surface2); padding: 16px;
    border-radius: var(--radius-sm); margin-bottom: 10px;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid transparent;
}
.transaction-item:hover { transform: translateX(3px); box-shadow: var(--shadow-md); }
.transaction-item.income  { border-left-color: var(--green); }
.transaction-item.expense { border-left-color: var(--pink); }

.transaction-info { flex: 1; }
.transaction-desc { font-size: 14.5px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.transaction-meta { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.transaction-amount { font-size: 20px; font-weight: 800; margin-right: 12px; letter-spacing: -0.3px; }
.transaction-item.income .transaction-amount  { color: var(--green); }
.transaction-item.expense .transaction-amount { color: var(--pink); }

.delete-btn {
    background: none; border: none; cursor: pointer;
    font-size: 18px; padding: 4px; opacity: 0.4;
    transition: opacity 0.2s; min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
}
.delete-btn:hover { opacity: 0.9; }

/* ── Responsive ── */
@media (max-width: 1200px) { .dashboard { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
    * { -webkit-tap-highlight-color: transparent; }
    body { padding: 12px; }
    .main-title { font-size: 28px; line-height: 1.2; }
    .controls { gap: 10px; padding: 0; }
    .select-box, .download-btn { min-height: 48px; font-size: 14px; padding: 12px 18px; flex: 1; justify-content: center; }
    .balance-amount { font-size: 42px; }
    .balance-card { padding: 32px 20px; }
    .summary-cards { grid-template-columns: 1fr; gap: 12px; }
    .summary-value { font-size: 32px; }
    .add-form-card input, .add-form-card select { font-size: 16px; min-height: 48px; }
    .type-selector { justify-content: center; gap: 32px; margin: 20px 0; }
    .type-selector label { font-size: 16px; padding: 10px; }
    .add-btn { min-height: 52px; font-size: 15px; }
    .transactions-list { max-height: none; overflow: visible; }
    .transaction-item { padding: 18px; flex-direction: column; align-items: flex-start; gap: 12px; }
    .transaction-amount { font-size: 24px; margin: 0; width: 100%; border-bottom: 1px solid rgba(0,0,0,0.05); padding-bottom: 8px; }
    .delete-btn { min-width: 48px; min-height: 48px; font-size: 20px; align-self: flex-end; }
    .clear-btn { min-height: 48px; width: 100%; justify-content: center; display: flex; }
}
@media (max-width: 480px) {
    .main-title { font-size: clamp(20px, 5vw, 22px); }
    .balance-amount { font-size: clamp(30px, 8vw, 36px); }
    .summary-value { font-size: clamp(22px, 5.5vw, 26px); }
    .transaction-amount { font-size: clamp(16px, 4.5vw, 18px); }
}
