/* ═══════════════════════════════════════════════════════════════════════════
   hop.decker.im — Main Stylesheet
   Design system: dark theme, glassmorphism, animated mesh gradient
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Design Tokens ────────────────────────────────────────────────────────── */
:root {
  /* Brand colors */
  --color-primary:        #7c5cfc;
  --color-primary-light:  #9d7fff;
  --color-primary-dark:   #5b3fd4;
  --color-secondary:      #00d4ff;
  --color-accent:         #ff6b9d;

  /* Background layers */
  --bg-base:              #0a0a0f;
  --bg-surface:           rgba(255, 255, 255, 0.04);
  --bg-surface-hover:     rgba(255, 255, 255, 0.07);
  --bg-elevated:          rgba(255, 255, 255, 0.08);
  --bg-modal:             rgba(14, 14, 22, 0.95);
  --bg-input:             rgba(255, 255, 255, 0.05);
  --bg-input-focus:       rgba(124, 92, 252, 0.12);

  /* Text */
  --text-primary:         #f0f0ff;
  --text-secondary:       #8888aa;
  --text-tertiary:        #555577;
  --text-disabled:        #3a3a55;

  /* Borders */
  --border-subtle:        rgba(255, 255, 255, 0.06);
  --border-default:       rgba(255, 255, 255, 0.10);
  --border-strong:        rgba(255, 255, 255, 0.18);
  --border-primary:       rgba(124, 92, 252, 0.4);

  /* Status colors */
  --color-success:        #22c55e;
  --color-warning:        #f59e0b;
  --color-error:          #ef4444;
  --color-info:           #3b82f6;

  /* Shadows */
  --shadow-sm:            0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md:            0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg:            0 8px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow:          0 0 40px rgba(124, 92, 252, 0.2);
  --shadow-glow-strong:   0 0 60px rgba(124, 92, 252, 0.35);

  /* Radius */
  --radius-sm:            8px;
  --radius-md:            12px;
  --radius-lg:            16px;
  --radius-xl:            24px;
  --radius-full:          9999px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Typography */
  --font-sans:            'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:            'JetBrains Mono', 'Fira Code', monospace;

  /* Transitions */
  --transition-fast:      150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base:      250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:      400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-index layers */
  --z-base:     0;
  --z-above:    10;
  --z-dropdown: 100;
  --z-modal:    200;
  --z-toast:    300;
  --z-tooltip:  400;
}

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-base);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--color-primary-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-primary); }

button {
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  outline: none;
  background: none;
}

input, select, textarea {
  font-family: var(--font-sans);
  outline: none;
  border: none;
  background: none;
}

img, svg { display: block; }

/* ── Animated Mesh Background ────────────────────────────────────────────── */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-mesh::before {
  content: '';
  position: absolute;
  inset: -50%;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(124, 92, 252, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 10%, rgba(0, 212, 255, 0.12) 0%, transparent 55%),
    radial-gradient(ellipse 70% 60% at 60% 80%, rgba(255, 107, 157, 0.10) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 10% 70%, rgba(124, 92, 252, 0.10) 0%, transparent 50%);
  animation: meshFloat 20s ease-in-out infinite alternate;
}

.bg-mesh::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 100% 100% at 50% 0%, rgba(124, 92, 252, 0.05) 0%, transparent 70%);
}

@keyframes meshFloat {
  0%   { transform: translate(0, 0) rotate(0deg); }
  33%  { transform: translate(2%, 3%) rotate(1deg); }
  66%  { transform: translate(-2%, 1%) rotate(-1deg); }
  100% { transform: translate(1%, -2%) rotate(0.5deg); }
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) var(--space-4);
  padding-top: calc(64px + var(--space-6)); /* header height */
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  z-index: var(--z-above);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  background: rgba(10, 10, 15, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
}

.header-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 0 20px rgba(124, 92, 252, 0.4);
}

