/* ==========================================================
   Data Engineering Foundations — Shared Styles
   Azure Application Insights dashboard aesthetic
   ========================================================== */

:root {
  --accent: #3b82f6;
  --accent2: #6366f1;
  --accent-pink: #f472b6;
  --radius: 12px;
  --nav-height: 56px;
}

/* ---- LIGHT MODE (default) ---- */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #f0f2f5;
  color: #1e293b;
  transition: background 0.3s ease, color 0.3s ease;
  margin: 0;
  padding-top: var(--nav-height);
}

.card {
  background: #ffffff;
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: none;
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.glass-card {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-radius: 1rem;
  border: 1px solid rgba(99,102,241,0.1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: background 0.3s, border-color 0.3s;
}

.hero-gradient {
  background: linear-gradient(135deg, rgba(59,130,246,0.06) 0%, rgba(244,114,182,0.04) 100%);
}

canvas {
  border-radius: 0.75rem;
  width: 100%;
  height: 400px;
  background: rgba(248,250,252,0.95);
  border: 1px solid #e2e8f0;
}

.glow-indigo { box-shadow: 0 1px 8px rgba(99,102,241,0.1); }
.glow-pink { box-shadow: 0 1px 8px rgba(244,114,182,0.1); }

.data-table th { background: rgba(241,245,249,0.9); color: #475569; }
.data-table td { border-color: #e2e8f0; color: #334155; }

.dataset-btn { background: rgba(241,245,249,0.9) !important; border-color: #e2e8f0 !important; color: #334155 !important; }

.waiting-state {
  background: rgba(248,250,252,0.95);
  border: 1px solid #e2e8f0;
  color: #94a3b8;
}

.tooltip-box .tooltip-text {
  background: #fff;
  color: #475569;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Light mode overrides for tailwind dark classes */
html:not(.dark) .text-slate-200 { color: #1e293b !important; }
html:not(.dark) .text-slate-300 { color: #334155 !important; }
html:not(.dark) .text-slate-400 { color: #64748b !important; }
html:not(.dark) .text-slate-500 { color: #94a3b8 !important; }
html:not(.dark) .text-slate-600 { color: #475569 !important; }
html:not(.dark) .bg-slate-800\/50 { background: rgba(241,245,249,0.8) !important; }
html:not(.dark) .border-slate-700\/50 { border-color: #e2e8f0 !important; }
html:not(.dark) .border-slate-800 { border-color: #e2e8f0 !important; }
html:not(.dark) .border-indigo-500\/10 { border-color: rgba(99,102,241,0.12) !important; }
html:not(.dark) .border-slate-700\/30 { border-color: #e2e8f0 !important; }

/* ---- DARK MODE ---- */
.dark body {
  background: #0f0f1a;
  color: #e2e8f0;
}

.dark .card {
  background: rgba(30,30,50,0.85);
  border: 1px solid rgba(99,102,241,0.12);
  box-shadow: none;
}

.dark .glass-card {
  background: rgba(30,30,50,0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(99,102,241,0.15);
  box-shadow: none;
}

.dark .hero-gradient {
  background: linear-gradient(135deg, rgba(99,102,241,0.12) 0%, rgba(244,114,182,0.08) 100%);
}

.dark canvas {
  background: rgba(15,15,30,0.8);
  border: none;
}

.dark .glow-indigo { box-shadow: 0 0 30px rgba(99,102,241,0.15); }
.dark .glow-pink { box-shadow: 0 0 30px rgba(244,114,182,0.15); }

.dark .data-table th { background: rgba(30,30,60,0.8); color: #94a3b8; }
.dark .data-table td { border-color: rgba(100,116,139,0.15); color: #cbd5e1; }

.dark .dataset-btn { background: rgba(30,30,50,0.8) !important; border-color: rgba(100,116,139,0.3) !important; color: #cbd5e1 !important; }

.dark .waiting-state {
  background: rgba(15,15,30,0.8);
  border: none;
  color: #64748b;
}

.dark .tooltip-box .tooltip-text {
  background: #1e1e3a;
  color: #cbd5e1;
  border: 1px solid rgba(99,102,241,0.2);
  box-shadow: none;
}

/* ---- SHARED ELEMENTS ---- */

/* Nav bar */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(100,116,139,0.18);
  background: rgba(255,255,255,0.96);
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
  transition: background 0.3s, border-color 0.3s;
}

.dark .site-nav {
  background: rgba(10,10,25,0.97);
  border-bottom-color: rgba(99,102,241,0.18);
  box-shadow: 0 1px 8px rgba(0,0,0,0.3);
}

.site-nav .nav-brand {
  font-weight: 800;
  font-size: 0.95rem;
  white-space: nowrap;
  margin-right: 1.5rem;
  color: #1e293b;
  text-decoration: none;
  flex-shrink: 0;
}
.dark .site-nav .nav-brand { color: #f1f5f9; }

.site-nav .nav-links {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  overflow-x: auto;
  flex: 1;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.site-nav .nav-links::-webkit-scrollbar { display: none; }

.site-nav .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  color: #334155;
  transition: background 0.15s, color 0.15s;
}
.site-nav .nav-link:hover {
  background: rgba(59,130,246,0.1);
  color: #2563eb;
}
.site-nav .nav-link.active {
  background: rgba(59,130,246,0.14);
  color: #2563eb;
  font-weight: 700;
}
.dark .site-nav .nav-link { color: #cbd5e1; }
.dark .site-nav .nav-link:hover { background: rgba(99,102,241,0.15); color: #c7d2fe; }
.dark .site-nav .nav-link.active { background: rgba(99,102,241,0.2); color: #c7d2fe; font-weight: 700; }

/* Icon-only mode below 860px — show emoji, hide label text */
@media (max-width: 860px) {
  .site-nav .nav-brand span.brand-text { display: none; }
  .site-nav .nav-link .nav-label { display: none; }
  .site-nav .nav-link {
    padding: 0.35rem 0.55rem;
    font-size: 1.1rem;
    gap: 0;
  }
  .site-nav .nav-link.active {
    background: rgba(59,130,246,0.18);
    outline: 2px solid rgba(59,130,246,0.4);
  }
  .dark .site-nav .nav-link.active {
    background: rgba(99,102,241,0.25);
    outline: 2px solid rgba(99,102,241,0.5);
  }
  .site-nav .nav-brand { font-size: 1.2rem; margin-right: 0.5rem; }
}

.site-nav .nav-toggle {
  background: none;
  border: 1px solid rgba(100,116,139,0.25);
  border-radius: 8px;
  padding: 0.3rem 0.6rem;
  font-size: 1.1rem;
  cursor: pointer;
  margin-left: 0.5rem;
  flex-shrink: 0;
  color: #334155;
  transition: border-color 0.2s;
}
.dark .site-nav .nav-toggle { color: #cbd5e1; border-color: rgba(100,116,139,0.35); }
.site-nav .nav-toggle:hover { border-color: rgba(59,130,246,0.5); }

/* Dataset & Size buttons */
.dataset-btn.active { border-color: #6366f1 !important; background: rgba(99,102,241,0.15) !important; }
.size-btn.active { border-color: #6366f1 !important; background: rgba(99,102,241,0.2) !important; color: #a5b4fc !important; font-weight: 700; }
.tab-btn.active { background: #6366f1 !important; color: white !important; }

/* Metric values */
.metric-value { font-variant-numeric: tabular-nums; }

/* Code blocks */
pre[class*="language-"] { border-radius: 0.75rem !important; margin: 0 !important; font-size: 0.82rem !important; max-height: 500px; overflow: auto; }
code[class*="language-"] { font-size: 0.82rem !important; }

/* Noise points — RED for anomalies */
.noise-point { color: #ef4444; }

/* Range inputs */
input[type=range] { accent-color: #6366f1; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.4s ease-out; }

/* Badge */
.badge-algo {
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  text-transform: uppercase;
}

/* Data table */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.data-table th { padding: 6px 10px; text-align: left; font-weight: 600; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; position: sticky; top: 0; z-index: 1; }
.data-table td { padding: 4px 10px; border-bottom: 1px solid; }
.data-table-container { max-height: 280px; overflow: auto; border-radius: 0.5rem; }

/* Tooltips */
.tooltip-box { position: relative; display: inline-flex; align-items: center; cursor: help; }
.tooltip-box .tooltip-text {
  visibility: hidden; opacity: 0;
  position: absolute; bottom: 130%; left: 50%; transform: translateX(-50%);
  padding: 8px 12px; border-radius: 8px; font-size: 0.72rem; line-height: 1.4;
  width: 260px; z-index: 50; transition: opacity 0.2s; pointer-events: none;
}
.tooltip-box:hover .tooltip-text { visibility: visible; opacity: 1; }

/* Run button */
.run-btn { transition: all 0.2s; }
.run-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(99,102,241,0.3); }
.run-btn:active { transform: translateY(0); }
.run-btn.running { animation: pulse 0.8s ease-in-out; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.4); } 50% { box-shadow: 0 0 20px 5px rgba(99,102,241,0.2); } }

.waiting-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 400px;
  width: 100%;
  border-radius: 0.75rem;
}

/* Landing page grid */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
@media (max-width: 768px) {
  .topic-grid { grid-template-columns: 1fr; }
}

.topic-card {
  padding: 1.75rem;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s, box-shadow 0.2s;
  display: block;
}
.topic-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.dark .topic-card:hover {
  box-shadow: 0 4px 20px rgba(99,102,241,0.15);
}

.status-live {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.2rem 0.6rem; border-radius: 999px;
  background: rgba(52,211,153,0.12); color: #34d399;
  font-size: 0.7rem; font-weight: 600;
}
.status-soon {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.2rem 0.6rem; border-radius: 999px;
  background: rgba(251,191,36,0.1); color: #fbbf24;
  font-size: 0.7rem; font-weight: 600;
}
