/* ==================== OFFICIAL PHERA DESIGN SYSTEM ==================== */
:root {
  --bg-dark: #07080A;
  --bg-surface: #0C0D11;
  --bg-card: #12141C;
  --bg-card-hover: #181B26;
  
  --phera-lime: #D4FF00;
  --phera-lime-glow: rgba(212, 255, 0, 0.45);
  --phera-lime-bg: rgba(212, 255, 0, 0.12);
  
  --gold: #FFC700;
  --gold-bg: rgba(255, 199, 0, 0.12);
  --cyan: #00E5FF;
  
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(212, 255, 0, 0.4);
  
  --font-main: 'Inter', -apple-system, sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 12% 12%, rgba(212, 255, 0, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 88% 88%, rgba(0, 229, 255, 0.03) 0%, transparent 40%);
  min-height: 100vh;
}

a { color: var(--phera-lime); text-decoration: none; }
button { font-family: var(--font-main); cursor: pointer; border: none; outline: none; }

.lime-text { color: var(--phera-lime) !important; }
.gold-text { color: var(--gold) !important; }
.orange-text { color: #FF7A00 !important; }
.blue-text { color: #3B82F6 !important; }
.font-display { font-family: var(--font-display); }

.glow-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.glow-card:hover {
  border-color: var(--border-glow);
  box-shadow: 0 10px 32px rgba(212, 255, 0, 0.12);
}

.glow-border {
  border: 1px solid var(--border-glow);
  box-shadow: 0 0 24px rgba(212, 255, 0, 0.12);
}

.badge-pill {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.lime-pill {
  background: var(--phera-lime-bg);
  color: var(--phera-lime);
  border: 1px solid rgba(212, 255, 0, 0.3);
}

/* ==================== TOP TICKER ==================== */
.phera-top-ticker {
  background: #060709;
  border-bottom: 1px solid rgba(212, 255, 0, 0.2);
  padding: 6px 20px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

.ticker-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.t-badge {
  background: rgba(212, 255, 0, 0.2);
  color: var(--phera-lime);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 800;
}

.divider { color: var(--text-muted); }

/* ==================== NAV HEADER ==================== */
.phera-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(12, 13, 17, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-badge {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--phera-lime);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px var(--phera-lime-glow);
}

.brand-logo-badge img { width: 100%; height: 100%; object-fit: cover; }

.brand-title-wrap { display: flex; flex-direction: column; }

.brand-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
}

.brand-tagline {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 1.8px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Tabs */
.phera-main-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.tab-link {
  background: transparent;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-link:hover { color: var(--text-primary); }

.tab-link.active {
  background: var(--bg-card);
  color: var(--phera-lime);
  border: 1px solid var(--border-glow);
  box-shadow: 0 0 14px var(--phera-lime-glow);
}

.nav-badge {
  font-size: 0.65rem;
  background: var(--phera-lime);
  color: #000;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
}

.nav-badge.live-badge { background: #FF5252; color: #fff; }

.nav-actions { display: flex; align-items: center; gap: 12px; }

.x-social-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
}

.connect-wallet-btn {
  background: linear-gradient(135deg, var(--phera-lime) 0%, #A6FF00 100%);
  color: #000;
  font-weight: 800;
  font-size: 0.88rem;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px var(--phera-lime-glow);
}

.connect-wallet-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }

/* ==================== MAIN APP CONTAINER ==================== */
.phera-app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px;
}

.app-view { display: none; animation: fadeIn 0.3s ease forwards; }
.app-view.active { display: block; }

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

/* ==================== VIEW 1: SWAP ROUTER ==================== */
.swap-router-grid {
  display: grid;
  grid-template-columns: 440px 1fr;
  gap: 24px;
}

.swap-card-box { padding: 24px; }

.sc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.sc-header h3 { font-family: var(--font-display); font-size: 1.2rem; }

.sc-controls { display: flex; align-items: center; gap: 10px; }

.gas-tag {
  font-size: 0.75rem;
  color: var(--phera-lime);
  background: var(--phera-lime-bg);
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.settings-btn {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
}

.swap-form-body { display: flex; flex-direction: column; gap: 14px; }

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

.tf-header { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--text-secondary); }

.tf-input-row {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tf-input-row.readonly-field { background: rgba(0, 0, 0, 0.3); }

.tf-input-row input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  width: 100%;
}

.token-select-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-weight: 800;
  font-size: 0.88rem;
  padding: 6px 12px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.token-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.75rem;
}

.phera-icon { background: var(--phera-lime); color: #000; }
.usdt-icon { background: #26A17B; color: #fff; }
.hood-icon { background: #3B82F6; color: #fff; }
.eth-icon { background: #627EEA; color: #fff; }
.usdc-icon { background: #2775CA; color: #fff; }

.preset-chips-row { display: flex; gap: 6px; }

.pchip {
  flex: 1;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 5px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
}

.pchip:hover { background: var(--phera-lime-bg); color: var(--phera-lime); border-color: var(--phera-lime); }

.swap-flip-divider { display: flex; justify-content: center; margin: -4px 0; }

.flip-route-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.flip-route-btn:hover { color: var(--phera-lime); border-color: var(--phera-lime); }

/* Smart CLMM Visualizer */
.clmm-route-visualizer {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 14px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.8rem;
}

.crv-header { display: flex; justify-content: space-between; font-weight: 700; }

.route-hops-flow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  margin: 4px 0;
}

.hop-node { font-weight: 800; font-size: 0.82rem; }
.hop-line { font-size: 0.72rem; color: var(--phera-lime); font-family: var(--font-mono); }

.crv-info { display: flex; justify-content: space-between; color: var(--text-secondary); }

.primary-phera-btn {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.glow-btn {
  background: linear-gradient(135deg, var(--phera-lime) 0%, #A6FF00 100%);
  color: #000;
  box-shadow: 0 6px 20px var(--phera-lime-glow);
}

.glow-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }

.fit-btn { width: auto; padding: 10px 20px; font-size: 0.88rem; }

/* Market Chart Box */
.market-chart-box { padding: 24px; display: flex; flex-direction: column; gap: 16px; }

.mc-header { display: flex; justify-content: space-between; align-items: center; }

.pair-meta { display: flex; align-items: center; gap: 12px; }
.avatar-pair { display: flex; align-items: center; }

.pair-price-tag { font-family: var(--font-mono); font-weight: 800; font-size: 1.2rem; }

.timeframe-buttons {
  display: flex;
  gap: 4px;
  background: var(--bg-surface);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.tf-btn {
  background: transparent;
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
}

.tf-btn.active { background: var(--phera-lime-bg); color: var(--phera-lime); }

.chart-canvas-container { height: 320px; position: relative; }

.market-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.ms-card {
  background: var(--bg-surface);
  padding: 10px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.ms-card strong { font-size: 1rem; font-family: var(--font-mono); color: var(--text-primary); }

/* ==================== VIEW 2: CLMM LIQUIDITY ==================== */
.view-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.view-title-bar h2 { font-family: var(--font-display); font-size: 1.8rem; font-weight: 800; }

.user-active-positions-box { padding: 20px; margin-bottom: 24px; }
.uap-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }

.secondary-phera-btn {
  background: var(--bg-surface);
  color: var(--phera-lime);
  border: 1px solid var(--phera-lime);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.clmm-position-card {
  background: var(--bg-surface);
  padding: 16px;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cpos-pair { display: flex; align-items: center; gap: 12px; }
.cpos-stat { display: flex; flex-direction: column; font-size: 0.78rem; color: var(--text-secondary); }
.cpos-stat strong { font-size: 1rem; color: var(--text-primary); }

/* Table */
.table-wrapper { overflow: hidden; }

.phera-table { width: 100%; border-collapse: collapse; text-align: left; }
.phera-table th { background: var(--bg-surface); padding: 14px 20px; font-size: 0.78rem; color: var(--text-secondary); text-transform: uppercase; }
.phera-table td { padding: 16px 20px; font-size: 0.9rem; border-bottom: 1px solid var(--border-color); }

.pair-cell { display: flex; align-items: center; gap: 10px; }

.deposit-sm-btn {
  background: var(--phera-lime-bg);
  color: var(--phera-lime);
  border: 1px solid var(--phera-lime);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

/* ==================== VIEW 3: LAUNCHPAD ==================== */
.presale-portal-card {
  background: linear-gradient(135deg, #0A0D02 0%, #121A04 100%);
  border: 1px solid var(--border-glow);
  padding: 32px;
  border-radius: var(--radius-xl);
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 28px;
  margin-bottom: 32px;
}

.live-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #FF5252;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 12px;
  margin-bottom: 10px;
}

.ppc-left h2 { font-family: var(--font-display); font-size: 2rem; font-weight: 800; }
.ppc-left p { color: var(--text-secondary); margin: 8px 0 20px 0; }

.presale-metrics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }

.pm-card {
  background: var(--bg-card);
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.pm-card strong { font-size: 1rem; }

.presale-progress-bar { display: flex; flex-direction: column; gap: 6px; }

.bar-bg { width: 100%; height: 8px; background: var(--bg-surface); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--phera-lime) 0%, #A6FF00 100%); }

.bar-labels { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--text-secondary); }

.ppc-right {
  background: var(--bg-card);
  padding: 22px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ppc-right h3 { font-family: var(--font-display); }

.token-label-static { font-weight: 800; font-size: 0.9rem; padding-right: 12px; }

.margin-v { margin: 6px 0; }

/* Tiers */
.tiers-section h3 { font-family: var(--font-display); font-size: 1.3rem; margin-bottom: 16px; }

.tiers-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.tier-card {
  background: var(--bg-card);
  padding: 18px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.active-tier { border-color: var(--phera-lime); box-shadow: 0 0 16px var(--phera-lime-glow); }

.tier-icon { font-size: 1.6rem; }
.tier-card h4 { font-family: var(--font-display); font-size: 1rem; }
.tier-req { font-size: 0.8rem; font-weight: 700; }
.tier-card p { font-size: 0.75rem; color: var(--text-secondary); }

/* ==================== VIEW 4: STAKING ==================== */
.vaults-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.vault-card { padding: 22px; display: flex; flex-direction: column; gap: 16px; }

.vc-top { display: flex; align-items: center; gap: 12px; }
.vc-top h3 { font-family: var(--font-display); font-size: 1.1rem; }
.vc-top span { font-size: 0.78rem; color: var(--text-secondary); }

.vc-body {
  background: var(--bg-surface);
  padding: 14px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.vc-row { display: flex; justify-content: space-between; }
.vc-actions { display: flex; gap: 10px; }

/* ==================== VIEW 5: TELEMETRY ==================== */
.telemetry-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }

.t-chart-card { padding: 20px; }
.tc-title { display: flex; justify-content: space-between; align-items: center; font-family: var(--font-display); font-weight: 700; margin-bottom: 16px; }
.chart-box { height: 280px; position: relative; }

/* ==================== MODALS & TOASTS ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-backdrop.active { display: flex; }

.modal-card {
  background: var(--bg-card);
  width: 100%;
  max-width: 420px;
  border-radius: var(--radius-xl);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mc-header { display: flex; justify-content: space-between; align-items: center; }
.mc-header h3 { font-family: var(--font-display); }

.close-btn { background: transparent; color: var(--text-secondary); font-size: 1.2rem; }

.wallet-options, .token-list-container { display: flex; flex-direction: column; gap: 8px; }

.w-opt-btn, .token-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-primary);
  font-weight: 700;
}

.w-opt-btn:hover, .token-item:hover { border-color: var(--phera-lime); }
.w-left { display: flex; align-items: center; gap: 10px; }

.search-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.search-box input { background: transparent; border: none; outline: none; color: var(--text-primary); width: 100%; }

.range-box { display: flex; flex-direction: column; gap: 8px; font-size: 0.85rem; color: var(--text-secondary); }

.range-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.r-field {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 10px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
}

.r-field input { background: transparent; border: none; outline: none; color: var(--text-primary); font-family: var(--font-mono); font-weight: 700; }

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 300;
}

.toast-message {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.3s ease forwards;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 1024px) {
  .swap-router-grid { grid-template-columns: 1fr; }
  .presale-portal-card { grid-template-columns: 1fr; }
  .tiers-grid { grid-template-columns: 1fr 1fr; }
  .vaults-grid { grid-template-columns: 1fr; }
  .telemetry-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .phera-nav-header { padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
  .phera-main-tabs { overflow-x: auto; width: 100%; }
  .tiers-grid { grid-template-columns: 1fr; }
}
