/* ════════════════════════════════════════════
   NEPSE PREDICT — STYLESHEET
   Aesthetic: Dark terminal + refined data dashboard
   Fonts: Space Mono (mono/display) + DM Sans (body)
════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
  --bg:         #0a0c0f;
  --bg-card:    #111318;
  --bg-hover:   #181c22;
  --border:     #1e2430;
  --border-hi:  #2a3142;

  --text:       #e2e8f0;
  --text-muted: #64748b;
  --text-dim:   #334155;

  --accent:     #00e5a0;       /* neon teal — primary */
  --accent-dim: #00b37d;
  --accent-glow:rgba(0,229,160,0.15);

  --red:        #ff4d6a;
  --red-dim:    rgba(255,77,106,0.15);
  --green:      #00e5a0;
  --green-dim:  rgba(0,229,160,0.12);
  --yellow:     #fbbf24;
  --yellow-dim: rgba(251,191,36,0.12);
  --blue:       #60a5fa;

  --ma20:       #60a5fa;
  --ma50:       #f59e0b;
  --ma200:      #ec4899;

  --font-mono: 'Space Mono', monospace;
  --font-body: 'DM Sans', sans-serif;

  --radius:     8px;
  --radius-lg:  14px;
  --shadow:     0 4px 24px rgba(0,0,0,0.5);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 3px; }

/* ════════════════════════════════════════════
   HEADER
════════════════════════════════════════════ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,12,15,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1600px; margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  color: var(--accent); font-size: 20px;
  animation: pulse 3s infinite;
}
@keyframes pulse {
  0%,100% { opacity:1; } 50% { opacity:0.5; }
}
.logo-text {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}
.logo-text strong { color: var(--accent); }
.header-nav { display: flex; align-items: center; gap: 16px; }
.nav-badge {
  background: var(--green-dim);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.1em;
  border: 1px solid rgba(0,229,160,0.2);
}
.nav-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* ════════════════════════════════════════════
   SEARCH
════════════════════════════════════════════ */
.search-bar-section {
  max-width: 1600px; margin: 0 auto;
  padding: 20px 24px 0;
  display: flex; align-items: flex-start; flex-wrap: wrap; gap: 12px;
}
.search-container { position: relative; flex: 1; min-width: 280px; max-width: 500px; }
.search-input-wrap {
  display: flex; align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}
.search-input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-icon { width: 16px; height: 16px; margin: 0 12px; color: var(--text-muted); flex-shrink: 0; }
.search-input-wrap input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-family: var(--font-body); font-size: 14px;
  padding: 11px 0;
}
.search-input-wrap input::placeholder { color: var(--text-dim); }
.search-clear {
  padding: 0 12px; cursor: pointer; color: var(--text-muted);
  font-size: 12px; opacity: 0; transition: opacity 0.2s;
}
.search-clear.visible { opacity: 1; }

/* Dropdown */
.search-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  max-height: 280px; overflow-y: auto;
  z-index: 200; box-shadow: var(--shadow);
}
.search-dropdown.hidden { display: none; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--bg-hover); }
.di-symbol {
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  color: var(--accent); min-width: 60px;
}
.di-name { color: var(--text); font-size: 13px; flex: 1; }
.di-sector {
  font-size: 10px; color: var(--text-muted);
  background: var(--border); padding: 2px 6px; border-radius: 3px;
}

/* Selected company tag */
.selected-company-tag {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  padding: 8px 14px;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(-4px);} to { opacity:1; transform:none;} }
#selectedSymbol {
  font-family: var(--font-mono); font-weight: 700;
  color: var(--accent); font-size: 14px;
}
.tag-name { color: var(--text); font-size: 13px; }
.tag-sector {
  font-size: 10px; color: var(--text-muted);
  background: var(--border); padding: 2px 6px; border-radius: 3px;
}

/* ════════════════════════════════════════════
   STATS STRIP
════════════════════════════════════════════ */
.stats-strip {
  max-width: 1600px; margin: 14px auto 0;
  padding: 0 24px;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.stat-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  min-width: 90px;
  transition: border-color 0.2s;
}
.stat-chip:hover { border-color: var(--border-hi); }
.chip-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.chip-value { font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--text); margin-top: 2px; }

/* ════════════════════════════════════════════
   MAIN GRID
════════════════════════════════════════════ */
.main-grid {
  max-width: 1600px; margin: 16px auto 40px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 1100px) {
  .main-grid { grid-template-columns: 1fr; }
  .side-column { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
}
@media (max-width: 640px) {
  .main-grid { padding: 0 12px; }
  .search-bar-section { padding: 16px 12px 0; }
  .side-column { grid-template-columns: 1fr; }
}

/* ── Chart Cards ── */
.charts-column { display: flex; flex-direction: column; gap: 16px; }
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.4s ease;
}
.chart-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.chart-card-header h2 {
  font-family: var(--font-mono); font-size: 12px;
  font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.chart-wrap { position: relative; height: 260px; }
.chart-wrap-sm { height: 160px; }
.chart-legend { display: flex; gap: 12px; flex-wrap: wrap; }
.legend-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text-muted);
}
.legend-dot { width: 8px; height: 8px; border-radius: 2px; }
.info-tip {
  width: 18px; height: 18px;
  background: var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--text-muted);
  cursor: help;
}

