/* ═══════════════════════════════════════════════
   XAPA SMART — SHARED MOBILE CSS
   Applied to every page for consistent UX
═══════════════════════════════════════════════ */

/* ── VARIABLES ──────────────────────────────── */
:root {
  --brand:        #1343c6;
  --brand-2:      #1a56f0;
  --brand-light:  #eef2ff;
  --brand-glow:   rgba(19,67,198,0.22);
  --bg:           #f0f4ff;
  --card:         #ffffff;
  --text:         #0f172a;
  --muted:        #64748b;
  --border:       #e2e8f0;
  --danger:       #ef4444;
  --success:      #10b981;
  --warning:      #f59e0b;
  --nav-h:        64px;
  --header-grad:  linear-gradient(155deg,#0f35b8 0%,#1a56f0 60%,#2563eb 100%);
  --shadow-sm:    0 1px 4px rgba(0,0,0,0.07);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.09);
  --shadow-blue:  0 6px 22px rgba(19,67,198,0.18);
  --radius:       18px;
  --radius-sm:    12px;
}

/* ── RESET & BASE ───────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box; margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden; position: fixed;
  font-family: -apple-system, BlinkMacSystemFont,
    'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
}

body {
  display: flex;
  flex-direction: column;
}

/* ── SHARED HEADER ──────────────────────────── */
.app-header {
  background: var(--header-grad);
  color: #fff;
  padding: 14px 16px 20px;
  border-bottom-left-radius: 24px;
  border-bottom-right-radius: 24px;
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}

/* Back row inside header */
.header-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.back-btn {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.18);
  border: none; border-radius: 10px;
  color: #fff; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; text-decoration: none;
  flex-shrink: 0;
  transition: background 0.2s;
}
.back-btn:active { background: rgba(255,255,255,0.3); }

.header-title {
  font-size: 18px; font-weight: 700; color: #fff;
  flex: 1; margin: 0;
}

.back-link {
  color: rgba(255,255,255,0.9);
  font-size: 14px; text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
  margin-bottom: 8px;
}

.app-header h2 {
  font-size: 20px; font-weight: 700; color: #fff;
  margin: 0;
}

/* ── CONTENT AREA ───────────────────────────── */
.content-wrapper,
.content-area,
.scroll-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 14px 14px 80px;
}
.content-wrapper::-webkit-scrollbar,
.content-area::-webkit-scrollbar,
.scroll-area::-webkit-scrollbar { display: none; }

/* ── CARDS ──────────────────────────────────── */
.card, .home-card, .section-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-md);
  margin-bottom: 12px;
}

.card-title {
  font-size: 13px; font-weight: 700;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 12px;
}

/* ── FORM ELEMENTS ──────────────────────────── */
input, select, textarea {
  font-size: 16px !important; /* Prevent iOS zoom */
  font-family: inherit;
}

.form-group { margin-bottom: 14px; }

.form-label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--muted); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.4px;
}

.form-input, .form-select, .form-textarea,
.form-control {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px !important;
  font-family: inherit;
  color: var(--text);
  background: #f8fafc;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  display: block;
}
.form-input:focus, .form-select:focus,
.form-textarea:focus, .form-control:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(19,67,198,0.08);
}

.form-textarea { min-height: 90px; resize: vertical; }

/* ── BUTTONS ────────────────────────────────── */
.btn, .btn-primary, .btn-secondary, .btn-outline {
  display: block;
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 700;
  font-family: inherit;
  cursor: pointer; border: none;
  text-align: center;
  min-height: 50px;
  transition: transform 0.1s, opacity 0.2s;
  text-decoration: none;
}
.btn:active, .btn-primary:active { transform: scale(0.98); }

.btn-primary {
  background: var(--brand); color: #fff;
  box-shadow: 0 4px 16px rgba(19,67,198,0.3);
}
.btn-primary:hover { background: var(--brand-2); }

.btn-secondary {
  background: var(--border); color: var(--text);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--brand);
  color: var(--brand);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px; min-height: 36px;
  width: auto; display: inline-block;
}

.btn-danger {
  background: var(--danger); color: #fff;
}

/* ── BOTTOM NAV ─────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--card);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
  flex-shrink: 0;
}

.bottom-nav a {
  text-decoration: none;
  color: var(--muted);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  font-size: 10px; font-weight: 500;
  padding: 6px 4px;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav a .icon-wrapper {
  width: 44px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 22px;
  font-size: 20px;
  transition: all 0.25s ease;
}

.bottom-nav a.active {
  color: var(--brand);
  font-weight: 700;
}

.bottom-nav a.active .icon-wrapper {
  background: var(--brand);
  box-shadow: 0 4px 14px var(--brand-glow);
  transform: translateY(-6px);
  font-size: 18px;
  color: #fff;
}

/* Older icon-wrapper pattern (span inside) */
.bottom-nav a span {
  display: block; font-size: 20px; line-height: 1;
  transition: all 0.25s ease;
}
.bottom-nav a.active span { color: #fff; }

/* ── STATUS BADGES ──────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-gray   { background: #f1f5f9; color: var(--muted); }

/* ── DIVIDER ────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 12px 0; }

/* ── LOADING SPINNER ────────────────────────── */
.spinner {
  width: 38px; height: 38px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  font-size: 14px;
}

/* ── EMPTY STATE ────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--muted);
}
.empty-state-icon { font-size: 56px; margin-bottom: 14px; opacity: 0.5; }
.empty-state h3   { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-state p    { font-size: 14px; line-height: 1.5; }

/* ── SECTION LABEL ──────────────────────────── */
.section-label {
  font-size: 11px; font-weight: 700;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.6px; margin-bottom: 10px; padding: 0 2px;
}

/* ── TABS ───────────────────────────────────── */
.tabs {
  display: flex;
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  padding: 3px; gap: 2px;
  margin-bottom: 14px;
}
.tab {
  flex: 1; padding: 9px 6px;
  text-align: center; font-size: 12px; font-weight: 600;
  border-radius: 10px; cursor: pointer; border: none;
  background: transparent; color: var(--muted);
  transition: all 0.2s;
}
.tab.active {
  background: var(--brand); color: #fff;
  box-shadow: 0 2px 8px var(--brand-glow);
}

/* ── AMOUNT DISPLAY ─────────────────────────── */
.amount-large {
  font-size: 32px; font-weight: 800; color: var(--brand);
  text-align: center; line-height: 1.1;
}
.amount-label {
  font-size: 12px; color: var(--muted);
  text-align: center; margin-top: 2px;
}

/* ── RIPPLE (for interactive items) ─────────── */
.ripple-target { position: relative; overflow: hidden; }
.ripple {
  position: absolute; border-radius: 50%;
  background: rgba(19,67,198,0.18);
  transform: scale(0); animation: ripple-anim 0.5s linear;
  pointer-events: none;
}
@keyframes ripple-anim { to { transform: scale(4); opacity: 0; } }

/* ── ANIMATIONS ─────────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fade-up 0.35s ease both; }
.delay-1 { animation-delay: 0.06s; }
.delay-2 { animation-delay: 0.12s; }
.delay-3 { animation-delay: 0.18s; }

/* ── SAFE AREAS ─────────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-nav { padding-bottom: env(safe-area-inset-bottom); }
}

/* ── MODAL ──────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-sheet {
  background: var(--card);
  border-radius: 24px 24px 0 0;
  padding: 20px 20px 32px;
  width: 100%; max-height: 85vh;
  overflow-y: auto;
}
.modal-handle {
  width: 40px; height: 4px;
  background: var(--border); border-radius: 2px;
  margin: 0 auto 16px;
}
