/* ─── SHARED PAGE LAYOUT ────────────────────────────── */

/* Override style.css overflow:hidden so pages scroll */
html, body {
  height: auto !important;
  overflow: auto !important;
  overflow-x: hidden;
}

/* Clear space for the fixed nav bar */
.page-body {
  padding-top: 72px;
  min-height: 100vh;
  background: var(--bg);
}

/* ─── TOP NAV BAR ────────────────────────────────────── */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 72px;
  background: rgba(7,8,15,0.90);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  padding: 0 40px;
  gap: 40px;
  z-index: 1000;
}

.top-nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}

.top-nav-brand-name {
  font-family: 'Space Grotesk', var(--sans);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}

.top-nav-brand-name .dot { color: var(--cyan); }

.brand-live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2563eb;
  box-shadow: 0 0 8px rgba(37,99,235,0.75);
  animation: brand-dot-pulse 2s ease-out infinite;
  margin-right: 5px;
  vertical-align: middle;
  flex-shrink: 0;
  position: relative;
  top: -1px;
}
@keyframes brand-dot-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(37,99,235,0.55); }
  50%      { box-shadow: 0 0 0 5px rgba(37,99,235,0); }
}

.top-nav-links {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  font-family: 'Space Grotesk', var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  padding: 5px 11px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s, opacity 0.15s;
  position: relative;
  opacity: 0.5;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.nav-icon {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.nav-link:hover {
  opacity: 1;
  background: rgba(255,255,255,0.05);
}

.nav-link.active {
  opacity: 1;
  color: #93b4ff;
  background: rgba(37,99,235,0.14);
}

.nav-link.active .nav-icon {
  color: #93b4ff;
}

/* Icon button in nav right */
.nav-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--t2);
  transition: background 0.15s, color 0.15s;
}
.nav-icon-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}
.nav-icon-btn .material-symbols-outlined {
  font-size: 20px;
}

.top-nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

/* ─── PAGE SIDEBAR (news page) ───────────────────────── */
.page-with-sidebar {
  display: flex;
  height: calc(100vh - 72px);
  margin-top: 72px;
  overflow: hidden;
}

.page-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--s1);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--s3) transparent;
}

.page-sidebar::-webkit-scrollbar { width: 3px; }
.page-sidebar::-webkit-scrollbar-thumb { background: var(--s3); border-radius: 2px; }

.sidebar-section-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--t3);
  padding: 16px 16px 6px;
  display: block;
}

.page-main {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--s3) transparent;
}

.page-main::-webkit-scrollbar { width: 4px; }
.page-main::-webkit-scrollbar-thumb { background: var(--s3); border-radius: 2px; }

/* ─── PAGE SUB-HEADER (news page) ────────────────────── */
.page-subheader {
  height: 48px;
  padding: 0 32px;
  background: var(--s1);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

/* ─── SPLIT PAGE LAYOUT (portfolio) ─────────────────── */
.page-split {
  display: flex;
  height: calc(100vh - 72px);
  margin-top: 72px;
  overflow: hidden;
}

.page-split-left {
  flex: 55;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--s3) transparent;
}

.page-split-right {
  flex: 45;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--s3) transparent;
}

.page-split-left::-webkit-scrollbar,
.page-split-right::-webkit-scrollbar { width: 4px; }
.page-split-left::-webkit-scrollbar-thumb,
.page-split-right::-webkit-scrollbar-thumb { background: var(--s3); border-radius: 2px; }

/* ─── MARKETS PAGE ───────────────────────────────────── */
.markets-body {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 48px;
}

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

.markets-section-title {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--t3);
}

.markets-live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Space Grotesk', var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--t2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.markets-prices-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}

.price-card {
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  transition: border-color 0.2s;
}

.price-card:hover { border-color: var(--border2); }

.price-card-sym {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--t2);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.price-card-name {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--t3);
  margin-bottom: 10px;
}

.price-card-price {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
}

.price-card-chg {
  font-family: var(--mono);
  font-size: 13px;
}

