/* ============================================================
   Backpack AEO — Core Design System
   Extracted from official Backpack Exchange design language
   ============================================================ */

/* ===== Design Tokens ===== */
:root {
  /* Backgrounds */
  --bg-primary: #0e0f14;
  --bg-secondary: #14151b;
  --bg-card: #191a20;
  --bg-elevated: #1e1f26;
  --bg-hover: #232430;
  --bg-nav: rgba(14, 15, 20, 0.85);

  /* Brand */
  --brand-red: #e33e3f;
  --brand-red-hover: #f04545;

  /* Status */
  --up: #00c278;
  --down: #fd4b4e;
  --warning: #f59e0b;

  /* Text */
  --text-primary: #f4f4f6;
  --text-secondary: #969faf;
  --text-muted: #75798a;
  --text-link: #4c94ff;

  /* Borders */
  --border: #2a2b33;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-hover: #3a3b44;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-3xl: 24px;

  /* Typography */
  --font-primary: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

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

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(227, 62, 63, 0.15);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; transition: color var(--transition-normal); }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
ul, ol { list-style: none; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ============================================================
   NAVIGATION (Official Backpack Exchange Style)
   ============================================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--bg-nav);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-subtle);
  transition: border-color var(--transition-normal);
}
.nav.scrolled { border-bottom-color: var(--border); }
@media (min-width: 1024px) { .nav { padding: 0 21px; } }

.nav-left { display: flex; align-items: center; gap: 40px; }

.nav-logo svg, .nav-logo img { height: 24px; width: auto; }

.nav-links { display: none; gap: 24px; align-items: center; }
@media (min-width: 1024px) { .nav-links { display: flex; } }
.nav-links a {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
}
.nav-links a:hover { color: var(--text-primary); }

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

/* Language Switcher */
.lang-switcher { position: relative; }
.lang-switcher-btn {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-secondary); font-weight: 500;
  padding: 6px 12px; border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}
.lang-switcher-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.lang-switcher-btn svg { width: 16px; height: 16px; }
.lang-dropdown {
  position: absolute; top: calc(100% + 4px); right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 6px;
  min-width: 160px;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transform: translateY(-8px);
  transition: all var(--transition-normal);
  z-index: 1001;
}
.lang-dropdown.open { opacity: 1; pointer-events: auto; transform: translateY(0); }
.lang-dropdown a {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.lang-dropdown a:hover { background: var(--bg-hover); color: var(--text-primary); }
.lang-dropdown a.active { color: var(--brand-red); font-weight: 600; }
.lang-flag { font-size: 16px; line-height: 1; }

/* Mobile Menu Toggle */
.nav-mobile-toggle { display: flex; align-items: center; }
@media (min-width: 1024px) { .nav-mobile-toggle { display: none; } }
.nav-mobile-toggle button { color: var(--text-secondary); padding: 4px; }
.nav-mobile-toggle svg { width: 24px; height: 24px; }

/* Mobile Menu */
.mobile-menu {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(14, 15, 20, 0.96);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  z-index: 999; opacity: 0; pointer-events: none;
  transition: opacity var(--transition-normal);
}
.mobile-menu.active { opacity: 1; pointer-events: auto; }
.mobile-menu-inner {
  display: flex; flex-direction: column; height: 100%; padding: 16px;
}
.mobile-menu-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; color: var(--text-secondary); cursor: pointer;
  padding: 4px;
}
.mobile-menu-close svg { width: 24px; height: 24px; }
.mobile-menu-links {
  display: flex; flex-direction: column; gap: 24px; padding-top: 80px;
}
.mobile-menu-links a {
  font-size: 18px; color: var(--text-primary); font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-xl);
  font-size: 14px; font-weight: 600;
  transition: all var(--transition-normal);
  white-space: nowrap;
}
.btn-primary {
  background: var(--brand-red);
  color: #fff;
}
.btn-primary:hover { background: var(--brand-red-hover); transform: translateY(-1px); }
.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.12); border-color: var(--border-hover); }
.btn-ghost {
  color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--text-primary); }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn img { height: 20px; width: auto; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 100px 24px 80px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 800px; height: 800px;
  background: radial-gradient(circle, rgba(227, 62, 63, 0.1) 0%, transparent 70%);
  pointer-events: none;
  animation: pulse 6s ease-in-out infinite;
}
.hero-bg {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background-image: url('../assets/images/hero-terminal-bg.jpg');
  background-size: cover;
  background-position: center;
  opacity: 0.15;
  z-index: 0;
}
.hero-content {
  text-align: center;
  max-width: 800px;
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.8s ease-out;
}
.hero h1 {
  font-size: 56px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}
