/* ============================================================
   MoneyMind — Global Mobile-App Stylesheet
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
    --font-base: 16px;
    --font-sm: 14px;
    --font-xs: 13px;
    --font-lg: 18px;
    --primary: #6C3CE1;
    --primary-dark: #4F46E5;
    --primary-light: #8B5CF6;
    --accent: #F59E0B;
    --success: #10B981;
    --danger: #EF4444;
    --bg: #F0F2FF;
    --card: #FFFFFF;
    --text: #1E1B4B;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --shadow: 0 4px 24px rgba(108,60,225,0.10);
    --radius: 20px;
    --bottom-nav-h: 72px;
}

html, body {
    font-family: 'Poppins', sans-serif;
    font-size: var(--font-base);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── App Shell ── */
.app-shell {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
    position: relative;
    padding-bottom: calc(var(--bottom-nav-h) + 16px);
}

/* ── Top Header ── */
.app-header {
    background: linear-gradient(135deg, #6C3CE1 0%, #4F46E5 100%);
    padding: 20px 20px 32px;
    position: relative;
    overflow: hidden;
}
.app-header::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 180px; height: 180px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
}
.app-header::after {
    content: '';
    position: absolute;
    bottom: -60px; left: -30px;
    width: 220px; height: 220px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
}
.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
}
.header-top h2 {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
}
.header-top .greeting {
    color: rgba(255,255,255,0.75);
    font-size: 14px;
}
.header-avatar {
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    text-decoration: none;
    transition: all 0.2s;
}
.header-avatar:hover { background: rgba(255,255,255,0.3); }

/* ── Month Selector ── */
.month-selector {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 16px 20px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
    z-index: 1;
}
.month-selector::-webkit-scrollbar { display: none; }
.month-tab {
    flex-shrink: 0;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    border: 1.5px solid rgba(255,255,255,0.2);
    transition: all 0.25s;
    white-space: nowrap;
}
.month-tab.active, .month-tab:hover {
    background: #fff;
    color: var(--primary);
    border-color: #fff;
    font-weight: 600;
}