/* ── Side Column Panels ── */
.side-column { display: flex; flex-direction: column; gap: 16px; }
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.4s ease;
}
.panel-title {
  font-family: var(--font-mono); font-size: 11px;
  font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 16px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* Stats grid */
.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.stat-row {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.stat-row-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-row-value {
  font-family: var(--font-mono); font-size: 13px; font-weight: 700;
  color: var(--text); margin-top: 3px;
}
.stat-row-value.positive { color: var(--green); }
.stat-row-value.negative { color: var(--red); }
.stat-row-value.neutral  { color: var(--yellow); }

/* Fundamentals */
.info-grid { display: flex; flex-direction: column; gap: 8px; }
.info-row {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border); padding-bottom: 8px;
}
.info-row:last-child { border-bottom: none; padding-bottom: 0; }
.info-label { font-size: 12px; color: var(--text-muted); }
.info-value { font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--text); }

/* ════════════════════════════════════════════
   AI PANEL
════════════════════════════════════════════ */
.ai-panel { position: relative; overflow: hidden; }
.ai-panel::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
}
.ai-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.ai-badge {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  color: var(--accent); letter-spacing: 0.12em;
}
.ai-model {
  font-size: 10px; color: var(--text-dim);
  background: var(--border); padding: 2px 8px; border-radius: 4px;
}

/* Signal + Risk Row */
.ai-signal-row { display: flex; gap: 12px; margin-bottom: 16px; }
.signal-box {
  flex: 1; background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
  transition: all 0.4s ease;
}
.signal-box.buy   { border-color: var(--green); background: var(--green-dim); }
.signal-box.sell  { border-color: var(--red);   background: var(--red-dim);   }
.signal-box.hold  { border-color: var(--yellow); background: var(--yellow-dim); }
.signal-icon {
  font-family: var(--font-mono); font-size: 20px; font-weight: 700;
  color: var(--text-muted);
}
.signal-box.buy  .signal-icon { color: var(--green); }
.signal-box.sell .signal-icon { color: var(--red); }
.signal-box.hold .signal-icon { color: var(--yellow); }
.signal-label { font-size: 10px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.1em; }

.risk-meter {
  flex: 1; background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.risk-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.risk-bar-wrap {
  height: 6px; background: var(--border);
  border-radius: 3px; overflow: hidden; margin-bottom: 6px;
}
.risk-bar {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--green), var(--yellow), var(--red));
  transition: width 0.8s ease;
}
.risk-text { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }

/* AI Content */
.ai-content {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  min-height: 120px; margin-bottom: 14px;
  max-height: 300px; overflow-y: auto;
}
.ai-placeholder { color: var(--text-muted); font-size: 13px; line-height: 1.7; }
.ai-section { margin-bottom: 12px; }
.ai-section:last-child { margin-bottom: 0; }
.ai-section-title {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 5px;
}
.ai-section-body { font-size: 13px; color: var(--text); line-height: 1.6; }

/* AI Button */
.ai-btn {
  width: 100%; padding: 12px;
  background: var(--accent);
  color: #000; font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  letter-spacing: 0.08em;
  border: none; border-radius: var(--radius); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: opacity 0.2s, transform 0.15s;
}
.ai-btn:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); }
.ai-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.ai-btn.loading .ai-btn-icon { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-disclaimer { font-size: 10px; color: var(--text-dim); text-align: center; margin-top: 10px; line-height: 1.5; }

/* ════════════════════════════════════════════
   LOADING OVERLAY
════════════════════════════════════════════ */
.loading-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(10,12,15,0.85);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
}
.loader-inner { text-align: center; }
.loader-ring {
  width: 48px; height: 48px; margin: 0 auto 16px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loader-text {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text-muted); letter-spacing: 0.06em;
}

/* ════════════════════════════════════════════
   EMPTY STATE
════════════════════════════════════════════ */
.empty-state {
  text-align: center; padding: 80px 24px;
  animation: fadeIn 0.6s ease;
}
.empty-icon {
  font-size: 48px; color: var(--border-hi);
  margin-bottom: 20px;
  animation: pulse 4s ease infinite;
}
.empty-state h2 {
  font-family: var(--font-mono); font-size: 22px;
  color: var(--text-muted); margin-bottom: 12px; letter-spacing: 0.04em;
}
.empty-state p { font-size: 14px; color: var(--text-dim); line-height: 1.8; }

/* ════════════════════════════════════════════
   COLOR UTILS
════════════════════════════════════════════ */
.text-green  { color: var(--green) !important; }
.text-red    { color: var(--red) !important; }
.text-yellow { color: var(--yellow) !important; }
.text-blue   { color: var(--blue) !important; }
.hidden      { display: none !important; }