.header-logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.header-logo-text span {
  color: var(--color-primary-light);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.header-nav-link {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.header-nav-link:hover,
.header-nav-link.active {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ── Glass Card ───────────────────────────────────────────────────────────── */
.glass-card {
  background: var(--bg-surface);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.06);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.glass-card:hover {
  border-color: var(--border-strong);
}

/* ── Swap Card ────────────────────────────────────────────────────────────── */
.swap-container {
  width: 100%;
  max-width: 480px;
}

.swap-card {
  padding: var(--space-5);
  position: relative;
}

.swap-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.swap-card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.swap-card-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ── Token Input Block ────────────────────────────────────────────────────── */
.token-block {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: all var(--transition-fast);
  position: relative;
}

.token-block:focus-within {
  border-color: var(--border-primary);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.08);
}

.token-block-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: var(--space-3);
}

.token-block-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.token-amount-input {
  flex: 1;
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  background: transparent;
  border: none;
  outline: none;
  min-width: 0;
  letter-spacing: -0.5px;
}

.token-amount-input::placeholder {
  color: var(--text-disabled);
}

/* Remove number input arrows */
.token-amount-input::-webkit-outer-spin-button,
.token-amount-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.token-amount-input[type=number] { -moz-appearance: textfield; }

.token-amount-usd {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.token-balance {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.token-balance-max {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary-light);
  cursor: pointer;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(124, 92, 252, 0.15);
  transition: all var(--transition-fast);
}

.token-balance-max:hover {
  background: rgba(124, 92, 252, 0.25);
  color: var(--color-primary);
}

/* ── Token Selector Button ────────────────────────────────────────────────── */
.token-selector {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}

.token-selector:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.token-selector-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-surface);
  flex-shrink: 0;
}

.token-selector-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.token-selector-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.token-selector-symbol {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.token-selector-chain {
  font-size: 10px;
  color: var(--text-tertiary);
  line-height: 1;
}

.token-selector-chevron {
  color: var(--text-tertiary);
  transition: transform var(--transition-fast);
}

.token-selector:hover .token-selector-chevron {
  transform: translateY(1px);
}

/* ── Swap Direction Button ────────────────────────────────────────────────── */
.swap-direction-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -6px 0;
  position: relative;
  z-index: 1;
}

.swap-direction-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 2px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  color: var(--text-secondary);
}

.swap-direction-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-primary);
  color: var(--color-primary-light);
  transform: rotate(180deg) scale(1.05);
  box-shadow: var(--shadow-glow);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 4px 16px rgba(124, 92, 252, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
  box-shadow: 0 6px 24px rgba(124, 92, 252, 0.45);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(124, 92, 252, 0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-default);
}

.btn-ghost:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-icon:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: 16px;
  border-radius: var(--radius-lg);
  width: 100%;
}

/* ── Connect Wallet Button ────────────────────────────────────────────────── */
.btn-connect {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: #fff;
  font-weight: 600;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: 13px;
  box-shadow: 0 2px 12px rgba(124, 92, 252, 0.3);
  transition: all var(--transition-fast);
}

.btn-connect:hover {
  box-shadow: 0 4px 20px rgba(124, 92, 252, 0.5);
  transform: translateY(-1px);
}

.btn-wallet-connected {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-wallet-connected:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.wallet-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 6px var(--color-success);
  flex-shrink: 0;
}

/* ── Route Info Panel ─────────────────────────────────────────────────────── */
.route-info {
  margin-top: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  animation: slideDown 0.2s ease-out;
}

.route-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  padding: var(--space-1) 0;
}

.route-info-label {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.route-info-value {
  color: var(--text-primary);
  font-weight: 500;
}

.route-info-value.positive { color: var(--color-success); }
.route-info-value.negative { color: var(--color-error); }
.route-info-value.warning  { color: var(--color-warning); }

.route-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-2) 0;
}

/* ── Route Steps ──────────────────────────────────────────────────────────── */
.route-steps {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-2);
}

.route-step-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(124, 92, 252, 0.12);
  border: 1px solid rgba(124, 92, 252, 0.2);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-primary-light);
}

/* ── Loading States ───────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-surface) 25%,
    var(--bg-elevated) 50%,
    var(--bg-surface) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-default);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Animations ───────────────────────────────────────────────────────────── */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

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

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ── Utilities ────────────────────────────────────────────────────────────── */
.hidden   { display: none !important; }
.sr-only  { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex     { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2    { gap: var(--space-2); }
.gap-3    { gap: var(--space-3); }
.w-full   { width: 100%; }
.text-sm  { font-size: 13px; }
.text-xs  { font-size: 11px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.text-secondary { color: var(--text-secondary); }
.text-primary-color { color: var(--color-primary-light); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .header { padding: 0 var(--space-4); }
  .header-nav { display: none; }
  .main-content { padding: var(--space-4) var(--space-3); }
  .swap-card { padding: var(--space-4); }
  .token-amount-input { font-size: 22px; }
}
