/* =============================================
   Java Mastery – Global Stylesheet
   ============================================= */

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-card: #16161f;
  --bg-card-hover: #1e1e2a;
  --bg-sidebar: #0d0d15;
  --text-primary: #f0f0ff;
  --text-secondary: #9494b0;
  --text-muted: #5a5a72;
  --accent-1: #6366f1;
  --accent-2: #8b5cf6;
  --accent-3: #06b6d4;
  --accent-4: #10b981;
  --accent-5: #f59e0b;
  --border: rgba(99, 102, 241, 0.15);
  --border-light: rgba(255,255,255,0.06);
  --code-bg: #0d1117;
  --code-border: rgba(99,102,241,0.25);
  --sidebar-width: 280px;
  --topbar-height: 64px;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.5);
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Animated Background ─── */
.bg-particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg-particles::before,
.bg-particles::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  animation: drift 15s ease-in-out infinite alternate;
}
.bg-particles::before {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
  top: -200px; left: -200px;
}
.bg-particles::after {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(6,182,212,0.10) 0%, transparent 70%);
  bottom: -200px; right: -200px;
  animation-delay: -7s;
}
@keyframes drift {
  from { transform: translate(0,0) scale(1); }
  to { transform: translate(60px, 40px) scale(1.1); }
}

/* ─── Sidebar ─── */
.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform var(--transition);
  backdrop-filter: blur(20px);
}
.sidebar.open { transform: translateX(0); }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-light);
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 26px; }
.logo-text {
  font-size: 17px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar-close {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  width: 30px; height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
}
.sidebar-close:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 16px 8px 6px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
}
.nav-link:hover {
  background: rgba(99,102,241,0.12);
  color: var(--text-primary);
  transform: translateX(4px);
}
.nav-link.active { background: rgba(99,102,241,0.2); color: var(--accent-1); }
.nav-icon { font-size: 16px; width: 22px; text-align: center; }

/* ─── Overlay ─── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.overlay.active { opacity: 1; pointer-events: all; }

/* ─── Main Wrapper ─── */
.main-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

/* ─── Topbar ─── */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 32px;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
  z-index: 100;
}
.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: var(--transition);
}
.hamburger:hover span { background: var(--accent-1); }
.topbar-title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
}
.topbar-badge {
  font-size: 12px;
  font-weight: 700;
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.3);
  color: var(--accent-1);
  padding: 4px 12px;
  border-radius: 100px;
}

/* ─── Dashboard Button (topic pages) ─── */
.dashboard-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(139,92,246,0.18));
  border: 1px solid rgba(99,102,241,0.35);
  color: #a5b4fc;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 100px;
  text-decoration: none;
  letter-spacing: 0.3px;
  transition: var(--transition);
  box-shadow: 0 0 0 0 rgba(99,102,241,0);
  white-space: nowrap;
}
.dashboard-btn::before {
  content: '⌂';
  font-size: 14px;
  line-height: 1;
}
.dashboard-btn:hover {
  background: linear-gradient(135deg, rgba(99,102,241,0.32), rgba(139,92,246,0.32));
  border-color: rgba(99,102,241,0.6);
  color: #c7d2fe;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99,102,241,0.28);
}
.dashboard-btn:active { transform: translateY(0); }
@media (max-width: 480px) { .dashboard-btn { display: none; } }

/* ─── Hero ─── */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  padding: 80px 60px 100px;
  max-width: 1300px;
  margin: 0 auto;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--accent-3);
  background: rgba(6,182,212,0.1);
  border: 1px solid rgba(6,182,212,0.25);
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 24px;
}
.badge-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-3);
  box-shadow: 0 0 8px var(--accent-3);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.6;transform:scale(0.85)} }

.hero-title {
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1px;
  margin-bottom: 20px;
}
.gradient-text {
  background: linear-gradient(135deg, #6366f1, #8b5cf6, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: 17px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 36px;
  max-width: 480px;
}
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 48px; }
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border-radius: 100px;
  text-decoration: none;
  transition: var(--transition);
  box-shadow: 0 8px 24px rgba(99,102,241,0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(99,102,241,0.5); }
.btn-arrow { font-size: 18px; transition: transform var(--transition); }
.btn-primary:hover .btn-arrow { transform: translateX(4px); }
.btn-secondary {
  display: inline-flex;
  align-items: center;
  padding: 14px 28px;
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  border-radius: 100px;
  text-decoration: none;
  border: 1px solid var(--border-light);
  transition: var(--transition);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); transform: translateY(-2px); }

