/* ========================================
   ForexSpreadCompare.com — Bloomberg Terminal Aesthetic
   Dark theme, Electric Blue (#3b82f6), Data-first
   ======================================== */

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

:root {
  --bg-primary: #0a0f1a;
  --bg-secondary: #0d1321;
  --bg-card: #111827;
  --bg-table-row: #0f1729;
  --bg-table-alt: #131d33;
  --bg-table-header: #1a2744;
  --border: #1e293b;
  --border-accent: #3b82f620;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-light: #60a5fa;
  --accent-glow: #3b82f630;
  --green: #22c55e;
  --green-bg: #22c55e15;
  --red: #ef4444;
  --red-bg: #ef444415;
  --yellow: #eab308;
  --yellow-bg: #eab30815;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent-light); text-decoration: none; transition: color 0.2s; }
a:hover { color: #93bbfd; }

img { max-width: 100%; height: auto; }

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-primary);
}

h1 { font-size: 2.25rem; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; letter-spacing: -0.01em; }
h3 { font-size: 1.2rem; }

.mono, .data, td, .spread-value, .ticker {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
}

/* --- Layout --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.container-wide {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Top Bar (Bloomberg-style ticker) --- */
.top-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 6px 0;
  overflow: hidden;
}

.ticker-wrap {
  display: flex;
  gap: 32px;
  animation: ticker-scroll 30s linear infinite;
  white-space: nowrap;
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text-secondary);
}

.ticker-item .pair { color: var(--text-primary); font-weight: 500; }
.ticker-item .value { color: var(--accent-light); }
.ticker-item .change.up { color: var(--green); }
.ticker-item .change.down { color: var(--red); }

@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* --- Header --- */
.site-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(13, 19, 33, 0.95);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.logo {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.logo span { color: var(--accent); }
.logo .dot { color: var(--accent); font-size: 0.6em; vertical-align: super; }

/* --- Nav --- */
.main-nav { display: flex; align-items: center; gap: 4px; }

.main-nav a {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--accent-light);
  background: var(--accent-glow);
  border-color: var(--border-accent);
}

.mobile-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
}

.mobile-toggle svg { width: 20px; height: 20px; }

/* --- Hero --- */
.hero {
  padding: 60px 0 40px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid var(--border-accent);
  padding: 5px 14px;
  border-radius: 100px;
  margin-bottom: 20px;
}

.hero-badge .pulse {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

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

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 14px;
  letter-spacing: -0.03em;
}

.hero h1 .highlight { color: var(--accent-light); }

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 30px;
  line-height: 1.6;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 30px;
}

.hero-stat {
  text-align: center;
}

.hero-stat .num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent-light);
}

.hero-stat .label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

/* --- Section --- */
.section {
  padding: 50px 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.section-header h2 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-header h2 .icon {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.section-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* --- Data Table (main comparison) --- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table thead {
  background: var(--bg-table-header);
  position: sticky;
  top: 0;
}

.data-table th {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table th.text-right,
.data-table td.text-right { text-align: right; }

.data-table th.text-center,
.data-table td.text-center { text-align: center; }

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
}

.data-table tbody tr { background: var(--bg-table-row); }
.data-table tbody tr:nth-child(even) { background: var(--bg-table-alt); }

.data-table tbody tr:hover {
  background: var(--accent-glow);
}

.data-table .broker-name {
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.data-table .broker-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

/* Spread rating colors */
.spread-low { color: var(--green); }
.spread-med { color: var(--yellow); }
.spread-high { color: var(--red); }

.spread-cell {
  font-weight: 600;
  font-size: 14px;
}

/* Rank badge */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 700;
}

.rank-1 { background: #3b82f630; color: var(--accent-light); border: 1px solid var(--accent); }
.rank-2 { background: var(--green-bg); color: var(--green); border: 1px solid #22c55e40; }
.rank-3 { background: var(--yellow-bg); color: var(--yellow); border: 1px solid #eab30840; }
.rank-other { background: #1e293b; color: var(--text-muted); border: 1px solid var(--border); }

/* Visit Broker CTA */
.btn-broker {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 14px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-broker:hover {
  background: var(--accent-light);
  color: #fff;
  transform: translateY(-1px);
}

.btn-broker-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-broker-outline:hover {
  border-color: var(--accent);
  color: var(--accent-light);
  background: var(--accent-glow);
}

/* --- Pair Filter Tabs --- */
.pair-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.pair-tab {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.pair-tab:hover {
  border-color: var(--accent);
  color: var(--accent-light);
}

.pair-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* --- Stat Cards Grid --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.stat-card .label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.stat-card .value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-light);
}

.stat-card .sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- Article Cards --- */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.1);
}

.article-card .card-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 10px;
}

.article-card h3 {
  font-size: 1.05rem;
  margin-bottom: 10px;
  line-height: 1.35;
}

.article-card h3 a {
  color: var(--text-primary);
}

.article-card h3 a:hover {
  color: var(--accent-light);
}

.article-card .card-excerpt {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  flex: 1;
  margin-bottom: 14px;
}

.article-card .card-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 14px;
}

/* --- Methodology Box --- */
.methodology-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 30px;
  margin-top: 30px;
}

.methodology-box h3 {
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.methodology-box p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 10px;
}

.methodology-box ul {
  list-style: none;
  padding: 0;
}

.methodology-box ul li {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 6px 0;
  padding-left: 20px;
  position: relative;
}

.methodology-box ul li::before {
  content: '>';
  font-family: 'IBM Plex Mono', monospace;
  color: var(--accent);
  position: absolute;
  left: 0;
}

/* --- Risk Disclaimer --- */
.risk-disclaimer {
  background: var(--bg-secondary);
  border: 1px solid var(--red);
  border-left: 3px solid var(--red);
  border-radius: 6px;
  padding: 20px 24px;
  margin: 40px 0;
}

.risk-disclaimer h4 {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--red);
  margin-bottom: 8px;
}

.risk-disclaimer p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* --- Footer --- */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 40px 0 24px;
  margin-top: 60px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 30px;
}

.footer-brand .logo {
  font-size: 1.1rem;
  margin-bottom: 10px;
}

.footer-brand p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 300px;
}

.footer-col h4 {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a {
  font-size: 13px;
  color: var(--text-secondary);
}
.footer-col ul li a:hover { color: var(--accent-light); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-bottom p {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}

/* --- Utility --- */
.text-accent { color: var(--accent-light); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--text-muted); }
.font-mono { font-family: 'IBM Plex Mono', monospace; }
.mt-2 { margin-top: 20px; }
.mb-2 { margin-bottom: 20px; }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .articles-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 30px; }
}

@media (max-width: 768px) {
  .hero h1 { font-size: 1.7rem; }
  .hero-stats { gap: 24px; }
  .hero-stat .num { font-size: 1.4rem; }

  .header-inner { padding: 12px 16px; }

  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 12px;
    gap: 4px;
  }

  .main-nav.open { display: flex; }
  .main-nav a { width: 100%; text-align: center; padding: 10px; }

  .mobile-toggle { display: block; }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .articles-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }

  .data-table th, .data-table td { padding: 10px 12px; }

  .container, .container-wide { padding: 0 16px; }
  .section { padding: 35px 0; }

  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }

  .pair-tabs { gap: 4px; }
  .pair-tab { padding: 6px 10px; font-size: 11px; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.4rem; }
  .hero-stats { flex-wrap: wrap; gap: 16px; }
  .stats-grid { grid-template-columns: 1fr; }
}
