/* =============================================
   screening_stock — main.css
   ============================================= */

:root {
  --bg: #080b12;
  --bg2: #0d1120;
  --bg3: #111826;
  --surface: #161e30;
  --surface2: #1c2640;
  --border: #242f4a;
  --border2: #2e3d60;
  --accent: #00d4aa;
  --accent2: #0090ff;
  --accent3: #ff6030;
  --gold: #f0b429;
  --text: #e4ecf8;
  --text2: #8fa0be;
  --text3: #4e5e7a;
  --green: #00c896;
  --red: #ff3d5a;
  --font-serif: 'DM Serif Display', Georgia, serif;
  --font-mono: 'DM Mono', 'Courier New', monospace;
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 14px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---- HEADER ---- */
#site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  height: 58px;
  background: rgba(8,11,18,0.94);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  gap: 28px; padding: 0 24px;
}

.logo {
  font-family: var(--font-serif);
  font-size: 21px; color: var(--accent);
  text-decoration: none; flex-shrink: 0;
  letter-spacing: -0.3px;
}
.logo span { color: var(--text2); font-style: italic; }

.nav-search {
  flex: 1; max-width: 420px; position: relative;
}
.nav-search input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px 7px 36px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.nav-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,212,170,0.1);
}
.nav-search input::placeholder { color: var(--text3); }
.search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text3); font-size: 16px; pointer-events: none;
}

.search-dropdown {
  display: none; position: absolute;
  top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
  z-index: 999;
  box-shadow: var(--shadow);
  max-height: 320px; overflow-y: auto;
}
.search-dropdown.show { display: block; }

.sd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer;
  transition: background 0.12s;
}
.sd-item:hover { background: var(--surface2); }
.sd-sym {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--accent); width: 90px; flex-shrink: 0;
}
.sd-name { font-size: 12px; color: var(--text); flex: 1; }
.sd-sector { font-size: 10px; color: var(--text3); text-align: right; }

nav { display: flex; gap: 2px; }
nav a {
  color: var(--text2); text-decoration: none;
  padding: 6px 12px; border-radius: 7px;
  font-size: 13px; font-weight: 500;
  transition: all 0.15s; white-space: nowrap;
}
nav a:hover { color: var(--text); background: var(--surface); }
nav a.active { color: var(--accent); background: rgba(0,212,170,0.1); }

.mobile-menu-btn {
  display: none; background: none; border: none;
  color: var(--text2); font-size: 20px; cursor: pointer;
  margin-left: auto;
}

/* ---- HERO ---- */
.hero {
  padding: 100px 24px 48px;
  text-align: center;
  background: radial-gradient(ellipse 70% 50% at 50% 0%, rgba(0,212,170,0.06) 0%, transparent 65%);
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(0,212,170,0.1); border: 1px solid rgba(0,212,170,0.2);
  border-radius: 20px; padding: 4px 14px;
  font-size: 12px; color: var(--accent); font-weight: 500;
  margin-bottom: 20px;
  animation: fadeUp 0.5s ease both;
}
.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(32px, 5.5vw, 60px);
  line-height: 1.1; color: var(--text);
  margin-bottom: 14px;
  animation: fadeUp 0.5s 0.08s ease both;
}
.hero h1 em { color: var(--accent); font-style: normal; }
.hero p {
  color: var(--text2); font-size: 15px;
  max-width: 520px; margin: 0 auto 30px;
  animation: fadeUp 0.5s 0.16s ease both;
}
.hero-stats {
  display: flex; justify-content: center; gap: 48px; flex-wrap: wrap;
  animation: fadeUp 0.5s 0.24s ease both;
}
.hero-stat .val {
  font-family: var(--font-mono); font-size: 22px;
  font-weight: 500; color: var(--text);
}
.hero-stat .lbl { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* ---- TICKER ---- */
.ticker-wrap {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  height: 38px; display: flex; align-items: center;
  overflow: hidden;
}
.ticker-label {
  background: var(--accent); color: var(--bg);
  height: 100%; padding: 0 14px;
  display: flex; align-items: center;
  font-size: 11px; font-weight: 700;
  letter-spacing: 1px; flex-shrink: 0;
}
.ticker-overflow { overflow: hidden; flex: 1; }
.ticker-track {
  display: flex; align-items: center;
  animation: ticker 55s linear infinite;
  white-space: nowrap; width: max-content;
}
.ticker-track:hover { animation-play-state: paused; }
.ticker-item {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 20px; border-right: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 12px;
}
.ti-sym { color: var(--text2); }
.ti-price { color: var(--text); font-weight: 500; }
.ti-chg.up { color: var(--green); }
.ti-chg.dn { color: var(--red); }
.ticker-loading { color: var(--text3); font-size: 12px; padding: 0 20px; }

/* ---- CONTAINER ---- */
.container { max-width: 1400px; margin: 0 auto; padding: 0 24px; }

/* ---- INDEX CARDS ---- */
.index-cards {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin: 36px 0 0;
}
.index-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  transition: border-color 0.2s, transform 0.2s;
  animation: fadeUp 0.5s ease both;
}
.index-card:hover { border-color: var(--border2); transform: translateY(-2px); }
.ic-label { font-size: 11px; color: var(--text3); font-weight: 600; letter-spacing: 0.4px; }
.ic-value {
  font-family: var(--font-mono); font-size: 22px;
  font-weight: 500; color: var(--text); margin: 4px 0;
}
.ic-chg { font-size: 12px; color: var(--text3); }
.ic-chg.up { color: var(--green); }
.ic-chg.dn { color: var(--red); }

