/* Crypto Bubbles Demo - pages/*.php chrome (gainers, losers, altseason,
   fear-greed, coin, widget). Reuses the CSS vars from style.css (dark/light);
   this file only adds the document-flow layout these pages need instead of
   the fixed-position app shell. */

html, body.cb-page { height: auto; overflow: auto; overscroll-behavior: auto; }

body.cb-page {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.cb-page-header {
  position: sticky; top: 0; z-index: 20;
  height: 52px; flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  background: var(--bar);
  border-bottom: 1px solid var(--border);
}
.cb-brand { display: flex; align-items: center; gap: 8px; white-space: nowrap; text-decoration: none; color: var(--text); }
.cb-page-nav { display: flex; align-items: center; gap: 14px; }
.cb-back-link {
  font-size: 13px; color: var(--muted); text-decoration: none;
  white-space: nowrap;
}
.cb-back-link:hover { color: var(--text); }

.cb-more { position: relative; }
.cb-more-btn {
  background: var(--panel-bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  height: 32px; padding: 0 10px; font-size: 13px; cursor: pointer;
}
.cb-more-btn:hover { background: var(--hover-bg); }
.cb-more-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 50;
  min-width: 180px; padding: 6px;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
  display: flex; flex-direction: column;
}
/* display:flex beats the `hidden` attribute, so without this the More dropdown
   sits permanently open on every pages/*.php page (.cb-lang-menu below already
   had the equivalent rule - this one was simply missing). */
.cb-more-menu[hidden] { display: none; }
.cb-more-menu a {
  padding: 8px 10px; border-radius: 6px; font-size: 13px;
  color: var(--text); text-decoration: none;
}
.cb-more-menu a:hover { background: var(--hover-bg); }
.cb-more-menu a[aria-current="page"] { color: var(--accent); font-weight: 700; }

.cb-lang { position: relative; }
.cb-lang-btn {
  background: var(--panel-bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  height: 32px; padding: 0 10px; font-size: 13px; cursor: pointer;
  white-space: nowrap;
}
.cb-lang-btn:hover { background: var(--hover-bg); }
.cb-lang-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 50;
  min-width: 160px; max-height: 320px; overflow-y: auto; padding: 6px;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
  display: flex; flex-direction: column;
}
.cb-lang-menu[hidden] { display: none; }
.cb-lang-menu a {
  padding: 8px 10px; border-radius: 6px; font-size: 13px;
  color: var(--text); text-decoration: none;
}
.cb-lang-menu a:hover { background: var(--hover-bg); }
.cb-lang-menu a[aria-current="page"] { color: var(--accent); font-weight: 700; }

.cb-page-main {
  flex: 1;
  max-width: 980px; width: 100%;
  margin: 0 auto;
  padding: 28px 16px 40px;
}

.cb-page-title { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.cb-page-intro { font-size: 14px; color: var(--muted); margin-bottom: 20px; max-width: 640px; }

.cb-page-footer {
  flex: none;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 16px; font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--border);
}
.cb-foot-sep { opacity: .6; }

/* ---------- tabs (gainers/losers period, widget options) ---------- */
.cb-tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.cb-tabs a {
  display: inline-block; height: 32px; line-height: 32px; padding: 0 14px;
  border-radius: 6px; font-size: 13px; font-weight: 700; text-decoration: none;
  color: var(--muted); background: var(--panel-bg); border: 1px solid var(--border);
}
.cb-tabs a:hover { color: var(--text); background: var(--hover-bg); }
.cb-tabs a.active { color: var(--bg); background: var(--accent); border-color: var(--accent); }

/* ---------- movers table (gainers/losers) ---------- */
.cb-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.cb-table { width: 100%; min-width: 480px; border-collapse: collapse; font-size: 13px; }
.cb-table th {
  text-align: right; font-weight: 700; font-size: 11px; letter-spacing: .03em;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border);
  background: var(--bar); white-space: nowrap;
}
.cb-table th:nth-child(1), .cb-table th:nth-child(2) { text-align: center; }
.cb-table th:nth-child(3) { text-align: left; }
.cb-table td {
  padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap;
}
.cb-table td:nth-child(1), .cb-table td:nth-child(2) { text-align: center; }
.cb-table tr:last-child td { border-bottom: 0; }
.cb-table tr:hover { background: var(--hover-bg); }
.cb-row-coin { text-align: left !important; display: flex; align-items: center; gap: 8px; }
.cb-row-coin img { width: 20px; height: 20px; border-radius: 50%; flex: none; }
.cb-row-coin a { color: var(--text); text-decoration: none; font-weight: 700; }
.cb-row-coin a:hover { text-decoration: underline; }
.cb-row-coin small { color: var(--muted); font-weight: 400; }