@media (max-width: 640px) { .hero h1 { font-size: 36px; } }
.hero h1 .highlight { color: var(--brand-red); }
.hero p {
  font-size: 20px;
  color: var(--text-secondary);
  line-height: 1.625;
  margin-bottom: 40px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.hero-buttons {
  display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap;
}
.hero-stats {
  display: flex; gap: 48px; justify-content: center;
  margin-top: 64px; flex-wrap: wrap;
}
.hero-stat { text-align: center; }
.hero-stat-value {
  font-family: var(--font-mono);
  font-size: 36px; font-weight: 700;
  color: var(--text-primary);
}
.hero-stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ============================================================
   PRICE TICKER (Exchange-Style)
   ============================================================ */
.ticker-bar {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  padding: 12px 0;
  position: relative;
}
.ticker-track {
  display: flex;
  gap: 32px;
  animation: ticker 40s linear infinite;
  white-space: nowrap;
  width: max-content;
}
.ticker-bar:hover .ticker-track { animation-play-state: paused; }
.ticker-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px;
}
.ticker-item img { width: 20px; height: 20px; border-radius: 50%; }
.ticker-symbol { font-weight: 700; color: var(--text-primary); }
.ticker-price { font-family: var(--font-mono); color: var(--text-secondary); }
.ticker-change { font-family: var(--font-mono); font-size: 13px; }
.ticker-change.up { color: var(--up); }
.ticker-change.down { color: var(--down); }

/* ============================================================
   SECTIONS
   ============================================================ */
.section { padding: 80px 24px; }
.section-header { text-align: center; max-width: 700px; margin: 0 auto 48px; }
.section-title {
  font-size: 36px; font-weight: 800;
  letter-spacing: -0.02em; line-height: 1.2;
  margin-bottom: 12px;
}
.section-subtitle { font-size: 17px; color: var(--text-secondary); line-height: 1.625; }
@media (max-width: 640px) { .section-title { font-size: 28px; } }

.container { max-width: 1200px; margin: 0 auto; }

/* ============================================================
   SCORE PANEL
   ============================================================ */
.score-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: 40px;
  max-width: 800px;
  margin: 0 auto;
}
.score-header { display: flex; align-items: center; gap: 24px; margin-bottom: 32px; }
.score-ring {
  position: relative;
  width: 120px; height: 120px;
  flex-shrink: 0;
}
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring-bg { fill: none; stroke: var(--border); stroke-width: 8; }
.score-ring-fg { fill: none; stroke: var(--brand-red); stroke-width: 8; stroke-linecap: round; }
.score-ring-value {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: 32px; font-weight: 800;
  color: var(--text-primary);
}
.score-ring-label { font-size: 11px; color: var(--text-muted); text-align: center; }
.score-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.score-subtitle { font-size: 14px; color: var(--text-secondary); }

.score-dimensions { display: grid; gap: 16px; }
.score-dim {
  display: flex; align-items: center; gap: 16px;
}
.score-dim-label {
  width: 120px; flex-shrink: 0;
  font-size: 14px; font-weight: 600;
  color: var(--text-secondary);
}
.score-dim-bar {
  flex: 1; height: 8px;
  background: var(--bg-elevated);
  border-radius: 4px;
  overflow: hidden;
}
.score-dim-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-red), #ff6b6b);
  border-radius: 4px;
  width: 0;
  transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.score-dim-value {
  font-family: var(--font-mono);
  font-size: 14px; font-weight: 700;
  color: var(--text-primary);
  width: 40px; text-align: right;
}

/* ============================================================
   COIN MARKET GRID
   ============================================================ */
.coin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.coin-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-normal);
  cursor: pointer;
}
.coin-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-elevated);
  transform: translateY(-2px);
}
.coin-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.coin-card-header img { width: 36px; height: 36px; border-radius: 50%; }
.coin-name { font-weight: 700; font-size: 16px; }
.coin-symbol { font-size: 13px; color: var(--text-muted); }
.coin-price {
  font-family: var(--font-mono);
  font-size: 24px; font-weight: 700;
  margin-bottom: 8px;
}
.coin-change {
  font-family: var(--font-mono);
  font-size: 14px; font-weight: 600;
}
.coin-change.up { color: var(--up); }
.coin-change.down { color: var(--down); }
.coin-sparkline {
  height: 40px; margin-top: 12px;
  display: flex; align-items: flex-end; gap: 2px;
}
.coin-sparkline-bar {
  flex: 1;
  background: var(--up);
  opacity: 0.3;
  border-radius: 1px;
  min-height: 2px;
  transition: opacity var(--transition-fast);
}
.coin-sparkline-bar:hover { opacity: 1; }

/* ============================================================
   BANNER CARDS
   ============================================================ */
