/* ============================================================
   screener.css — 100-Bagger Screener
   Premium dark glassmorphism design
   ============================================================ */

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

:root {
  --bg:          #08090f;
  --surface:     rgba(255,255,255,0.05);
  --surface-hov: rgba(255,255,255,0.09);
  --border:      rgba(255,255,255,0.10);
  --border-hov:  rgba(255,255,255,0.22);
  --text:        #f0f2ff;
  --text-muted:  rgba(240,242,255,0.50);
  --accent:      #7c6df8;
  --accent-glow: rgba(124,109,248,0.35);
  --green:       #22d3a5;
  --amber:       #f59e0b;
  --red:         #f87171;
  --gold:        #facc15;
  --radius:      16px;
  --radius-sm:   10px;
  --shadow:      0 8px 32px rgba(0,0,0,0.55);
  --font:        'Inter', system-ui, sans-serif;
}

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

/* ---- Animated background blobs ---- */
.bg-canvas {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  overflow: hidden;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.18;
  animation: drift 18s ease-in-out infinite alternate;
}
.blob-1 { width: 680px; height: 680px; background: #6366f1; top: -180px; left: -180px; animation-delay: 0s; }
.blob-2 { width: 500px; height: 500px; background: #8b5cf6; bottom: -120px; right: -120px; animation-delay: -7s; }
.blob-3 { width: 400px; height: 400px; background: #14b8a6; top: 40%; left: 40%; animation-delay: -13s; }
@keyframes drift {
  from { transform: translate(0,0) scale(1); }
  to   { transform: translate(40px, 60px) scale(1.08); }
}

/* ---- Glassmorphism base ---- */
.glass {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border: 1px solid var(--border);
}

/* ---- Header ---- */
.site-header {
  position: relative; z-index: 10;
  padding: 1.4rem 2rem;
  border-radius: 0;
  border-top: none; border-left: none; border-right: none;
}
.header-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap;
}
.header-brand { display: flex; align-items: center; gap: 1rem; }
.logo-icon { font-size: 2rem; }
.site-title {
  font-size: 1.6rem; font-weight: 800; letter-spacing: -0.03em;
}
.site-title .accent { color: var(--accent); }
.site-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.nav-link {
  padding: 0.45rem 1.1rem;
  border: 1px solid rgba(124,109,248,0.4);
  border-radius: 999px;
  font-size: 0.82rem; font-weight: 600;
  color: #a5b4fc; text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}
.nav-link:hover { background: rgba(124,109,248,0.15); border-color: var(--accent); color: #fff; }

/* ---- Criteria bar ---- */
.criteria-bar {
  position: relative; z-index: 9;
  padding: 0.9rem 2rem;
  border-radius: 0;
  border-top: none; border-left: none; border-right: none;
}
.criteria-bar-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.criteria-bar-title {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted); white-space: nowrap;
}
.criteria-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cpill {
  font-size: 0.7rem; font-weight: 600; padding: 0.25rem 0.7rem;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted);
  white-space: nowrap; cursor: default;
  transition: background 0.15s, border-color 0.15s;
}
.cpill:hover { background: var(--surface-hov); border-color: var(--accent); color: var(--text); }

/* ---- Stats bar ---- */
.stats-bar {
  position: relative; z-index: 8;
  max-width: 1400px; margin: 1.4rem auto 0;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}
.stat-card {
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  display: flex; flex-direction: column; gap: 0.3rem;
}
.stat-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--accent); }

/* ---- Filters ---- */
.filters {
  position: relative; z-index: 8;
  max-width: 1400px; margin: 1.2rem auto 0;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  display: flex; align-items: flex-end; gap: 1.2rem; flex-wrap: wrap;
}
.filter-group { display: flex; flex-direction: column; gap: 0.3rem; }
.filter-group label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600; }
.filter-group select,
.filter-group input {
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.85rem;
  padding: 0.5rem 0.8rem;
  outline: none;
  transition: border-color 0.2s;
  min-width: 140px;
}
.filter-group select:focus,
.filter-group input:focus { border-color: var(--accent); }
.filter-group select option { background: #1a1b2e; }
.filter-search input { min-width: 220px; }
.filter-count {
  margin-left: auto; align-self: flex-end;
  font-size: 0.78rem; color: var(--text-muted); white-space: nowrap;
}

/* ---- Grid ---- */
.grid-container {
  position: relative; z-index: 7;
  max-width: 1400px; margin: 1.4rem auto 2rem;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.4rem;
}

/* ---- Loading state ---- */
.loading-state { grid-column: 1/-1; display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 4rem; color: var(--text-muted); }
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Ticker card ---- */
.ticker-card {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  display: flex; flex-direction: column; gap: 1rem;
  transition: transform 0.2s ease, border-color 0.2s, box-shadow 0.2s;
  cursor: default;
}
.ticker-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hov);
  box-shadow: 0 16px 48px rgba(0,0,0,0.6), 0 0 0 1px var(--accent-glow);
}