/* ── Summary Cards ── */
.summary-section {
    padding: 0 16px;
    margin-top: -16px;
    position: relative;
    z-index: 2;
}
.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}
.summary-card {
    background: var(--card);
    border-radius: 16px;
    padding: 14px 10px;
    text-align: center;
    box-shadow: var(--shadow);
}
.summary-card .s-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 8px;
    font-size: 16px;
}
.summary-card.income .s-icon { background: #D1FAE5; color: #059669; }
.summary-card.expense .s-icon { background: #FEE2E2; color: #DC2626; }
.summary-card.balance .s-icon { background: #EDE9FE; color: #7C3AED; }
.summary-card .s-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}
.summary-card .s-amount {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}
.summary-card.income .s-amount { color: #059669; }
.summary-card.expense .s-amount { color: #DC2626; }
.summary-card.balance .s-amount { color: var(--primary); }

/* ── Big Balance Card ── */
.balance-card {
    margin: 16px 16px 0;
    background: linear-gradient(135deg, #6C3CE1 0%, #4F46E5 100%);
    border-radius: var(--radius);
    padding: 24px;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(108,60,225,0.35);
}
.balance-card::before {
    content: '';
    position: absolute;
    top: -20px; right: -20px;
    width: 120px; height: 120px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
}
.balance-card .bc-label {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 8px;
}
.balance-card .bc-amount {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -1px;
}
.balance-card .bc-sub {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    margin-top: 6px;
}

/* ── Section Title ── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px 10px;
}
.section-header h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}
.section-header a {
    font-size: 14px;
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
}

/* ── Transaction Item ── */
.tx-list { padding: 0 16px; display: flex; flex-direction: column; gap: 10px; }
.tx-item {
    background: var(--card);
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    transition: transform 0.2s;
    text-decoration: none;
    color: inherit;
}
.tx-item:active { transform: scale(0.98); }
.tx-icon {
    width: 44px; height: 44px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.tx-info { flex: 1; }
.tx-info .tx-cat { font-size: 15px; font-weight: 600; color: var(--text); }
.tx-info .tx-note { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.tx-amount { font-size: 16px; font-weight: 700; }
.tx-amount.income { color: var(--success); }
.tx-amount.expense { color: var(--danger); }

/* ── Category Icons ── */
.cat-salary    { background: #DBEAFE; color: #2563EB; }
.cat-business  { background: #FEF3C7; color: #D97706; }
.cat-other-in  { background: #D1FAE5; color: #059669; }
.cat-food      { background: #FEE2E2; color: #DC2626; }
.cat-medical   { background: #FCE7F3; color: #DB2777; }
.cat-rent      { background: #EDE9FE; color: #7C3AED; }
.cat-shopping  { background: #FEF3C7; color: #D97706; }
.cat-transport { background: #D1FAE5; color: #059669; }
.cat-other-ex  { background: #F3F4F6; color: #6B7280; }
.cat-education { background: #CFFAFE; color: #0891B2; }
.cat-utility   { background: #FFF7ED; color: #EA580C; }

/* ── FAB Button ── */
.fab {
    position: fixed;
    bottom: calc(var(--bottom-nav-h) + 16px);
    right: calc(50% - 215px + 16px);
    width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 24px;
    box-shadow: 0 8px 24px rgba(108,60,225,0.45);
    text-decoration: none;
    transition: all 0.3s;
    z-index: 100;
}
.fab:hover { transform: scale(1.1) rotate(90deg); }
@media (max-width: 430px) {
    .fab { right: 16px; }
}

/* ── Bottom Nav ── */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    height: var(--bottom-nav-h);
    background: #fff;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 200;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    border-radius: 20px 20px 0 0;
    padding: 0 4px;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-decoration: none;
    padding: 6px 8px;
    border-radius: 12px;
    transition: all 0.25s;
    flex: 1;
}
.nav-item i { font-size: 20px; color: var(--text-muted); transition: all 0.25s; }
.nav-item span { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.nav-item.active i { color: var(--primary); }
.nav-item.active span { color: var(--primary); font-weight: 600; }
.nav-item.active { background: #F5F3FF; }

/* ── Page Content ── */
.page-content { padding: 0 0 16px; }

/* ── Cards ── */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin: 0 16px 14px;
}
.card-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-title i { color: var(--primary); font-size: 16px; }

/* ── Form Elements ── */
.form-card { margin: 0 16px 14px; }
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 13px 15px;
    font-size: 15px;
    font-family: 'Poppins', sans-serif;
    color: var(--text);
    background: #fff;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108,60,225,0.1);
}
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    border: none;
    cursor: pointer;
    transition: all 0.25s;
    text-decoration: none;
    justify-content: center;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 16px rgba(108,60,225,0.35);
    width: 100%;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(108,60,225,0.45); }
.btn-primary:active { transform: translateY(0); }
.btn-success { background: linear-gradient(135deg, #10B981, #059669); color: #fff; width: 100%; box-shadow: 0 4px 16px rgba(16,185,129,0.3); }
.btn-danger { background: linear-gradient(135deg, #EF4444, #DC2626); color: #fff; box-shadow: 0 4px 16px rgba(239,68,68,0.3); }
.btn-sm { padding: 9px 14px; font-size: 13px; border-radius: 10px; width: auto; }

/* ── Type Switcher (Income/Expense) ── */
.type-switcher {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
}
.type-btn {
    padding: 12px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s;
    color: var(--text-muted);
}
.type-btn.active-income {
    border-color: var(--success);
    background: #D1FAE5;
    color: #059669;
}
.type-btn.active-expense {
    border-color: var(--danger);
    background: #FEE2E2;
    color: #DC2626;
}

/* ── Progress Bar ── */
.progress-wrap { background: #F3F4F6; border-radius: 100px; height: 10px; overflow: hidden; }
.progress-bar {
    height: 100%;
    border-radius: 100px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

/* ── Goal Card ── */
.goal-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 18px;
    margin: 0 16px 12px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.goal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.goal-icon {
    width: 46px; height: 46px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.goal-title { font-size: 16px; font-weight: 700; color: var(--text); }
.goal-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.goal-amounts {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}
.goal-amounts span { font-size: 13px; color: var(--text-muted); }
.goal-amounts strong { font-size: 15px; color: var(--primary); }
.goal-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

/* ── Piggy Bank ── */
.piggy-total {
    text-align: center;
    padding: 24px;
    background: linear-gradient(135deg, #10B981, #059669);
    border-radius: var(--radius);
    margin: 0 16px 14px;
    color: #fff;
    box-shadow: 0 8px 32px rgba(16,185,129,0.35);
}
.piggy-total .pt-label { font-size: 14px; opacity: 0.8; margin-bottom: 8px; }
.piggy-total .pt-amount { font-size: 40px; font-weight: 800; letter-spacing: -1px; }

/* ── Alert / Toast ── */
.alert {
    margin: 12px 16px;
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success { background: #D1FAE5; color: #065F46; border-left: 4px solid #10B981; }
.alert-error   { background: #FEE2E2; color: #991B1B; border-left: 4px solid #EF4444; }
.alert-info    { background: #EDE9FE; color: #4C1D95; border-left: 4px solid #7C3AED; }

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 48px; opacity: 0.3; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 15px; }

/* ── Chart Container ── */
.chart-wrap {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    margin: 0 16px 14px;
    box-shadow: var(--shadow);
}
.chart-container { position: relative; height: 200px; }

/* ── Delete button ── */
.btn-del {
    background: none;
    border: none;
    color: #EF4444;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: background 0.2s;
}
.btn-del:hover { background: #FEE2E2; }

/* ── Savings Page Header ── */
.savings-header {
    background: linear-gradient(135deg, #6C3CE1, #4F46E5);
    padding: 24px 20px 40px;
    color: #fff;
}
.savings-header h1 { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.savings-header p { font-size: 13px; opacity: 0.75; }

/* ── Modal ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 300;
    align-items: flex-end;
    justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: var(--card);
    border-radius: 24px 24px 0 0;
    padding: 24px;
    width: 100%;
    max-width: 430px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s cubic-bezier(0.4,0,0.2,1);
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.modal-handle {
    width: 40px; height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 20px;
}
.modal-title { font-size: 19px; font-weight: 700; margin-bottom: 16px; color: var(--text); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 0; height: 0; }

/* ── Responsive ── */
@media (min-width: 431px) {
    .app-shell {
        box-shadow: 0 0 60px rgba(0,0,0,0.15);
    }
}
