/* =============================================
   GetNiftyReady — style.css
   ============================================= */

:root {
  --primary:     #14b8a6;
  --primary-dark:#0d9488;
  --bg-dark:     #0f172a;
  --bg-card:     #1e293b;
  --bg-card2:    #162032;
  --border:      #2d3f55;
  --text:        #f1f5f9;
  --text-muted:  #94a3b8;
  --success:     #22c55e;
  --danger:      #ef4444;
  --warning:     #eab308;
  --neutral:     #94a3b8;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 4px 24px rgba(0,0,0,0.35);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---- NAVBAR ---- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15,23,42,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.5px;
}
.logo-icon { font-size: 1.4rem; }
.logo-svg { width: 30px; height: 17px; color: var(--primary); flex-shrink: 0; }
.logo-accent { color: var(--primary); }
.nav-links { display: flex; gap: 24px; }
.nav-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }

/* ---- HERO ---- */
.hero {
  background: linear-gradient(135deg, #0f172a 0%, #0a1f1e 50%, #0f172a 100%);
  padding: 64px 20px 48px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.hero-inner { max-width: 760px; margin: 0 auto; }
.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #fff 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}
.hero-sub {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 36px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* ---- SEARCH ---- */
.search-wrap { position: relative; max-width: 620px; margin: 0 auto; }
.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: 6px 6px 6px 20px;
  gap: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.search-icon { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }
.search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
.search-box input::placeholder { color: var(--text-muted); }
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 10px 24px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(0.97); }

/* ---- SUGGESTIONS ---- */
.suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  z-index: 200;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.suggestions.hidden { display: none; }
.suggestion-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.suggestion-item:hover { background: rgba(99,102,241,0.12); }
.sug-name { font-size: 0.9rem; color: var(--text); }
.sug-ticker { font-size: 0.78rem; color: var(--primary); font-weight: 600; }

/* ---- INDICES ---- */
.indices-section {
  padding: 32px 20px;
  background: var(--bg-card2);
  border-bottom: 1px solid var(--border);
}
/* -- Live bar -- */
.live-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  50% { opacity: 0.7; box-shadow: 0 0 0 4px rgba(34,197,94,0); }
}
.live-label { font-weight: 800; color: #22c55e; letter-spacing: 0.8px; font-size: 0.78rem; }
.live-sep { color: #2d3f55; }
.live-delay { color: #475569; font-size: 0.7rem; }
#lastUpdated { color: #e2e8f0; font-weight: 600; }
.indices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.index-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.3s, transform 0.2s;
  cursor: default;
}
.index-card:hover { transform: translateY(-2px); }
.index-card.positive { border-color: rgba(34,197,94,0.4); }
.index-card.negative { border-color: rgba(239,68,68,0.4); }

/* -- Index card tooltips -- */
.index-card[data-tooltip] { position: relative; cursor: default; }
.index-card[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.72rem;
  line-height: 1.4;
  padding: 7px 10px;
  border-radius: 7px;
  width: 170px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s;
  z-index: 20;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.index-card[data-tooltip]:hover::after { opacity: 1; }
.idx-name { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.idx-price { font-size: 1.15rem; font-weight: 700; margin-bottom: 4px; }
.idx-change { font-size: 0.82rem; font-weight: 600; }
.index-card.positive .idx-change { color: var(--success); }
.index-card.negative .idx-change { color: var(--danger); }
.index-card.neutral  .idx-change { color: var(--neutral); }

/* ---- SKELETON ---- */
.skeleton { animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ---- AD SLOT ---- */
.ad-slot {
  margin: 24px auto;
  min-height: 90px;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius);
}

/* ---- RESULT SECTION ---- */
.result-section {
  padding: 0 20px 24px;
  scroll-margin-top: 72px;
}
.result-section.hidden { display: none; }
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 0 0 1px rgba(99,102,241,0.15), var(--shadow);
}
.result-loading, .result-error {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.result-error { color: var(--danger); }
.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.result-name { font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.result-symbol { font-size: 0.82rem; color: var(--text-muted); background: rgba(99,102,241,0.12); padding: 2px 8px; border-radius: 4px; }
.result-price { font-size: 2rem; font-weight: 800; letter-spacing: -1px; }
.result-price-wrap { text-align: right; }
.result-change {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 4px;
}
.result-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-item {
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.stat-value { font-size: 0.95rem; font-weight: 600; }
.result-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.btn-close {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 50px;
  cursor: pointer;
  font-size: 0.78rem;
  transition: border-color 0.2s, color 0.2s;
}
.btn-close:hover { border-color: var(--danger); color: var(--danger); }

/* ---- POSITIVE / NEGATIVE / NEUTRAL ---- */
.positive { color: var(--success); }
.negative { color: var(--danger); }
.neutral  { color: var(--neutral); }

/* ---- POPULAR STOCKS ---- */
.popular-section { padding: 40px 20px; }
.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}
.section-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.movers-badge {
  font-size: 0.65rem;
  font-weight: 600;
  background: rgba(20,184,166,0.15);
  color: var(--primary);
  border: 1px solid rgba(20,184,166,0.3);
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
  margin-left: 6px;
}
.popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.popular-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.2s, transform 0.2s;
}
.popular-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}
.pc-name { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 8px; line-height: 1.3; }
.pc-price { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.pc-change { font-size: 0.82rem; font-weight: 600; }

/* ---- MOVERS ---- */
.movers-section { padding: 8px 20px 40px; }
.movers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.movers-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.gainers-title { color: var(--success); }
.losers-title  { color: var(--danger); }
.mover-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
  transition: background 0.15s;
  border-radius: 6px;
  padding: 10px 8px;
  gap: 8px;
}
.mover-row:hover { background: rgba(99,102,241,0.08); }
.mover-row:last-child { border-bottom: none; }
.mover-name { flex: 1; font-size: 0.88rem; font-weight: 500; }
.mover-price { font-size: 0.88rem; color: var(--text-muted); }
.mover-pct { font-size: 0.88rem; font-weight: 700; min-width: 55px; text-align: right; }
.mover-empty { color: var(--text-muted); font-size: 0.88rem; padding: 12px 0; }

/* ---- SPARKLINE HOVER TOOLTIP ---- */
.spark-tooltip {
  position: fixed;
  z-index: 9000;
  background: #1e293b;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  pointer-events: none;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  min-width: 170px;
  max-width: 210px;
  opacity: 0;
  transition: opacity 0.12s;
}
.spark-tooltip.visible { opacity: 1; display: block; }
.spark-tooltip.hidden { display: none; }
.stip-name { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stip-price { font-size: 0.95rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.stip-label { font-size: 0.68rem; color: var(--text-muted); margin-top: 5px; text-align: right; }
.stip-loading { font-size: 0.78rem; color: var(--text-muted); padding: 10px 0; }

/* ---- RESULT CHART ---- */
.result-chart {
  margin: 18px 0 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px 8px;
  overflow: hidden;
}
.result-chart-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}
.result-chart svg { display: block; width: 100%; height: auto; }

/* ---- COMMODITY / FX TILES ---- */
.commodities-section {
  padding: 0 20px 32px;
}
.commodities-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

/* ---- INFO SECTION ---- */
.info-section { padding: 40px 20px 56px; }
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.info-icon { font-size: 2rem; margin-bottom: 12px; }
.info-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.info-card p { font-size: 0.88rem; color: var(--text-muted); line-height: 1.6; }

/* ---- FOOTER ---- */
.footer {
  background: var(--bg-card2);
  border-top: 1px solid var(--border);
  padding: 40px 20px;
  text-align: center;
}
.footer-inner { max-width: 760px; margin: 0 auto; }
.footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.2rem;
  margin-bottom: 12px;
}
.footer-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
}
.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 16px;
}
.footer-links a {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--text); }
.footer-copy { font-size: 0.78rem; color: var(--text-muted); }

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
  .hero { padding: 40px 16px 32px; }
  .hero h1 { font-size: 1.8rem; }
  .search-box { padding: 6px 6px 6px 14px; }
  .btn-primary { padding: 10px 16px; font-size: 0.88rem; }
  .movers-grid { grid-template-columns: 1fr; }
  .result-header { flex-direction: column; }
  .result-price-wrap { text-align: left; }
  .result-price { font-size: 1.6rem; }
  .indices-grid { grid-template-columns: repeat(2, 1fr); }
  .popular-grid { grid-template-columns: repeat(2, 1fr); }
}