/* Card header */
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.8rem; }
.card-ticker-block { display: flex; flex-direction: column; }
.card-symbol {
  font-size: 1.4rem; font-weight: 900; letter-spacing: -0.03em;
  color: #e0e7ff;
}
.card-company { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.card-sector-badge {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
  padding: 0.2rem 0.6rem; border-radius: 999px;
  background: rgba(124,109,248,0.18); border: 1px solid rgba(124,109,248,0.3);
  color: #a5b4fc; white-space: nowrap; align-self: flex-start;
}

/* Score badge */
.score-ring {
  position: relative; flex-shrink: 0;
  width: 56px; height: 56px;
}
.score-ring svg { width: 56px; height: 56px; transform: rotate(-90deg); }
.score-ring .ring-bg { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 4; }
.score-ring .ring-fg { fill: none; stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.score-ring .ring-text {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 800; line-height: 1;
}
.score-ring .score-num { font-size: 1rem; font-weight: 900; }

/* Price row */
.price-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
.price-cell { display: flex; flex-direction: column; gap: 0.15rem; }
.price-label { font-size: 0.6rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.price-value { font-size: 0.88rem; font-weight: 700; color: var(--text); }
.price-value.good { color: var(--green); }
.price-value.warn { color: var(--red); }

/* Metrics row */
.metrics-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-sm);
  padding: 0.7rem;
}
.metric-cell { display: flex; flex-direction: column; gap: 0.15rem; }
.metric-label { font-size: 0.58rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.metric-value { font-size: 0.78rem; font-weight: 700; }
.metric-value.good { color: var(--green); }
.metric-value.warn { color: var(--amber); }
.metric-value.na   { color: var(--text-muted); }

/* Criteria checklist */
.criteria-list { display: flex; flex-direction: column; gap: 0.4rem; }
.criterion-row {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.74rem;
}
.crit-icon { width: 16px; height: 16px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 0.6rem; font-weight: 700; }
.crit-icon.met   { background: rgba(34,211,165,0.2); color: var(--green); }
.crit-icon.fail  { background: rgba(248,113,113,0.15); color: var(--red); }
.crit-label { color: var(--text-muted); flex: 1; }
.crit-label.met  { color: var(--text); }
.crit-val { font-size: 0.68rem; font-weight: 700; color: var(--text-muted); }

/* News ticker */
.card-news {
  font-size: 0.7rem; color: var(--text-muted);
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-news-label { color: var(--accent); font-weight: 700; margin-right: 0.4rem; }

/* ---- 52-week bar ---- */
.week52-bar { display: flex; flex-direction: column; gap: 0.3rem; }
.week52-label { font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.week52-track {
  height: 6px; background: rgba(255,255,255,0.08); border-radius: 999px; position: relative; overflow: hidden;
}
.week52-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--green));
  transition: width 0.6s ease;
}
.week52-ends { display: flex; justify-content: space-between; font-size: 0.62rem; color: var(--text-muted); }

/* ---- Empty state ---- */
.empty-state {
  grid-column: 1/-1; text-align: center; padding: 4rem;
  color: var(--text-muted); font-size: 0.9rem;
}

/* ---- Methodology footer ---- */
.methodology {
  position: relative; z-index: 6;
  max-width: 1400px; margin: 0 auto 3rem;
  padding: 2rem;
  border-radius: var(--radius);
}
.methodology h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }
.method-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem; margin-bottom: 1.2rem;
}
.method-item { display: flex; flex-direction: column; gap: 0.3rem; }
.method-item strong { font-size: 0.78rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; }
.method-item span { font-size: 0.78rem; color: var(--text-muted); }
.method-item code { font-size: 0.72rem; background: rgba(255,255,255,0.08); padding: 0.1rem 0.3rem; border-radius: 4px; }
.disclaimer { font-size: 0.72rem; color: var(--text-muted); }

/* ---- Score colours ---- */
.score-9 .ring-fg { stroke: #facc15; }
.score-9 .score-num { color: #facc15; }
.score-8 .ring-fg { stroke: #facc15; }
.score-8 .score-num { color: #facc15; }
.score-7 .ring-fg { stroke: #22d3a5; }
.score-7 .score-num { color: #22d3a5; }
.score-6 .ring-fg { stroke: #60a5fa; }
.score-6 .score-num { color: #60a5fa; }
.score-5 .ring-fg { stroke: #a78bfa; }
.score-5 .score-num { color: #a78bfa; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .site-header { padding: 1rem; }
  .filters { flex-direction: column; }
  .filter-search input { min-width: auto; }
  .grid-container { grid-template-columns: 1fr; padding: 0 1rem; }
  .metrics-row { grid-template-columns: repeat(2, 1fr); }
}
