/* ============================================================
   KudiCom PWA — app.css
   Mobile-first, app-like UI
   Brand: #0B1B3D (dark blue)  |  #FF6B00 (orange)
   ============================================================ */

:root {
  --navy:       #0B1B3D;
  --navy-soft:  #132a5c;
  --orange:     #FF6B00;
  --orange-soft:#FF8A33;
  --success:    #10B981;
  --danger:     #EF4444;
  --warning:    #F59E0B;
  --bg:         #F5F7FB;
  --surface:    #FFFFFF;
  --text:       #0B1B3D;
  --text-muted: #6B7A99;
  --border:     #E5E9F2;
  --radius:     14px;
  --radius-lg:  20px;
  --shadow-sm:  0 1px 3px rgba(11,27,61,.06), 0 1px 2px rgba(11,27,61,.04);
  --shadow-md:  0 4px 12px rgba(11,27,61,.08);
  --shadow-lg:  0 12px 32px rgba(11,27,61,.14);
  --safe-top:   env(safe-area-inset-top, 0px);
  --safe-bot:   env(safe-area-inset-bottom, 0px);
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body { overscroll-behavior-y: none; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }
.hidden { display: none !important; }

/* ---------------- Splash ---------------- */
.splash {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(160deg, #0B1B3D 0%, #132a5c 100%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 40px;
  transition: opacity .4s ease, visibility .4s ease;
}
.splash.done { opacity: 0; visibility: hidden; }
.splash-logo { text-align: center; color: #fff; }
.splash-logo h1 { font-size: 32px; font-weight: 700; margin-top: 20px; letter-spacing: -.5px; }
.splash-logo p  { color: rgba(255,255,255,.6); margin-top: 6px; font-size: 14px; }

.splash-icon {
  width: 84px; height: 84px; margin: 0 auto;
  background: #fff; border-radius: 22px;
  position: relative; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 7px;
  box-shadow: 0 20px 40px rgba(0,0,0,.3);
}
.splash-icon.small { width: 60px; height: 60px; border-radius: 16px; box-shadow: none; margin: 0 auto; }
.splash-line {
  width: 40%; height: 3.5px; background: var(--navy); border-radius: 2px;
}
.splash-icon.small .splash-line { height: 3px; }
.splash-smile {
  position: absolute; bottom: 20%; left: 18%; right: 18%; height: 12px;
  border-bottom: 3.5px solid var(--orange); border-radius: 0 0 50% 50% / 0 0 100% 100%;
}
.splash-icon.small .splash-smile { border-bottom-width: 3px; height: 10px; }

.splash-loader {
  width: 32px; height: 32px;
  border: 3px solid rgba(255,255,255,.15);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- App Shell ---------------- */
.app {
  display: flex; flex-direction: column;
  min-height: 100vh;
  padding-top: var(--safe-top);
  padding-bottom: calc(72px + var(--safe-bot));
}

/* ---------------- Top Bar ---------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 10px;
  background: var(--bg);
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--navy), var(--navy-soft));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
}
.avatar.large { width: 64px; height: 64px; font-size: 24px; }
.greeting { display: flex; flex-direction: column; }
.greeting-small { font-size: 12px; color: var(--text-muted); }
.greeting-name  { font-size: 15px; font-weight: 600; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--surface); display: flex; align-items: center; justify-content: center;
  color: var(--navy); position: relative; box-shadow: var(--shadow-sm);
}
.notif-badge {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--orange); border: 2px solid var(--surface);
}

/* ---------------- Content ---------------- */
.content { flex: 1; padding: 0 18px 20px; }
.screen { display: none; animation: fadeIn .2s ease; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------- Balance Card ---------------- */
.balance-card {
  background: linear-gradient(135deg, #0B1B3D 0%, #132a5c 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  margin-bottom: 22px;
}
.balance-card::before {
  content: ""; position: absolute; top: -60px; right: -60px;
  width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,107,0,.35) 0%, transparent 70%);
}
.balance-card.compact { padding: 18px; margin-bottom: 16px; }
.balance-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1px;
  color: rgba(255,255,255,.55); margin-bottom: 6px;
}
.balance-amount { font-size: 34px; font-weight: 700; letter-spacing: -1px; }
.balance-card.compact .balance-amount { font-size: 28px; }
.balance-actions { display: flex; gap: 10px; margin-top: 18px; }
.quick-btn {
  flex: 1;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 12px;
  color: #fff; padding: 10px 14px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 13px; font-weight: 500;
  transition: background .15s;
}
.quick-btn:active { background: rgba(255,255,255,.22); }
.quick-icon {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--orange); display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}

/* ---------------- Sections ---------------- */
.section-title { font-size: 14px; font-weight: 600; color: var(--text); margin: 20px 0 12px; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 12px; }
.section-title-row .section-title { margin: 0; }
.section-link { color: var(--orange); font-size: 13px; text-decoration: none; font-weight: 500; }

/* ---------------- Quick Grid ---------------- */
.quick-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.quick-tile {
  background: var(--surface); border-radius: var(--radius);
  padding: 14px 6px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  box-shadow: var(--shadow-sm);
  font-size: 11px; font-weight: 500; color: var(--text);
  transition: transform .1s;
}
.quick-tile:active { transform: scale(.96); }
.quick-tile-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}

/* ---------------- Transaction List ---------------- */
.tx-list { display: flex; flex-direction: column; gap: 8px; }
.tx-item {
  background: var(--surface); border-radius: var(--radius);
  padding: 14px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-sm);
}
.tx-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 16px;
}
.tx-icon.credit { background: var(--success); }
.tx-icon.debit  { background: var(--navy); }
.tx-body { flex: 1; min-width: 0; }
.tx-desc { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-time { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.tx-amount { font-size: 14px; font-weight: 600; text-align: right; }
.tx-amount.credit { color: var(--success); }
.tx-amount.debit  { color: var(--navy); }

.empty-state {
  text-align: center; padding: 40px 20px;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.empty-state p { font-weight: 600; margin-bottom: 4px; }
.empty-state span { color: var(--text-muted); font-size: 13px; }

/* ---------------- Screen Header ---------------- */
.screen-header { padding: 4px 0 16px; }
.screen-header h2 { font-size: 22px; font-weight: 700; letter-spacing: -.4px; }

/* ---------------- Forms ---------------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.field input {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
  font-size: 15px; color: var(--text);
  transition: border-color .15s;
  outline: none; width: 100%;
}
.field input:focus { border-color: var(--orange); }

.btn-primary {
  background: var(--orange); color: #fff;
  border-radius: 12px; padding: 15px 20px;
  font-size: 15px; font-weight: 600;
  box-shadow: 0 6px 16px rgba(255,107,0,.3);
  transition: transform .1s, box-shadow .15s;
  margin-top: 6px;
  width: 100%;
}
.btn-primary:active { transform: scale(.98); box-shadow: 0 3px 10px rgba(255,107,0,.35); }
.btn-primary:disabled { opacity: .6; }

/* ---------------- Menu / Info ---------------- */
.menu-item {
  display: block; width: 100%; text-align: left;
  background: var(--surface); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 8px;
  font-size: 15px; font-weight: 500; color: var(--text);
  box-shadow: var(--shadow-sm);
}
.menu-item.danger { color: var(--danger); }
.menu-item:active { background: #F0F3F8; }

.info-row {
  display: flex; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.info-row span { color: var(--text-muted); }
.info-row strong { color: var(--text); font-weight: 600; }

/* ---------------- Profile ---------------- */
.profile-card {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 22px; display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-sm); margin-bottom: 20px;
}
.profile-name  { font-size: 18px; font-weight: 700; }
.profile-email { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ---------------- Bottom Nav ---------------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: #fff; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
  padding: 8px 0 calc(8px + var(--safe-bot));
  box-shadow: 0 -4px 16px rgba(11,27,61,.06);
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text-muted); font-size: 10.5px; font-weight: 500;
  padding: 6px 0;
  transition: color .15s;
}
.nav-btn.active { color: var(--navy); }
.nav-btn-center {
  flex: 0 0 auto;
  width: 52px; height: 52px; border-radius: 16px;
  background: linear-gradient(135deg, var(--orange), var(--orange-soft));
  color: #fff; margin-top: -18px;
  box-shadow: 0 8px 20px rgba(255,107,0,.4);
  justify-content: center;
}
.nav-btn-center svg { stroke: #fff; }
.nav-btn-center span { display: none; }

/* ---------------- Auth ---------------- */
.auth {
  position: fixed; inset: 0; z-index: 500;
  background: linear-gradient(160deg, #0B1B3D 0%, #132a5c 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.auth-card {
  width: 100%; max-width: 400px;
  background: #fff; border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-lg);
  margin: auto 0;
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand h1 { font-size: 24px; font-weight: 700; margin-top: 12px; color: var(--navy); }
.auth-brand .splash-icon.small {
  background: var(--navy); box-shadow: 0 8px 20px rgba(11,27,61,.25);
}
.auth-brand .splash-icon.small .splash-line { background: #fff; }
.auth-brand .splash-icon.small .splash-smile { border-bottom-color: var(--orange); }

.auth-tabs {
  display: flex; background: #F0F3F8;
  border-radius: 12px; padding: 4px; margin-bottom: 20px;
}
.auth-tab {
  flex: 1; padding: 10px; border-radius: 10px;
  font-size: 14px; font-weight: 600; color: var(--text-muted);
  transition: all .2s;
}
.auth-tab.active { background: #fff; color: var(--navy); box-shadow: var(--shadow-sm); }

.auth-form { display: none; flex-direction: column; gap: 12px; }
.auth-form.active { display: flex; }
.auth-foot {
  text-align: center; font-size: 12px; color: var(--text-muted);
  margin-top: 20px;
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff;
  padding: 12px 20px; border-radius: 12px;
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  max-width: 90vw;
  animation: toastIn .25s ease;
}
.toast.error   { background: var(--danger); }
.toast.success { background: var(--success); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------------- Large phones / small tablets ---------------- */
@media (min-width: 640px) {
  .content { max-width: 520px; margin: 0 auto; width: 100%; }
  .topbar  { max-width: 520px; margin: 0 auto; width: 100%; }
  .bottom-nav { max-width: 520px; margin: 0 auto; left: 50%; transform: translateX(-50%); border-radius: 20px 20px 0 0; }
}

/* ---------------- Real KudiCom icon inside splash tiles ---------------- */
.splash-icon {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.splash-icon svg {
  display: block;
  filter: drop-shadow(0 20px 40px rgba(0,0,0,.35));
  border-radius: 22px;
}
.splash-icon.small svg {
  filter: drop-shadow(0 8px 20px rgba(0,0,0,.25));
  border-radius: 16px;
}
