/* ==================== VARIABLES & THEMES ==================== */
:root {
  --bg-primary: #070b14;
  --bg-secondary: #0d1424;
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-bg-hover: rgba(255, 255, 255, 0.11);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --text-primary: #f4f7fb;
  --text-secondary: #9aa7bd;
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.35);
  --primary-grad: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  --card-grad: linear-gradient(145deg, rgba(14, 165, 233, 0.22) 0%, rgba(30, 41, 59, 0.65) 100%);
  --success: #10b981;
  --danger: #ef4444;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --warning-border: rgba(245, 158, 11, 0.35);
  --nav-bg: rgba(11, 17, 30, 0.82);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
}

[data-theme="light"] {
  --bg-primary: #eef3f9;
  --bg-secondary: #ffffff;
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-bg-hover: rgba(255, 255, 255, 0.92);
  --glass-border: rgba(15, 23, 42, 0.1);
  --glass-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --accent: #0284c7;
  --accent-glow: rgba(2, 132, 199, 0.25);
  --card-grad: linear-gradient(145deg, rgba(14, 165, 233, 0.16) 0%, rgba(255, 255, 255, 0.88) 100%);
  --nav-bg: rgba(255, 255, 255, 0.85);
}

/* ==================== RESET & BASE ==================== */
* {
  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, Inter, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.hidden {
  display: none !important;
}

/* ==================== AMBIENT ORBS ==================== */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  animation: floatOrb 18s ease-in-out infinite alternate;
}

.orb-1 {
  width: 280px;
  height: 280px;
  background: #0284c7;
  top: -70px;
  left: -60px;
}

.orb-2 {
  width: 250px;
  height: 250px;
  background: #4f46e5;
  bottom: 10%;
  right: -70px;
  animation-delay: -6s;
}

.orb-3 {
  width: 200px;
  height: 200px;
  background: #0ea5e9;
  top: 45%;
  left: 35%;
  opacity: 0.22;
  animation-delay: -12s;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(24px, -28px) scale(1.12); }
}

/* ==================== GLASSMORPHISM CORE ==================== */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--glass-shadow);
}

.btn-glass {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-primary);
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform 0.18s ease, background 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
}

.btn-glass:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary-grad);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  box-shadow: 0 6px 22px var(--accent-glow);
}

.btn-secondary:hover {
  background: var(--glass-bg-hover);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

[data-theme="light"] .btn-danger {
  color: #b91c1c;
}

.btn-lg {
  padding: 16px 22px;
  font-size: 1.02rem;
}

.btn-chip {
  width: auto;
  padding: 7px 14px;
  font-size: 0.82rem;
  border-radius: 999px;
}

.btn-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ==================== LIVE COIN ANIMATIONS ==================== */
.coin-spin-infinite {
  animation: liveCoinSpin 22s linear infinite;
  will-change: transform;
}

.coin-spin-slow {
  animation: liveCoinSpin 30s linear infinite;
}

@keyframes liveCoinSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ==================== APP SHELL & SCREENS ==================== */
.app-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.screen, .main-shell, .tab-view {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.screen-scroll, .home-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.home-scroll {
  padding-bottom: 92px;
}

/* ==================== WELCOME SCREEN ==================== */
.welcome-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 22px;
  text-align: center;
}

.hero-coin-stage {
  position: relative;
  width: 152px;
  height: 152px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}

.hero-coin-glow {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  animation: pulseGlow 3.5s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
  0% { transform: scale(0.92); opacity: 0.6; }
  100% { transform: scale(1.18); opacity: 1; }
}

.hero-coin {
  width: 136px;
  height: 136px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
}

.brand-title {
  font-size: 2.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.brand-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 300px;
  line-height: 1.5;
  margin-bottom: 36px;
}

.welcome-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ==================== HEADERS ==================== */
.sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
}

.sub-header h2 {
  font-size: 1.12rem;
  font-weight: 700;
}

.icon-btn-glass {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn-glass svg {
  width: 20px;
  height: 20px;
}

[dir="rtl"] .back-btn svg,
[dir="rtl"] .chevron-icon {
  transform: rotate(180deg);
}

.header-spacer {
  width: 40px;
}

/* ==================== 24 WORDS GRID & VERIFY ==================== */
.warning-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--warning-bg);
  border-color: var(--warning-border);
  border-radius: var(--radius-lg);
}

.warn-icon {
  width: 22px;
  height: 22px;
  color: #f59e0b;
  flex-shrink: 0;
  margin-top: 2px;
}