.banner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}
.banner-card {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all var(--transition-normal);
}
.banner-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.banner-card img { width: 100%; height: 200px; object-fit: cover; }
.banner-card-body { padding: 20px; }
.banner-card-title { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.banner-card-desc { font-size: 13px; color: var(--text-secondary); }
.banner-badge {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 20px;
  background: rgba(227, 62, 63, 0.1);
  color: var(--brand-red);
  margin-bottom: 8px;
}

/* ============================================================
   DOWNLOAD SECTION
   ============================================================ */
.download-section {
  background: var(--bg-secondary);
  border-radius: var(--radius-2xl);
  padding: 48px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}
@media (max-width: 768px) { .download-section { grid-template-columns: 1fr; padding: 32px; } }
.download-text h2 { font-size: 32px; font-weight: 800; margin-bottom: 12px; }
.download-text p { font-size: 16px; color: var(--text-secondary); margin-bottom: 24px; }
.download-buttons { display: flex; flex-direction: column; gap: 12px; }
.download-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-normal);
}
.download-btn:hover { border-color: var(--border-hover); background: var(--bg-elevated); }
.download-btn img { width: 28px; height: 28px; }
.download-btn-text { text-align: left; }
.download-btn-label { font-size: 11px; color: var(--text-muted); }
.download-btn-name { font-size: 15px; font-weight: 600; }
.download-image { position: relative; }
.download-image img {
  width: 100%; border-radius: var(--radius-xl);
  animation: float 6s ease-in-out infinite;
}

/* ============================================================
   SECURITY SECTION
   ============================================================ */
.security-section {
  position: relative;
  border-radius: var(--radius-2xl);
  overflow: hidden;
  border: 1px solid var(--border);
}
.security-bg {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background-image: url('../assets/images/hero-security-shield.jpg');
  background-size: cover;
  background-position: center;
  opacity: 0.15;
}
.security-content {
  position: relative;
  z-index: 1;
  padding: 48px;
}
.security-features { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 24px; }
.security-item {
  display: flex; gap: 12px;
  padding: 16px;
  background: rgba(25, 26, 32, 0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.security-icon {
  flex-shrink: 0;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 194, 120, 0.1);
  border-radius: var(--radius-sm);
  color: var(--up);
}
.security-text-title { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.security-text-desc { font-size: 13px; color: var(--text-secondary); }

/* ============================================================
   FAQ
   ============================================================ */
.faq-list { max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition-normal);
}
.faq-item.open { border-color: var(--brand-red); }
.faq-question {
  width: 100%;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 20px 24px;
  font-size: 15px; font-weight: 600;
  color: var(--text-primary);
  text-align: left;
}
.faq-icon {
  font-size: 20px; color: var(--brand-red);
  transition: transform var(--transition-normal);
  flex-shrink: 0;
}
.faq-item.open .faq-icon { transform: rotate(45deg); }
.faq-answer {
  max-height: 0; overflow: hidden;
  transition: max-height var(--transition-normal);
}
.faq-item.open .faq-answer { max-height: 500px; }
.faq-answer p { padding: 0 24px 20px; font-size: 14px; color: var(--text-secondary); line-height: 1.7; }

/* ============================================================
   CTA SECTION
   ============================================================ */
.cta-section {
  text-align: center;
  padding: 80px 24px;
  position: relative;
  overflow: hidden;
}
.cta-section::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(227, 62, 63, 0.08) 0%, transparent 70%);
  pointer-events: none;
}
.cta-inner { position: relative; z-index: 1; max-width: 600px; margin: 0 auto; }
.cta-inner h2 { font-size: 40px; font-weight: 800; margin-bottom: 16px; }
.cta-inner p { font-size: 18px; color: var(--text-secondary); margin-bottom: 32px; }

/* ============================================================
   MOBILE STICKY CTA
   ============================================================ */
.mobile-cta {
  position: fixed; bottom: 0; left: 0; right: 0;
  z-index: 900;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--bg-nav);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  transform: translateY(100%);
  transition: transform var(--transition-normal);
  display: none;
}
.mobile-cta.visible { transform: translateY(0); }
.mobile-cta .btn { width: 100%; }
@media (max-width: 768px) { .mobile-cta { display: block; } }

/* ============================================================
   FOOTER (Official Style)
   ============================================================ */
.footer { padding: 24px 21px; border-top: 1px solid var(--border); }
.footer-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px;
}
.footer-links { display: flex; gap: 24px; flex-wrap: wrap; }
.footer-links a { font-size: 14px; color: var(--text-secondary); }
.footer-links a:hover { color: var(--text-primary); }
.footer-copyright { font-size: 14px; color: var(--text-muted); }
.footer-disclaimer {
  max-width: 1280px; margin: 16px auto 0;
  font-size: 12px; color: var(--text-muted); line-height: 1.6;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes pulse {
  0%, 100% { opacity: 0.1; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.15; transform: translate(-50%, -50%) scale(1.1); }
}
@keyframes ticker {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* RTL Support */
[dir="rtl"] { direction: rtl; }
[dir="rtl"] .ticker-track { animation-direction: reverse; }