/* ---------- altseason gauge ---------- */
.cb-gauge-wrap { display: flex; flex-direction: column; align-items: center; margin: 8px 0 24px; }
.cb-gauge-value { font-size: 42px; font-weight: 700; margin-top: -18px; }
.cb-gauge-class { font-size: 15px; font-weight: 700; margin-top: 2px; }
.cb-beta-badge {
  display: inline-block; margin-top: 10px; font-size: 11px; font-weight: 700;
  color: var(--gold); background: rgba(255, 208, 60, .12); border: 1px solid rgba(255, 208, 60, .35);
  border-radius: 20px; padding: 4px 12px; letter-spacing: .02em;
}
.cb-stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0; }
.cb-stat-card {
  background: var(--cell-bg); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px;
}
.cb-stat-card span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.cb-stat-card b { font-size: 20px; }
.cb-explainer { font-size: 13px; color: var(--muted); line-height: 1.6; max-width: 680px; margin-top: 10px; }

/* ---------- fear & greed ---------- */
.cb-fng-current { display: flex; align-items: center; gap: 24px; margin-bottom: 24px; flex-wrap: wrap; }
.cb-fng-number { font-size: 56px; font-weight: 700; line-height: 1; }
.cb-fng-class { font-size: 16px; font-weight: 700; margin-top: 6px; }
.cb-fng-chart-wrap { margin-bottom: 22px; }
.cb-fng-chart-wrap svg { width: 100%; height: auto; display: block; }
.cb-section-heading { font-size: 15px; font-weight: 700; margin: 22px 0 10px; }

/* ---------- coin page ---------- */
.cb-coin-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.cb-coin-head img { width: 48px; height: 48px; border-radius: 50%; }
.cb-coin-h1 { font-size: 22px; font-weight: 700; }
.cb-coin-sub { font-size: 13px; color: var(--muted); }
.cb-coin-price { margin-left: auto; text-align: right; }
.cb-coin-price b { font-size: 24px; display: block; }
.cb-perf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 8px; margin-bottom: 20px; }
.cb-perf-grid .cell { background: var(--cell-bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 6px; text-align: center; }
.cb-perf-grid .cell span { display: block; font-size: 10px; color: var(--muted); letter-spacing: .05em; }
.cb-perf-grid .cell b { display: block; font-size: 14px; margin-top: 4px; }
.cb-stat-row-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 20px; }
.cb-spark-wrap { margin-bottom: 20px; }
.cb-spark-wrap svg { width: 100%; height: 120px; display: block; }
.cb-coin-links { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; font-size: 13px; }
.cb-coin-links a { color: var(--accent); text-decoration: none; }
.cb-coin-links a:hover { text-decoration: underline; }
.cb-exchange-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.cb-exchange-links a {
  color: var(--text); background: var(--cell-bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 12px; font-size: 13px; text-decoration: none;
}
.cb-exchange-links a:hover { background: var(--hover-bg); }
.cb-focus-link { display: inline-block; margin-top: 16px; font-size: 13px; color: var(--accent); text-decoration: none; }
.cb-focus-link:hover { text-decoration: underline; }

/* ---------- widget page ---------- */
.cb-widget-preview {
  width: 100%; height: 420px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 20px;
  background: var(--bg);
}
.cb-widget-preview iframe { width: 100%; height: 100%; border: 0; display: block; }
.cb-widget-options { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.cb-widget-options label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.cb-widget-options select {
  background: var(--panel-bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; height: 32px; padding: 0 8px; font-size: 13px;
}
.cb-snippet-wrap { position: relative; margin-bottom: 12px; }
.cb-snippet {
  display: block; width: 100%; background: var(--cell-bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px; font-size: 12px; color: var(--text);
  white-space: pre-wrap; word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.cb-copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: var(--panel-bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; height: 26px; padding: 0 10px; font-size: 12px; cursor: pointer;
}
.cb-copy-btn:hover { background: var(--hover-bg); }

.up { color: var(--green); }
.down { color: var(--red); }
.flat { color: var(--muted); }

/* Note: body.embed rules live in style.css (index.php also serves /embed
   directly as ?embed=1, and only loads style.css) - not duplicated here. */

@media (max-width: 640px) {
  .cb-page-nav { gap: 8px; }
  .cb-back-link { display: none; }
  .cb-coin-price { margin-left: 0; text-align: left; }
  .cb-fng-current { gap: 14px; }
  .cb-fng-number { font-size: 44px; }
}

/* ---------- /coins pagination ---------- */
.cb-pagination {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 10px; margin: 18px 0 6px;
}
.cb-page-link, .cb-page-num {
  color: var(--text); text-decoration: none;
  border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 10px; font-size: 13px; line-height: 1;
}
.cb-page-link:hover, .cb-page-num:hover { border-color: var(--up); }
.cb-page-count { color: var(--muted); font-size: 13px; }
.cb-pagination-numbers { gap: 6px; margin-top: 4px; }
.cb-page-num.active { border-color: var(--up); color: var(--up); font-weight: 700; }