/* ---- SCREENER SECTION ---- */
.screener-section { padding: 36px 0; }
.section-heading {
  font-family: var(--font-serif); font-size: 26px;
  color: var(--text); margin-bottom: 18px;
}

/* ---- FILTER CHIPS ---- */
.filter-chips {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px;
}
.chip {
  padding: 5px 14px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text2); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 0.15s; user-select: none;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active {
  background: rgba(0,212,170,0.12);
  border-color: var(--accent); color: var(--accent);
}

/* ---- FILTER ROW ---- */
.filter-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  align-items: center; margin-bottom: 14px;
}
.fsel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
  padding: 7px 28px 7px 10px; font-family: var(--font-sans);
  font-size: 12px; outline: none; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%234e5e7a' d='M5 7L0 2h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
  transition: border-color 0.2s;
}
.fsel:focus, .fsel:hover { border-color: var(--border2); }

.btn-apply {
  background: var(--accent); color: var(--bg);
  border: none; border-radius: 8px;
  padding: 7px 18px; font-family: var(--font-sans);
  font-size: 12px; font-weight: 700; cursor: pointer;
  transition: all 0.15s; letter-spacing: 0.2px;
}
.btn-apply:hover { background: #00f0c4; transform: translateY(-1px); }

.btn-reset {
  background: transparent; color: var(--text2);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 14px; font-family: var(--font-sans);
  font-size: 12px; cursor: pointer; transition: all 0.15s;
}
.btn-reset:hover { border-color: var(--border2); color: var(--text); }

/* ---- RESULTS BAR ---- */
.results-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.results-info { color: var(--text2); font-size: 12px; }
.results-info strong { color: var(--accent); font-family: var(--font-mono); }
.fetch-status { margin-left: 10px; font-size: 11px; color: var(--text3); }
.sort-row { display: flex; align-items: center; gap: 8px; }
.sort-lbl { font-size: 12px; color: var(--text3); }

/* ---- LOADER ---- */
.loader {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 24px; gap: 14px;
}
.spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.loader-text { color: var(--text2); font-size: 13px; }
.loader-sub { color: var(--text3); font-size: 11px; }

/* ---- PAGINATION ---- */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0 40px;
}
.pg-info { color: var(--text3); font-size: 12px; }
.pg-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.pg-btn {
  min-width: 32px; height: 32px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text2); font-family: var(--font-mono); font-size: 12px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; padding: 0 8px;
}
.pg-btn:hover { border-color: var(--accent); color: var(--accent); }
.pg-btn.active { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 700; }
.pg-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ---- FOOTER ---- */
footer {
  border-top: 1px solid var(--border);
  padding: 28px 24px;
  margin-top: 24px;
}
.footer-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; flex-wrap: wrap; gap: 16px;
}
.footer-logo {
  font-family: var(--font-serif); font-size: 18px;
  color: var(--accent); margin-right: auto;
}
.footer-logo span { color: var(--text3); font-style: italic; }
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--text3); text-decoration: none; font-size: 12px; transition: color 0.15s; }
.footer-links a:hover { color: var(--accent); }
.footer-note { width: 100%; text-align: center; color: var(--text3); font-size: 11px; }

/* ---- BADGE ---- */
.badge {
  display: inline-block; padding: 2px 8px;
  border-radius: 4px; font-size: 10px; font-weight: 600;
}
.badge-mega { background: rgba(255,96,48,0.15); color: #ff8060; }
.badge-large { background: rgba(0,144,255,0.15); color: #50b0ff; }
.badge-mid { background: rgba(240,180,41,0.15); color: var(--gold); }
.badge-small { background: rgba(79,94,122,0.2); color: var(--text3); }

/* ---- UTILITY ---- */
.up { color: var(--green) !important; }
.dn { color: var(--red) !important; }
.num { text-align: right !important; }
.muted { color: var(--text3); }

.mini-bar {
  display: inline-block; width: 56px; height: 3px;
  background: var(--surface2); border-radius: 2px; vertical-align: middle;
}
.mini-bar-fill {
  height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
}

/* ---- ANIMATIONS ---- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ticker {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .index-cards { grid-template-columns: repeat(2,1fr); }
  nav { display: none; }
  .mobile-menu-btn { display: block; }
  .hero-stats { gap: 24px; }
}
@media (max-width: 600px) {
  .index-cards { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 28px; }
}