.price-card-chg.up { color: var(--green); }
.price-card-chg.dn { color: var(--red); }

.markets-sources-note {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t3);
  text-align: right;
  margin-bottom: 40px;
  letter-spacing: 0.5px;
}

/* ─── COMMUNITY WIP ──────────────────────────────────── */
.wip-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 52px);
  text-align: center;
  padding: 40px 24px;
}

.wip-icon {
  font-size: 48px;
  margin-bottom: 24px;
  opacity: 0.5;
}

.wip-title {
  font-family: var(--sans);
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.wip-subtitle {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 300;
  color: var(--t2);
  margin-bottom: 16px;
}

.wip-desc {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--t3);
  line-height: 1.7;
  max-width: 380px;
}

/* ─── FREE DELAY BANNER (news page) ─────────────────── */
.free-banner-page {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 32px;
  background: rgba(255,181,71,0.06);
  border-bottom: 1px solid rgba(255,181,71,0.15);
  font-size: 11px;
  color: var(--amber);
  flex-shrink: 0;
}

.free-banner-page svg { flex-shrink: 0; opacity: 0.8; }
.free-banner-page span { flex: 1; }
.free-banner-page button {
  background: none;
  border: 1px solid rgba(255,181,71,0.3);
  color: var(--amber);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.free-banner-page button:hover { background: rgba(255,181,71,0.1); }

/* ─── GLOBAL PAGE ANIMATIONS ─────────────────────────
   Applied on all shared-layout pages except news.html
   (news.html uses .page-with-sidebar, not .page-body)
─────────────────────────────────────────────────────── */
@keyframes page-fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Fade-in for generic content blocks */
.animate-in {
  animation: page-fade-up 0.5s cubic-bezier(0.16,1,0.3,1) both;
}

/* Stagger helpers */
.animate-in.d1  { animation-delay: .05s; }
.animate-in.d2  { animation-delay: .10s; }
.animate-in.d3  { animation-delay: .15s; }
.animate-in.d4  { animation-delay: .20s; }
.animate-in.d5  { animation-delay: .25s; }
.animate-in.d6  { animation-delay: .30s; }

/* ─── CONTRAST IMPROVEMENTS ──────────────────────────
   More readable labels across markets + ai pages
─────────────────────────────────────────────────────── */

/* Section headers — stepped up from --t3 to --t2 */
.markets-section-title { color: var(--t2) !important; }

/* Price card: symbol label higher contrast */
.price-card-sym { color: var(--t2) !important; }

/* Calendar: column headers brighter */
.cal-col-hd { color: var(--t2) !important; }

/* Brief sidebar header label */
.brief-sidebar-hd { color: var(--t2) !important; }

/* Brief bars section labels */
.brief-bar { color: var(--t2) !important; }

/* Footer note readable */
.brief-footer-note { color: var(--t2) !important; }

/* Pill preview text — slightly brighter */
.brief-pill-preview { color: var(--t2) !important; }


/* Card hover — subtle lift */
.price-card {
  transition: border-color .2s, box-shadow .2s, transform .2s !important;
}
.price-card:hover {
  border-color: rgba(37,99,235,0.2) !important;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25) !important;
  transform: translateY(-2px);
}

/* Brief pair pills — hover lift */
.brief-pair-pill {
  transition: box-shadow .2s, border-color .2s !important;
}
.brief-pair-pill:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  border-color: rgba(255,255,255,0.1) !important;
}

/* ─── TradingView widget pill cards ─────────────────── */
.tv-chart-card {
  border: 1px solid rgba(255,255,255,0.06) !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  background: rgba(255,255,255,0.015) !important;
  backdrop-filter: blur(6px) !important;
  box-shadow: 0 2px 16px rgba(0,0,0,0.18) !important;
  transition: border-color .2s, box-shadow .2s, transform .2s !important;
}
.tv-chart-card:hover {
  border-color: rgba(37,99,235,0.18) !important;
  box-shadow: 0 6px 28px rgba(0,0,0,0.28) !important;
  transform: translateY(-2px) !important;
}

