/* CryPay POS — Vue 3 SPA */

:root {
  --primary:      #6366f1;
  --primary-dark: #4f46e5;
  --bg:           #0f172a;
  --surface:      #1e293b;
  --surface-alt:  #273449;
  --border:       #334155;
  --text:         #f1f5f9;
  --text-muted:   #94a3b8;
  --danger:       #ef4444;
  --success:      #22c55e;
  --warning:      #f59e0b;
  --radius:       12px;
  --shadow:       0 4px 24px rgba(0,0,0,.4);
}

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

[v-cloak] { display: none !important; }

body {
  font-family: 'Mulish', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ─── Offline overlay ─────────────────────────────────────── */

#offline-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 32px;
  text-align: center;
}

#offline-overlay.visible { display: flex; }

#offline-overlay .offline-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

#offline-overlay h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
#offline-overlay p  { color: var(--text-muted); font-size: 1rem; max-width: 280px; line-height: 1.5; }

/* ─── Root app ────────────────────────────────────────────── */

#app {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ─── AUTH screen ─────────────────────────────────────────── */

.auth-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.auth-heading { text-align: center; }
.auth-heading h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; }

.subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  text-align: center;
}

.auth-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: #fff;
  box-shadow: 0 8px 24px rgba(99,102,241,.35);
}

.auth-title {
  font-size: 1.35rem;
  font-weight: 700;
  text-align: center;
}

/* ─── APP WRAPPER ─────────────────────────────────────────── */

.app-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ─── NAVBAR ──────────────────────────────────────────────── */

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 100;
  position: relative;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.menu-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: background 0.15s;
  line-height: 1;
}
.menu-toggle:active { background: var(--surface-alt); }

.logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.device-name {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ─── SIDE MENU ───────────────────────────────────────────── */

.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}
.menu-overlay.active { opacity: 1; visibility: visible; }

.side-menu {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100%;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 300;
  transition: left 0.25s ease;
  display: flex;
  flex-direction: column;
}
.side-menu.active { left: 0; }

.menu-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.menu-items { padding: 8px 0; flex: 1; }

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 20px;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}
.menu-item:active, .menu-item:hover { background: var(--surface-alt); }
.menu-item i { width: 18px; text-align: center; color: var(--text-muted); }
.menu-item-danger { color: var(--danger); }
.menu-item-danger i { color: var(--danger); }

.menu-divider { height: 1px; background: var(--border); margin: 6px 0; }

/* ─── CONTENT AREA ────────────────────────────────────────── */

.content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ─── MAIN SCREEN (amount entry) ──────────────────────────── */

.main-screen {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  flex: 1;
}

.reference-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.reference-input:focus { border-color: var(--primary); }
.reference-input::placeholder { color: var(--text-muted); }

/* ─── SUB-SCREEN (coin-select, payment, settings, history) ── */

.sub-screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

/* ─── CENTERED SCREEN (success, expired) ─────────────────── */

.centered-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px 24px;
  flex: 1;
  text-align: center;
  min-height: 60vh;
}

/* ─── Amount display ──────────────────────────────────────── */

.amount-display {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

.amount-display .currency {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 500;
}

.amount-display .amount {
  font-size: 3.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
  word-break: break-all;
}

/* ─── PIN numpad ──────────────────────────────────────────── */

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}

.numpad-key {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.1s, transform 0.08s;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
}
.numpad-key:active { background: var(--surface-alt); transform: scale(0.95); }

.numpad-key.btn-action {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.numpad-key.btn-action:active { background: var(--primary-dark); }
.numpad-key.btn-action:disabled { opacity: 0.4; pointer-events: none; }

.numpad-key.btn-del { background: var(--surface-alt); }

/* ─── Amount numpad ───────────────────────────────────────── */

.amount-numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.amount-key {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 1.6rem;
  font-weight: 500;
  font-family: inherit;
  height: 72px;
  cursor: pointer;
  transition: background 0.1s, transform 0.08s;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
}
.amount-key:active { background: var(--surface-alt); transform: scale(0.96); }
.amount-key.del-key { color: var(--text-muted); font-size: 1.2rem; }

/* ─── PIN dots ────────────────────────────────────────────── */

.pin-dots {
  display: flex;
  gap: 14px;
  justify-content: center;
}

.pin-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: all 0.15s;
}
.pin-dot.filled {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.1);
}

.pin-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* ─── Step indicator ─────────────────────────────────────── */

.step-indicator {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s;
}
.step-dot.active { background: var(--primary); }

/* ─── Error messages ──────────────────────────────────────── */

.error {
  color: var(--danger);
  font-size: 0.85rem;
  text-align: center;
  width: 100%;
}

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

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.1s;
  width: 100%;
}
.btn:active    { opacity: 0.8; }
.btn:disabled  { opacity: 0.4; pointer-events: none; }

