/* ── Swap Page — Specific Styles ──────────────────────────────────── */
/* Base styles (reset, tokens, bg, layout, header, footer) are in /base.css */

/* ── Swap Header ─────────────────────────────────────────────────── */

.swap-header {
  text-align: center;
  padding: 8px 0 32px;
}
.swap-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.swap-header p {
  font-size: 0.95rem;
  color: var(--text-dim);
}

/* ── Balance Bar ─────────────────────────────────────────────────── */

.balance-bar {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 28px;
  animation: fadeIn 0.3s ease;
}
.balance-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.balance-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.balance-value {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.balance-unit {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ── Swap Card ───────────────────────────────────────────────────── */

.swap-card {
  max-width: 480px;
  margin: 0 auto 48px;
  padding: 32px 28px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
}

/* ── Swap Input Group ────────────────────────────────────────────── */

.swap-input-group {
  margin-bottom: 4px;
}

.swap-field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.swap-field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: border-color 0.2s;
}
.swap-field:focus-within {
  border-color: var(--accent-dim);
}

.swap-field-output {
  background: var(--bg);
}

.swap-amount-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  min-width: 0;
}
.swap-amount-input::placeholder {
  color: var(--text-muted);
}
/* Hide number input spinners */
.swap-amount-input::-webkit-outer-spin-button,
.swap-amount-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.swap-amount-input[type=number] {
  -moz-appearance: textfield;
}

.swap-amount-output {
  flex: 1;
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  min-width: 0;
}

.swap-token {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.swap-token-icon {
  font-size: 1.1rem;
  color: var(--accent);
}
.swap-token-icp {
  flex-shrink: 0;
}
.swap-token-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.swap-field-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
  min-height: 1.2em;
}

/* ── Swap Arrow ──────────────────────────────────────────────────── */

.swap-arrow {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}
.swap-arrow svg {
  color: var(--text-muted);
}

/* ── Swap Details ────────────────────────────────────────────────── */

.swap-details {
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.swap-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-dim);
  padding: 5px 0;
}
.swap-detail-row span:last-child {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
}

.swap-detail-total {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 10px;
  font-weight: 600;
}
.swap-detail-total span:last-child {
  color: var(--accent);
}

/* ── Swap Button ─────────────────────────────────────────────────── */

.swap-btn {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--accent);
  background: linear-gradient(135deg, var(--accent-dim), transparent);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}
.swap-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent), #e67e00);
  opacity: 0;
  transition: opacity 0.3s;
}
.swap-btn:not(:disabled):hover::before {
  opacity: 1;
}
.swap-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px var(--accent-glow);
  color: #fff;
}
.swap-btn span {
  position: relative;
  z-index: 1;
}
.swap-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: var(--border);
  background: var(--surface);
}

.swap-status {
  font-size: 0.85rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 12px;
  min-height: 1.2em;
}

/* ── Info Section (reuse game pattern) ───────────────────────────── */

.info-section {
  padding: 0 0 48px;
}
.info-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--text-dim);
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.info-card {
  padding: 28px 20px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
}
.info-step {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.info-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.info-card p {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ── Loading spinner ─────────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

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

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 9999;
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
  max-width: 90vw;
  text-align: center;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast.success {
  background: #14532d;
  border: 1px solid var(--green);
  color: var(--green);
}
.toast.error {
  background: #450a0a;
  border: 1px solid var(--red);
  color: var(--red);
}

/* Wallet modal styles are in /base.css */

/* ── Responsive ──────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .swap-header h2 {
    font-size: 1.3rem;
  }
  .balance-bar {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  .swap-card {
    padding: 24px 18px;
  }
  .swap-amount-input,
  .swap-amount-output {
    font-size: 1.2rem;
  }
  .info-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}
