/* ============================================
   Big Data Analytics – Interactive Learning Site
   Modern Dark Theme
   ============================================ */

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  --bg-card: #161e2e;
  --bg-hover: #1f2940;
  --border: #2d3748;
  --border-light: #374151;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent: #06b6d4;
  --accent-hover: #0891b2;
  --accent-glow: rgba(6, 182, 212, 0.25);
  --accent-2: #8b5cf6;
  --accent-3: #f472b6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --code-bg: #0d1117;
  --gradient-1: linear-gradient(135deg, #06b6d4 0%, #8b5cf6 100%);
  --gradient-2: linear-gradient(135deg, #f472b6 0%, #8b5cf6 100%);
  --gradient-card: linear-gradient(135deg, rgba(6, 182, 212, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 24px var(--accent-glow);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated background gradient */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(6, 182, 212, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(244, 114, 182, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ============== NAVIGATION ============== */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.logo-icon { font-size: 1.6rem; }

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s;
  cursor: pointer;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
}

.nav-link:hover, .nav-link.active {
  color: var(--accent);
  background: var(--accent-glow);
}

/* ============== LAYOUT ============== */

.app {
  display: flex;
  min-height: calc(100vh - 65px);
  position: relative;
  z-index: 1;
}

.sidebar {
  width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 2rem 1rem;
  position: sticky;
  top: 65px;
  height: calc(100vh - 65px);
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-section {
  margin-bottom: 2rem;
}

.sidebar-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.8rem;
  padding: 0 0.6rem;
}

.sidebar-link {
  display: block;
  padding: 0.6rem 0.8rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
  cursor: pointer;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: var(--bg-hover);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}

.sidebar-link .lecture-num {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 0.5rem;
  font-weight: 600;
}

.sidebar-link.active .lecture-num { color: var(--accent); }

.main {
  flex: 1;
  padding: 2.5rem 3rem;
  max-width: 1100px;
  width: 100%;
}

/* ============== HERO ============== */

.hero {
  text-align: center;
  padding: 3rem 0 4rem;
  position: relative;
}

.hero h1 {
  font-size: 3.2rem;
  font-weight: 800;
  margin-bottom: 1rem;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.hero .subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto 2rem;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.stat {
  text-align: center;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  display: block;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============== CARDS / GRID ============== */

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 2rem;
}

.lecture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.lecture-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.6rem;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.lecture-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-1);
  opacity: 0;
  transition: opacity 0.3s;
}

.lecture-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.lecture-card:hover::before { opacity: 1; }

.lecture-card-num {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.lecture-card-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  color: var(--text-primary);
}

.lecture-card-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.lecture-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.72rem;
  border: 1px solid var(--border);
}

/* ============== CONTENT (LECTURE PAGES) ============== */

.lecture-page {
  display: none;
}

.lecture-page.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.breadcrumb a:hover { text-decoration: underline; }

.lecture-page h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.15;
}

.lecture-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.lecture-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.lecture-page h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.lecture-page h2::before {
  content: '';
  width: 4px;
  height: 24px;
  background: var(--gradient-1);
  border-radius: 2px;
}

.lecture-page h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 1.5rem 0 0.7rem;
  color: var(--accent);
}

.lecture-page p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.7;
}

.lecture-page ul, .lecture-page ol {
  color: var(--text-secondary);
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.lecture-page li {
  margin-bottom: 0.4rem;
  line-height: 1.6;
}

.lecture-page strong { color: var(--text-primary); }

/* Callout boxes */
.callout {
  padding: 1rem 1.2rem;
  border-radius: 10px;
  margin: 1.2rem 0;
  border-left: 4px solid;
  background: var(--bg-card);
}

.callout-info {
  border-color: var(--accent);
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.08), transparent);
}

.callout-warning {
  border-color: var(--warning);
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.08), transparent);
}

.callout-success {
  border-color: var(--success);
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.08), transparent);
}

.callout-tip {
  border-color: var(--accent-2);
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.08), transparent);
}

.callout-title {
  font-weight: 700;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-primary);
}

/* Code blocks */
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  margin: 1rem 0;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  position: relative;
}

pre code {
  color: #e5e7eb;
  background: none;
  font-family: inherit;
}

code {
  background: var(--bg-tertiary);
  color: var(--accent);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.85em;
  border: 1px solid var(--border);
}