.warning-banner p, .info-box p {
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.info-box {
  padding: 14px 16px;
  border-radius: var(--radius-lg);
}

.words-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.word-chip {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
}

.word-num {
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  min-width: 18px;
}

.word-val {
  font-weight: 600;
  word-break: break-all;
}

.import-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hint-text {
  font-size: 0.83rem;
  color: var(--text-secondary);
}

.import-cell {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.import-cell:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.import-cell input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 600;
}

.verify-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.verify-item {
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.verify-item label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
}

.stack-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

/* ==================== MAIN HOME VIEW ==================== */
.main-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 8px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-logo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.topbar-name {
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.balance-card {
  position: relative;
  overflow: hidden;
  padding: 24px 20px;
  background: var(--card-grad);
  min-height: 168px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card-coin-watermark {
  position: absolute;
  right: -28px;
  top: 50%;
  transform: translateY(-50%);
  width: 175px;
  height: 175px;
  opacity: 0.24;
  pointer-events: none;
}

[dir="rtl"] .card-coin-watermark {
  right: auto;
  left: -28px;
}

.watermark-coin {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.balance-content {
  position: relative;
  z-index: 2;
}

.balance-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.balance-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 6px 0 16px;
}

.balance-amount {
  font-size: 2.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.balance-ticker {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
}

.address-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: 0.84rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

[data-theme="light"] .address-pill {
  background: rgba(255, 255, 255, 0.72);
}

.address-pill:active {
  transform: scale(0.96);
}

.copy-mini-icon {
  width: 15px;
  height: 15px;
  color: var(--accent);
}

/* ==================== ACTION BUTTONS ==================== */
.action-buttons-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.action-tile {
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.96rem;
  border-radius: var(--radius-lg);
  transition: transform 0.18s ease, background 0.2s ease;
}

.action-tile:hover {
  background: var(--glass-bg-hover);
}

.action-tile:active {
  transform: scale(0.96);
}

.action-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-grad);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.action-circle svg {
  width: 21px;
  height: 21px;
}

/* ==================== TRANSACTION HISTORY ==================== */
.history-card {
  padding: 18px;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-header-row h3 {
  font-size: 1rem;
  font-weight: 700;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
}

.tx-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
}

.tx-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tx-badge {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.tx-badge.in {
  background: rgba(16, 185, 129, 0.16);
  color: var(--success);
}

.tx-badge.out {
  background: rgba(239, 68, 68, 0.16);
  color: var(--danger);
}

.tx-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tx-peer {
  font-size: 0.88rem;
  font-weight: 600;
  font-family: ui-monospace, monospace;
}

.tx-sub {
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.tx-right {
  text-align: end;
}

.tx-amount {
  font-size: 0.94rem;
  font-weight: 700;
  display: block;
}

.tx-amount.in { color: var(--success); }
.tx-amount.out { color: var(--text-primary); }

.tx-status {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.empty-state {
  text-align: center;
  padding: 26px 12px;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

/* ==================== BOTTOM NAVIGATION BAR ==================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: 70px;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  z-index: 20;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease;
}

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

.nav-icon {
  width: 23px;
  height: 23px;
}

/* ==================== SETTINGS PAGE ==================== */
.settings-group {
  padding: 6px 16px;
}

.setting-row, .setting-action-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  background: none;
  border: none;
  color: var(--text-primary);
  text-align: start;
}

.setting-action-row {
  cursor: pointer;
}

.setting-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.setting-title {
  font-size: 0.96rem;
  font-weight: 600;
}

.setting-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.danger-row .setting-title,
.danger-row .chevron-icon {
  color: var(--danger);
}

.setting-divider {
  height: 1px;
  background: var(--glass-border);
}

.chevron-icon {
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.glass-select {
  background: var(--glass-bg);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  outline: none;
}

.glass-select option {
  background: #0f172a;
  color: #ffffff;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background-color: rgba(148, 163, 184, 0.3);
  border-radius: 999px;
  transition: 0.3s;
}

.slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: 0.3s;
}

input:checked + .slider {
  background: var(--primary-grad);
}

input:checked + .slider::before {
  transform: translateX(22px);
}

/* ==================== FORMS, QR, EXPLORER & OVERLAYS ==================== */
.form-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.amount-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.glass-input {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text-primary);
  font-size: 0.94rem;
  outline: none;
}

[data-theme="light"] .glass-input {
  background: rgba(255, 255, 255, 0.8);
}

.glass-input:focus {
  border-color: var(--accent);
}

.fee-summary {
  display: flex;
  justify-content: space-between;
  font-size: 0.83rem;
  color: var(--text-secondary);
}

.receive-card {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
}

.qr-frame {
  padding: 14px;
  background: #ffffff;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.receive-hint {
  font-size: 0.86rem;
  color: var(--text-secondary);
}

.full-address-box {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--glass-border);
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
  word-break: break-all;
}

.filter-bar {
  display: flex;
  gap: 8px;
  padding: 0 18px 6px;
}

.filter-pill {
  flex: 1;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.84rem;
  cursor: pointer;
}

.filter-pill.active {
  background: var(--primary-grad);
  color: #ffffff;
  border-color: transparent;
}

.explorer-stats-grid {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.stat-val {
  font-size: 1rem;
  font-weight: 700;
}

.search-card {
  padding: 12px;
}

.search-row {
  display: flex;
  gap: 8px;
}

.search-row .btn-glass {
  width: auto;
  padding: 0 18px;
}

.error-text {
  color: #f87171;
  font-size: 0.86rem;
  text-align: center;
  font-weight: 600;
}

/* ==================== LOCK OVERLAY & DIALOGS ==================== */
.lock-overlay, .dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4, 7, 15, 0.86);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}

.lock-card, .dialog-card {
  width: 100%;
  max-width: 380px;
  padding: 28px 22px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.lock-logo {
  width: 82px;
  height: 82px;
  border-radius: 50%;
}

.lock-card p, .dialog-card p {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.lock-detail {
  font-size: 0.78rem;
  color: var(--accent);
}

.dialog-actions {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 6px;
}

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  border: 1px solid rgba(56, 189, 248, 0.45);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