.hero-stats { display: flex; align-items: center; gap: 24px; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-num { font-size: 28px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat-divider { width: 1px; height: 40px; background: var(--border-light); }

/* Hero Visual */
.hero-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.code-window {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(99,102,241,0.1);
  width: 100%;
  max-width: 460px;
  animation: floatCard 6s ease-in-out infinite;
}
@keyframes floatCard { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }
.window-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--code-border);
}
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.red { background: #ff5f57; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #28c840; }
.window-title { font-size: 12px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; margin-left: 8px; }
.hero-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.8;
  padding: 24px;
  color: #cdd6f4;
  white-space: pre;
  overflow-x: auto;
}
.hero-code .kw { color: #cba6f7; font-weight: 600; }
.hero-code .cls { color: #89dceb; }
.hero-code .str { color: #a6e3a1; }
.hero-code .num { color: #fab387; }
.hero-code .cm { color: #6c7086; font-style: italic; }

.floating-badge {
  position: absolute;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 100px;
  background: rgba(16,16,28,0.9);
  border: 1px solid var(--border-light);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
  animation: floatBadge 4s ease-in-out infinite alternate;
}
.badge1 { top: 20px; right: -20px; animation-delay: 0s; }
.badge2 { bottom: 60px; right: -30px; animation-delay: 1.5s; }
.badge3 { bottom: 20px; left: -10px; animation-delay: 0.8s; }
@keyframes floatBadge { from{transform:translateY(0)} to{transform:translateY(-12px)} }

/* ─── Topics Section ─── */
.topics-section {
  padding: 60px;
  max-width: 1300px;
  margin: 0 auto;
}
.section-header { text-align: center; margin-bottom: 50px; }
.section-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
}
.section-subtitle { color: var(--text-secondary); font-size: 16px; }
.track-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 6px 16px;
  border-radius: 100px;
  border: 1px solid;
  margin-bottom: 14px;
}

.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.topic-group-label {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 20px 0 4px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 4px;
}
.topic-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.topic-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--card-color, var(--accent-1));
  opacity: 0;
  transition: opacity var(--transition);
}
.topic-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(99,102,241,0.3);
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.3);
}
.topic-card:hover::before { opacity: 1; }
.card-icon {
  font-size: 28px;
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  flex-shrink: 0;
  transition: var(--transition);
}
.topic-card:hover .card-icon {
  background: rgba(99,102,241,0.15);
  transform: scale(1.1);
}
.card-content { flex: 1; }
.card-content h3 { font-size: 14.5px; font-weight: 700; margin-bottom: 4px; }
.card-content p { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.card-arrow {
  font-size: 18px;
  color: var(--text-muted);
  transition: var(--transition);
}
.topic-card:hover .card-arrow { color: var(--card-color, var(--accent-1)); transform: translateX(4px); }

/* ─── Footer ─── */
.footer {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
  border-top: 1px solid var(--border-light);
}

/* ─── Topic Page Styles ─── */
.topic-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 60px 40px;
}
.topic-header {
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border-light);
}
.topic-breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.topic-breadcrumb a { color: var(--accent-1); text-decoration: none; }
.topic-breadcrumb a:hover { text-decoration: underline; }

.topic-title {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.5px;
  margin-bottom: 14px;
}
.topic-desc {
  font-size: 17px;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* Content sections */
.content-section {
  margin-bottom: 60px;
}
.content-section h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.content-section h2::before {
  content: '';
  display: block;
  width: 4px;
  height: 24px;
  background: linear-gradient(to bottom, var(--accent-1), var(--accent-3));
  border-radius: 2px;
  flex-shrink: 0;
}
.content-section h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 28px 0 12px;
  color: var(--accent-3);
}
.content-section p {
  font-size: 15.5px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.content-section ul, .content-section ol {
  padding-left: 24px;
  margin-bottom: 20px;
}
.content-section li {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.content-section li strong { color: var(--text-primary); }

/* Info boxes */
.info-box {
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 24px 0;
  border-left: 4px solid;
  font-size: 14.5px;
  line-height: 1.7;
}
.info-box.note { background: rgba(6,182,212,0.08); border-color: var(--accent-3); color: #7dd3f0; }
.info-box.tip { background: rgba(16,185,129,0.08); border-color: var(--accent-4); color: #6ee7b7; }
.info-box.warning { background: rgba(245,158,11,0.08); border-color: var(--accent-5); color: #fcd34d; }
.info-box strong { display: block; font-size: 13px; font-weight: 700; letter-spacing: 0.5px; margin-bottom: 6px; text-transform: uppercase; }

/* Code blocks */
.code-block {
  margin: 24px 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--code-border);
  box-shadow: var(--shadow);
}
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--code-border);
  font-size: 12px;
}
.code-file { font-family: 'JetBrains Mono', monospace; color: var(--text-muted); }
.code-lang { color: var(--accent-1); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.copy-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: var(--transition);
}
.copy-btn:hover { background: rgba(99,102,241,0.15); color: var(--accent-1); border-color: rgba(99,102,241,0.3); }
.copy-btn.copied { color: var(--accent-4); border-color: rgba(16,185,129,0.4); }
pre.code-content {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px;
  line-height: 1.8;
  padding: 24px;
  background: var(--code-bg);
  color: #cdd6f4;
  overflow-x: auto;
  white-space: pre;
  margin: 0;
}

/* Syntax highlighting */
.kw { color: #cba6f7; font-weight: 600; }
.cls { color: #89dceb; }
.str { color: #a6e3a1; }
.num { color: #fab387; }
.cm { color: #6c7086; font-style: italic; }
.fn { color: #89b4fa; }
.op { color: #94e2d5; }
.ann { color: #f38ba8; }

/* Output box */
.output-box {
  background: #050811;
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 8px 0 24px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.8;
  color: #a6e3a1;
}
.output-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-4);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.output-label::before { content: '▶'; font-size: 9px; }

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}
.data-table th {
  background: rgba(99,102,241,0.12);
  color: var(--accent-1);
  padding: 12px 16px;
  text-align: left;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.03); }

/* Navigation between topics */
.topic-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 60px;
  padding-top: 32px;
  border-top: 1px solid var(--border-light);
}
.topic-nav-btn {
  flex: 1;
  padding: 16px 20px;
  border-radius: var(--radius);
  text-decoration: none;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 12px;
}
.topic-nav-btn.next { justify-content: flex-end; text-align: right; }
.topic-nav-btn:hover {
  border-color: rgba(99,102,241,0.4);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}
.nav-btn-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.nav-btn-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }

/* Responsive */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 50px 24px 70px; gap: 40px; }
  .hero-visual { display: none; }
  .topics-section { padding: 40px 20px; }
  .topic-page { padding: 40px 20px; }
  .topbar { padding: 0 20px; }
}
@media (max-width: 600px) {
  .hero-title { font-size: 28px; }
  .topics-grid { grid-template-columns: 1fr; }
}
