/* PuppyPay — Professional light fintech (polished) */

:root {
  --bg: #f0f4f8;
  --bg-white: #ffffff;
  --bg-soft: #e8eef5;
  --header-1: #1e3a8a;
  --header-2: #2563eb;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff6ff;
  --success: #16a34a;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-on-header: #e2e8f0;
  --border: rgba(226, 232, 240, 0.9);
  --border-strong: #cbd5e1;
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.07), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.1), 0 4px 12px rgba(15, 23, 42, 0.05);
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 24px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, monospace;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
}
body {
  font-family: var(--font);
  background: #dbe4ef;
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  height: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* =========================================================
   Native app feel — kill text selection + blue tap highlight
   (Android WebView / Capacitor strong fix)
   ========================================================= */
html, body, * {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
  -webkit-tap-highlight-color: transparent !important;
  outline: none !important;
  -webkit-focus-ring-color: transparent !important;
}

/* Allow text selection only where needed */
input, textarea, [contenteditable="true"], [contenteditable="true"] * {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
  -webkit-touch-callout: default !important;
}

/* Extra safety on all interactive elements */
button,
a,
.btn,
.menu-item,
.nav-item,
.pill-btn,
.copy-btn,
.back-btn,
.avatar-btn,
.eye-btn,
.orders-tab,
.order-chip,
[role="button"],
[onclick] {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
  -webkit-tap-highlight-color: transparent !important;
  outline: none !important;
  -webkit-focus-ring-color: transparent !important;
}

button:focus,
button:active,
a:focus,
a:active,
.btn:focus,
.btn:active,
.menu-item:focus,
.menu-item:active,
.nav-item:focus,
.nav-item:active {
  outline: none !important;
  -webkit-tap-highlight-color: transparent !important;
  box-shadow: none; /* only removes focus ring, not intentional shadows */
}

/* Restore intentional button shadows (override the line above for real buttons) */
.btn-primary:focus,
.btn-primary:active {
  box-shadow: 0 8px 20px rgba(37, 99, 235, .28);
}
.btn-secondary:focus,
.btn-secondary:active {
  box-shadow: var(--shadow-sm);
}

* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.phone {
  width: 100%;
  max-width: 430px;
  min-height: 100dvh;
  height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(30, 58, 138, .12);
}

.view {
  display: none !important;
  flex: 1;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  position: relative;
}
.view.active {
  display: flex !important;
}
.view > * {
  flex-shrink: 0 !important;
}

.glass, .card {
  background: linear-gradient(160deg, #ffffff 0%, #eff6ff 55%, #dbeafe 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid #bfdbfe;
  border-radius: var(--r-lg);
  box-shadow:
    0 6px 20px rgba(37, 99, 235, 0.08),
    0 2px 6px rgba(15, 23, 42, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.tint-blue {
  background: linear-gradient(160deg, #ffffff 0%, #eff6ff 50%, #dbeafe 100%) !important;
  border-color: #93c5fd !important;
}
.tint-green {
  background: linear-gradient(160deg, #ffffff 0%, #ecfdf5 50%, #d1fae5 100%) !important;
  border-color: #6ee7b7 !important;
}
.tint-red {
  background: linear-gradient(160deg, #ffffff 0%, #fef2f2 50%, #fee2e2 100%) !important;
  border-color: #fca5a5 !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: var(--r-md);
  font-weight: 700;
  font-size: 15px;
  border: none;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s;
  -webkit-tap-highlight-color: transparent !important;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
  color: #fff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .28);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 12px 24px rgba(37, 99, 235, .35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  border: 1.5px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-soft); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn-lg { padding: 15px 24px; font-size: 16px; }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.field .optional { font-weight: 500; color: var(--text-muted); font-size: 12px; }

.input-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0 14px;
  min-height: 50px;
  transition: border-color .15s, box-shadow .15s, background .15s;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.input-shell:focus-within {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input-shell .icon {
  color: var(--text-muted);
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
}
.input-shell input, .input-shell select, .input-shell textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  padding: 13px 0;
  min-width: 0;
}
.input-shell input::placeholder { color: var(--text-muted); }
.input-shell.with-btn { padding-right: 6px; }

.pill-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent !important;
}
.pill-btn:disabled { opacity: .55; cursor: not-allowed; }

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #0f172a;
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all .25s var(--ease);
  z-index: 200;
  box-shadow: var(--shadow-lg);
  max-width: calc(100% - 32px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

.logo { display: flex; align-items: center; gap: 8px; }
.logo img { border-radius: 50%; }
.logo-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--text);
}
.logo-text.on-dark { color: #fff; }

.bottom-nav {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 28px);
  max-width: 400px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 62px;
  padding: 0 4px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border: none;
  border-radius: 20px;
  z-index: 100;
  box-shadow:
    0 12px 36px rgba(15, 23, 42, 0.16),
    0 2px 8px rgba(15, 23, 42, 0.06);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 62px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  transition: color .2s;
  -webkit-tap-highlight-color: transparent !important;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--accent); }
.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 3px;
  border-radius: 99px;
  background: var(--accent);
}

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

.nav-spacer { height: 100px; flex-shrink: 0 !important; background: transparent !important; }

.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-muted);
  font-size: 14px;
  background: transparent;
}
.empty-state svg {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  color: var(--accent);
  opacity: .5;
}

.ptr-indicator {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -40px);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(15, 23, 42, .12);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
.ptr-indicator.visible { opacity: 1; }
.ptr-indicator.ready {
  box-shadow: 0 4px 16px rgba(37, 99, 235, .25);
  border-color: var(--accent);
}
.ptr-indicator.spinning .ptr-spinner {
  animation: spin .7s linear infinite;
}
.ptr-spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
}