/* ─── MOBILE NAV TOGGLE + DRAWER ─────────────────────── */
.nav-mobile-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px;
  background: none; border: none; cursor: pointer;
  color: var(--t2); transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.nav-mobile-toggle .material-symbols-outlined { font-size: 22px; }
.nav-mobile-toggle:hover { background: rgba(255,255,255,0.06); color: var(--text); }

.mobile-nav-drawer {
  position: fixed; top: 72px; left: 0; right: 0;
  background: rgba(7,8,15,0.98);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  z-index: 998;
  display: flex; flex-direction: column;
  padding: 6px 0 10px;
  transform: translateY(-110%); opacity: 0;
  transition: transform 0.25s cubic-bezier(0.16,1,0.3,1), opacity 0.2s;
  pointer-events: none;
  backdrop-filter: blur(14px);
}
.mobile-nav-drawer.open {
  transform: translateY(0); opacity: 1;
  pointer-events: auto;
}
.mobile-nav-link {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 24px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px; font-weight: 500;
  color: rgba(225,226,237,0.55);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border-radius: 0;
}
.mobile-nav-link:hover,
.mobile-nav-link.active { color: #e1e2ed; background: rgba(255,255,255,0.04); }
.mobile-nav-link.active { color: #93b4ff; }
.mobile-nav-link .material-symbols-outlined { font-size: 18px; opacity: 0.8; }

/* ─── RESPONSIVE BREAKPOINTS ─────────────────────────── */
@media (max-width: 768px) {
  /* Nav */
  .top-nav { padding: 0 16px; gap: 8px; }
  .top-nav-links { display: none !important; }
  .nav-mobile-toggle { display: flex !important; }
  .nav-terms-link { display: none !important; }

  /* Page body */
  .page-body { padding-top: 72px; }

  /* News page: sidebar becomes horizontal filter bar */
  .page-with-sidebar {
    flex-direction: column;
    height: auto;
    overflow-y: visible;
    margin-top: 0;
  }
  .page-sidebar {
    width: 100%;
    height: auto;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 6px 8px;
    gap: 0;
    scrollbar-width: none;
    flex-shrink: 0;
  }
  .page-sidebar::-webkit-scrollbar { display: none; }
  .page-sidebar .sidebar-section-label { display: none; }
  .page-sidebar > div,
  .page-sidebar > section { flex-direction: row; display: contents; }
  .page-main { overflow-y: auto; }

  /* Portfolio split: stack vertically */
  .page-split {
    flex-direction: column;
    height: auto;
    overflow: visible;
    margin-top: 0;
  }
  .page-split-left {
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-y: visible;
    max-height: none;
  }
  .page-split-right {
    overflow-y: visible;
    min-height: 50vh;
  }

  /* Premium modal — slide up from bottom */
  .pm-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .pm-modal {
    max-height: 94vh;
    border-radius: 20px 20px 0 0;
    max-width: 100%;
  }
  .pm-plans {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 0 16px 20px;
  }
  .pm-hero { padding: 20px 20px 16px; }
  .pm-hero-title { font-size: 22px; }
  .pm-hero-sub { font-size: 13px; }
  .pm-header { padding: 14px 18px; }
}

@media (max-width: 480px) {
  .top-nav { padding: 0 12px; }
  #nav-notif-btn { display: none; }
  .mkt-body { padding: 20px 14px 40px !important; }
  .mkt-grid { grid-template-columns: 1fr !important; }
}

/* ─── NEWS PAGE SIDEBAR MOBILE BUTTONS ───────────────── */
@media (max-width: 768px) {
  .cat-btn {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 5px 12px;
    font-size: 11px;
  }
  .page-subheader {
    padding: 0 14px;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 8px;
  }
  .page-subheader::-webkit-scrollbar { display: none; }
  .free-banner-page {
    padding: 6px 14px;
    flex-wrap: wrap;
    gap: 6px;
  }
}