.code-keyword { color: #c084fc; }
.code-string { color: #86efac; }
.code-comment { color: #64748b; font-style: italic; }
.code-number { color: #fbbf24; }
.code-function { color: #60a5fa; }

/* Tables */
.table-wrapper {
  overflow-x: auto;
  margin: 1.2rem 0;
  border-radius: 10px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
}

th, td {
  padding: 0.8rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

th {
  background: var(--bg-tertiary);
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

td { color: var(--text-secondary); }

tr:last-child td { border-bottom: none; }

tr:hover td { background: var(--bg-hover); }

/* Two-column layout */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin: 1rem 0;
}

@media (max-width: 768px) {
  .two-col { grid-template-columns: 1fr; }
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.2rem;
}

.info-card h4 {
  color: var(--accent);
  font-size: 1rem;
  margin-bottom: 0.6rem;
}

/* Visual diagrams container */
.diagram-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  text-align: center;
}

.diagram-container svg {
  max-width: 100%;
  height: auto;
}

.diagram-caption {
  margin-top: 0.8rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ============== QUIZ ============== */

.quiz-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.8rem;
  margin: 2rem 0;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.quiz-title {
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quiz-progress {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.quiz-question {
  font-size: 1.05rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-weight: 500;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.quiz-option {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.8rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
  text-align: left;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.quiz-option:hover:not(.disabled) {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.quiz-option .option-letter {
  background: var(--bg-primary);
  color: var(--accent);
  font-weight: 600;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.quiz-option.correct {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.12);
}
.quiz-option.correct .option-letter {
  background: var(--success);
  color: white;
}

.quiz-option.incorrect {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.12);
}
.quiz-option.incorrect .option-letter {
  background: var(--danger);
  color: white;
}

.quiz-option.disabled { cursor: default; }

.quiz-feedback {
  padding: 0.8rem 1rem;
  border-radius: 8px;
  margin-top: 0.8rem;
  font-size: 0.9rem;
  display: none;
}

.quiz-feedback.show { display: block; }

.quiz-feedback.correct {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid var(--success);
  color: #6ee7b7;
}

.quiz-feedback.incorrect {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid var(--danger);
  color: #fca5a5;
}

.quiz-buttons {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.btn {
  background: var(--gradient-1);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.btn-secondary:hover { background: var(--bg-hover); }

/* Quiz score screen */
.quiz-result {
  text-align: center;
  padding: 1.5rem;
}

.quiz-score {
  font-size: 3.5rem;
  font-weight: 800;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0.5rem 0;
}

.quiz-score-label {
  font-size: 1rem;
  color: var(--text-muted);
}

/* ============== GLOSSARY / FLASHCARDS ============== */

.glossary-controls {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.flashcard {
  perspective: 1000px;
  height: 180px;
  cursor: pointer;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.5s;
}

.flashcard.flipped .flashcard-inner {
  transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px solid var(--border);
}

.flashcard-front {
  background: var(--bg-card);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent);
}

.flashcard-back {
  background: var(--bg-secondary);
  transform: rotateY(180deg);
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  overflow-y: auto;
}

.flashcard-category {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  font-size: 0.65rem;
  background: var(--bg-tertiary);
  padding: 0.15rem 0.5rem;
  border-radius: 8px;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ============== SEARCH ============== */

.search-bar {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-bar input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem 0.9rem 2.8rem;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.2s;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-bar::before {
  content: '🔍';
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.search-result {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  cursor: pointer;
  transition: all 0.15s;
}

.search-result:hover {
  border-color: var(--accent);
  transform: translateX(4px);
}

.search-result-title {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.search-result-context {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.search-result-lecture {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.search-result mark {
  background: rgba(6, 182, 212, 0.3);
  color: var(--accent);
  padding: 0 2px;
  border-radius: 2px;
}

/* ============== FILTER BUTTONS ============== */

.filter-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover { background: var(--bg-hover); }

.filter-btn.active {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
  font-weight: 600;
}

/* ============== FOOTER ============== */

.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

/* ============== MOBILE / RESPONSIVE ============== */

.menu-toggle {
  display: none;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.2rem;
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: -300px;
    transition: left 0.3s;
    z-index: 99;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { left: 0; }
  .menu-toggle { display: inline-flex; }
  .main { padding: 1.5rem; }
  .hero h1 { font-size: 2.2rem; }
  .nav-links a:not(.menu-toggle) { display: none; }
}

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* Diagram styling helpers */
.svg-node {
  fill: var(--bg-card);
  stroke: var(--accent);
  stroke-width: 2;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}
.svg-node-alt {
  fill: var(--bg-tertiary);
  stroke: var(--accent-2);
}
.svg-text {
  fill: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  text-anchor: middle;
  dominant-baseline: middle;
  font-family: 'Inter', sans-serif;
}
.svg-label {
  fill: var(--text-muted);
  font-size: 11px;
  text-anchor: middle;
  font-family: 'Inter', sans-serif;
}
.svg-edge { stroke: var(--text-muted); stroke-width: 1.5; fill: none; }
.svg-arrow { fill: var(--text-muted); }
.svg-edge-accent { stroke: var(--accent); stroke-width: 2; fill: none; }

/* Highlight animation for nav-jumps */
@keyframes highlight {
  0% { background: var(--accent-glow); }
  100% { background: transparent; }
}
.highlight { animation: highlight 1.5s ease; }

/* Print friendly hidden elements */
@media print {
  .sidebar, .navbar { display: none; }
  .main { max-width: 100%; padding: 0; }
}
