/* ═══════════════════════════════════════
   Muna Wallet — app.css
   ═══════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;700&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --color-primary:      #80572F;
  --color-primary-dark: #5F3C1A;
  --color-background:   #F4F5F2;
  --color-surface:      #D5D6D3;
  --color-accent:       #A6763F;
  --color-text:         #2E2E2E;
  --color-text-muted:   #7A7A73;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', sans-serif;

  --radius:   12px;
  --radius-lg: 20px;
  --shadow:   0 2px 12px rgba(95,60,26,.10);
  --shadow-lg: 0 8px 32px rgba(95,60,26,.16);
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--color-background);
  color: var(--color-text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Layout ─────────────────────────────── */

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

.app-header {
  background: var(--color-primary-dark);
  color: #fff;
  padding: 1.25rem 1.5rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: .02em;
}

.app-header .subtitle {
  font-size: .75rem;
  opacity: .7;
  font-weight: 300;
  margin-top: 2px;
}

.app-content {
  flex: 1;
  padding: 1.5rem 1rem 6rem;
  overflow-y: auto;
}

/* ── Bottom Nav ──────────────────────────── */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--color-primary-dark);
  display: flex;
  justify-content: space-around;
  padding: .5rem 0 calc(.5rem + env(safe-area-inset-bottom));
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: rgba(255,255,255,.55);
  font-size: .65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  text-decoration: none;
  padding: .4rem .8rem;
  border-radius: var(--radius);
  transition: color var(--transition);
  cursor: pointer;
  background: none;
  border: none;
}

.nav-item svg { width: 22px; height: 22px; }

.nav-item.active,
.nav-item:hover { color: #fff; }

.nav-item.active { color: var(--color-accent); }

/* ── Cards ───────────────────────────────── */

.card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.wallet-card {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.wallet-card::after {
  content: '';
  position: absolute;
  right: -20px; top: -30px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,.07);
}

.wallet-card .label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  opacity: .7;
  margin-bottom: .4rem;
}

.wallet-card .amount {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.wallet-card .currency {
  font-size: .9rem;
  opacity: .7;
  margin-right: .3rem;
}

/* ── Transaction list ─────────────────────── */

.tx-list { list-style: none; }

.tx-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--color-surface);
}

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

.tx-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.tx-icon.income  { background: #e6f4ea; }
.tx-icon.expense { background: #fce8e6; }

.tx-info { flex: 1; min-width: 0; }

.tx-desc {
  font-size: .875rem;
  font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.tx-date { font-size: .72rem; color: var(--color-text-muted); margin-top: 2px; }

.tx-amount {
  font-weight: 600;
  font-size: .9rem;
  white-space: nowrap;
}

.tx-amount.income  { color: #2e7d32; }
.tx-amount.expense { color: #c62828; }

/* ── Forms ────────────────────────────────── */

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

.form-label {
  display: block;
  font-size: .75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--color-text-muted);
  margin-bottom: .35rem;
}

.form-control {
  width: 100%;
  padding: .7rem .9rem;
  border: 1.5px solid var(--color-surface);
  border-radius: var(--radius);
  background: var(--color-background);
  font-family: var(--font-body);
  font-size: .9rem;
  color: var(--color-text);
  transition: border-color var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--color-accent);
}

select.form-control { cursor: pointer; }

/* ── Buttons ──────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .75rem 1.5rem;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  width: 100%;
}

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

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--color-primary);
  color: var(--color-primary);
}

/* ── FAB ──────────────────────────────────── */

.fab {
  position: fixed;
  bottom: calc(68px + env(safe-area-inset-bottom));
  right: calc(50% - 220px);
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  border: none;
  font-size: 1.5rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: transform var(--transition), background var(--transition);
  z-index: 99;
}

.fab:hover { transform: scale(1.08); background: var(--color-primary); }

/* ── Modal / Sheet ────────────────────────── */

.sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(46,46,46,.45);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.sheet-overlay.open { display: flex; }

.sheet {
  background: var(--color-background);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1.5rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 480px;
  animation: slideUp .25s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.sheet-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: 1.25rem;
}

/* ── Section headings ─────────────────────── */

.section-title {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--color-text-muted);
  margin-bottom: .75rem;
  font-weight: 500;
}

/* ── Toasts ───────────────────────────────── */

.toast {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-primary-dark);
  color: #fff;
  padding: .6rem 1.25rem;
  border-radius: 99px;
  font-size: .8rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  z-index: 300;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Utility ──────────────────────────────── */

.text-muted { color: var(--color-text-muted); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--color-text-muted); font-size: .875rem; }

/* ── Page visibility ──────────────────────── */

.page { display: none; }
.page.active { display: block; }

/* ── Offline banner ───────────────────────── */

.offline-banner {
  background: var(--color-accent);
  color: #fff;
  text-align: center;
  font-size: .75rem;
  padding: .3rem;
  display: none;
}

body.offline .offline-banner { display: block; }