.btn-primary   { background: var(--primary);  color: #fff; }
.btn-secondary { background: var(--surface);  color: var(--text); border-color: var(--border); }
.btn-danger    { background: var(--danger);   color: #fff; }

/* ─── Form controls ───────────────────────────────────────── */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.form-group input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus { border-color: var(--primary); }

/* ─── Registration code input ────────────────────────────── */

.code-input {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--primary);
  font-size: 1.6rem;
  font-weight: 700;
  font-family: 'SF Mono', 'Fira Code', monospace;
  letter-spacing: 4px;
  padding: 14px 16px;
  text-align: center;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
.code-input:focus { border-color: var(--primary); }
.code-input::placeholder { color: var(--border); letter-spacing: 2px; }

/* ─── Toast ───────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease;
  z-index: 1000;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ─── Language switcher ───────────────────────────────────── */

.lang-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.lang-btn.active { border-color: var(--primary); color: var(--primary); }

/* ─── Spinner ─────────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Screen header (sub-screens) ────────────────────────── */

.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.screen-title    { font-size: 1.05rem; font-weight: 600; }
.screen-subtitle { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.back-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.15s;
  flex-shrink: 0;
}
.back-btn:active { background: var(--surface); }

.amount-badge {
  margin-left: auto;
  background: rgba(99,102,241,.1);
  border: 1px solid rgba(99,102,241,.3);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  flex-shrink: 0;
}

/* ─── Coin select list ────────────────────────────────────── */

.coin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.coin-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.15s, background 0.15s;
}
.coin-item:active { background: var(--surface-alt); }
.coin-item.disabled { opacity: 0.4; pointer-events: none; }

.coin-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--primary);
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

.coin-info         { flex: 1; min-width: 0; }
.coin-name         { font-size: 0.95rem; font-weight: 600; }
.coin-network      { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.coin-amounts      { text-align: right; flex-shrink: 0; }
.coin-pay-amount   { font-size: 0.9rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.coin-rate         { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

/* ─── Payment / QR screen ────────────────────────────────── */

.qr-wrapper {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.qr-wrapper canvas { display: block; image-rendering: pixelated; }

.payment-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.payment-info .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.payment-info .amount-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.payment-info .crypto-amount {
  font-size: 1.15rem;
  font-weight: 700;
}

.payment-timer { font-size: 0.9rem; color: var(--text-muted); }
.payment-timer.urgent { color: var(--danger); font-weight: 600; }

/* ─── Status badge ────────────────────────────────────────── */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
}
.status-badge.waiting  { background: rgba(245,158,11,.15); color: var(--warning); }
.status-badge.received { background: rgba(34,197,94,.15);  color: var(--success); }

.status-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.status-badge.waiting::before { animation: pulse 1.2s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ─── Address copy row ────────────────────────────────────── */

.address-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.address-row:active { border-color: var(--primary); }

.address-text {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-hint    { font-size: 0.8rem; color: var(--text-muted); flex-shrink: 0; }
.copied-flash { font-size: 0.75rem; color: var(--success); margin-top: 4px; }

/* ─── Success animation ───────────────────────────────────── */

.success-check {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(34,197,94,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  animation: pop 0.35s cubic-bezier(0.22,0.61,0.36,1);
}

@keyframes pop {
  0%   { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

/* ─── Settings ────────────────────────────────────────────── */

.symbol-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.symbol-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--surface-alt);
}
.symbol-row:last-child { border-bottom: none; }
.symbol-row:active { background: var(--surface-alt); }
.symbol-label { font-size: 0.9rem; font-weight: 600; flex: 1; }

.network-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 38px;
  cursor: pointer;
  transition: background 0.15s;
  border-top: 1px solid var(--surface-alt);
}
.network-row:active { background: var(--surface-alt); }
.network-label { font-size: 0.8rem; color: var(--text-muted); flex: 1; }

.checkbox {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
  transition: all 0.15s;
}
.checkbox.checked { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ─── History list ────────────────────────────────────────── */

.history-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-SUCCESS                    { background: var(--success); }
.dot-WAITING_FOR_PAYMENT,
.dot-WAITING_FOR_CONFIRMATION   { background: var(--warning); }
.dot-EXPIRED, .dot-UNKNOWN      { background: var(--danger);  }
.dot-NEW                        { background: var(--text-muted); }

.history-id { font-family: monospace; font-size: 0.8rem; color: var(--text-muted); flex: 1; }

.history-state {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.state-SUCCESS                  { color: var(--success); }
.state-WAITING_FOR_PAYMENT,
.state-WAITING_FOR_CONFIRMATION { color: var(--warning); }
.state-EXPIRED                  { color: var(--danger);  }
.state-NEW                      { color: var(--text-muted); }
.state-UNKNOWN                  { color: var(--danger);  }

/* ─── Desktop border ──────────────────────────────────────── */

@media (min-width: 520px) {
  body { align-items: center; }
  #app { max-width: 480px; width: 100%; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}
