@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800;900&family=Fira+Code:wght@400;500&display=swap');

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #0f0f18;
  --bg-card: #141420;
  --sidebar-bg: #0c0c14;
  --sidebar-hover: #1a1a2e;
  --danger: #dc3545;
  --danger-glow: rgba(220, 53, 69, 0.25);
  --danger-subtle: rgba(220, 53, 69, 0.08);
  --text-primary: #e8e8e8;
  --text-secondary: #b0b0c8;
  --text-muted: #7878a0;
  --border-color: rgba(255,255,255,0.04);
  --border-active: rgba(220, 53, 69, 0.3);
  --gradient: linear-gradient(135deg, #dc3545, #ff6b6b);
  --sidebar-width: 300px;
  --navbar-height: 56px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

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

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--danger); border-radius: 3px; }

/* === LOADER === */
.loader {
  position: fixed; inset: 0;
  background: var(--bg-primary);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}
.loader.hidden { opacity: 0; visibility: hidden; }
.loader-content { text-align: center; }
.cyber-lock { font-size: 3rem; color: var(--danger); animation: pulseLock 1.5s ease-in-out infinite; }
@keyframes pulseLock { 0%,100% { transform: scale(1); opacity:1; } 50% { transform: scale(1.2); opacity:0.7; } }
.loader-bar { width:200px; height:3px; background:var(--bg-card); border-radius:2px; margin-top:1rem; overflow:hidden; }
.loader-fill { width:0%; height:100%; background:var(--gradient); border-radius:2px; animation:loadFill 1.8s ease forwards; }
@keyframes loadFill { to { width:100%; } }
.loader-text { color:var(--text-muted); font-family:'Fira Code',monospace; font-size:0.85rem; }

/* === NAVBAR === */
#mainNav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-height);
  background: rgba(10,10,15,0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  z-index: 1000;
  display: flex;
  align-items: center;
}
.navbar { padding: 0 1.5rem; width: 100%; height: 100%; }
#mainNav .navbar-brand { color: var(--danger); font-size: 1.2rem; letter-spacing: 1px; font-weight: 800; }
#mainNav .nav-link { color: var(--text-muted); font-size: 0.85rem; transition: color 0.3s; padding: 0.5rem 1rem; }
#mainNav .nav-link:hover, #mainNav .nav-link.active { color: var(--danger); }

/* === HERO === */
.hero-section {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.hero-overlay {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(220,53,69,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(220,53,69,0.05) 0%, transparent 50%);
  pointer-events: none;
}
.hero-content { position: relative; z-index: 2; padding-top: 80px; }
.pulse-badge { animation: badgePulse 2s ease-in-out infinite; padding: 8px 18px; font-weight:600; letter-spacing:1px; }
@keyframes badgePulse { 0%,100% { box-shadow:0 0 0 0 var(--danger-glow); } 50% { box-shadow:0 0 0 10px transparent; } }
.hero-title { line-height: 1.1; }
.glitch { position: relative; color: var(--text-primary); }
.glitch::before, .glitch::after { content: attr(data-text); position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; }
.glitch:hover::before { color: var(--danger); animation: glitch1 0.4s ease; opacity: 0.8; }
.glitch:hover::after { color: #ff6b6b; animation: glitch2 0.4s ease; opacity: 0.8; }
@keyframes glitch1 { 0% { transform:translate(0); } 20% { transform:translate(-2px,2px); } 40% { transform:translate(2px,-2px); } 60% { transform:translate(-1px,-1px); } 80% { transform:translate(1px,2px); } 100% { transform:translate(0); } }
@keyframes glitch2 { 0% { transform:translate(0); } 20% { transform:translate(2px,-2px); } 40% { transform:translate(-2px,2px); } 60% { transform:translate(1px,1px); } 80% { transform:translate(-1px,-2px); } 100% { transform:translate(0); } }
.text-gradient { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-desc { color: var(--text-muted); max-width: 600px; line-height: 1.8; }
.hero-visual { position: relative; display: flex; align-items: center; justify-content: center; height: 400px; }
.hero-icon { font-size: 6rem; color: var(--danger); animation: floatIcon 4s ease-in-out infinite; filter: drop-shadow(0 0 30px var(--danger-glow)); }
@keyframes floatIcon { 0%,100% { transform:translateY(0); } 50% { transform:translateY(-15px); } }
.orbit-ring { position: absolute; width:300px; height:300px; border:1px solid rgba(220,53,69,0.1); border-radius:50%; animation:orbitSpin 8s linear infinite; }
.orbit-ring::before { content:''; position:absolute; top:-4px; left:50%; width:8px; height:8px; background:var(--danger); border-radius:50%; box-shadow:0 0 15px var(--danger-glow); }
.orbit-ring-2 { position: absolute; width:380px; height:380px; border:1px solid rgba(220,53,69,0.05); border-radius:50%; animation:orbitSpin 12s linear infinite reverse; }
.orbit-ring-2::before { content:''; position:absolute; bottom:-4px; right:40%; width:6px; height:6px; background:var(--danger); border-radius:50%; opacity:0.5; }
@keyframes orbitSpin { from { transform:rotate(0deg); } to { transform:rotate(360deg); } }
.scroll-indicator { position:absolute; bottom:30px; left:50%; transform:translateX(-50%); z-index:2; }
.mouse { width:26px; height:42px; border:2px solid rgba(255,255,255,0.1); border-radius:13px; position:relative; }
.wheel { width:4px; height:8px; background:var(--danger); border-radius:2px; position:absolute; top:8px; left:50%; transform:translateX(-50%); animation:scrollWheel 2s ease-in-out infinite; }
@keyframes scrollWheel { 0% { opacity:1; transform:translateX(-50%) translateY(0); } 100% { opacity:0; transform:translateX(-50%) translateY(15px); } }
.hero-buttons .btn { padding:12px 30px; font-weight:600; border-radius:8px; transition:all 0.3s; }
.hero-buttons .btn-danger { background:var(--gradient); border:none; box-shadow:0 4px 20px var(--danger-glow); }
.hero-buttons .btn-danger:hover { transform:translateY(-2px); box-shadow:0 8px 30px rgba(220,53,69,0.4); }
.hero-buttons .btn-outline-light { border:1px solid rgba(255,255,255,0.15); }
.hero-buttons .btn-outline-light:hover { background:rgba(255,255,255,0.05); border-color:var(--danger); color:var(--danger); }
.reveal { opacity:0; transform:translateY(30px); transition:all 0.6s; }
.reveal.visible { opacity:1; transform:translateY(0); }

/* === ABOUT SECTION === */
.about-section { background: var(--bg-secondary); padding: 5rem 0; }
.section-title { font-size: 2rem; font-weight: 800; }
.divider { width:60px; height:3px; background:var(--gradient); margin:1rem auto; border-radius:2px; }
.about-card { background:var(--bg-card); padding:2rem; border-radius:16px; border:1px solid rgba(255,255,255,0.03); transition:all 0.4s; height:100%; position:relative; overflow:hidden; }
.about-card::before { content:''; position:absolute; top:0; left:0; right:0; height:3px; background:var(--gradient); transform:scaleX(0); transform-origin:left; transition:transform 0.4s; }
.about-card:hover::before { transform:scaleX(1); }
.about-card:hover { transform:translateY(-5px); border-color:var(--border-active); box-shadow:0 10px 40px rgba(220,53,69,0.08); }
.about-icon { font-size:2.2rem; color:var(--danger); margin-bottom:1rem; }
.about-card h4 { font-weight:700; margin-bottom:0.8rem; }
.about-card p { color:var(--text-muted); font-size:0.9rem; line-height:1.7; }

/* === FULL-SCREEN CHAPTERS LAYOUT === */
.chapters-section {
  display: flex;
  width: 100%;
  height: calc(100vh - var(--navbar-height));
  margin-top: var(--navbar-height);
  overflow: hidden;
  background: var(--bg-primary);
}

/* Sidebar */
.chapters-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100%;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-header {
  padding: 1.2rem 1.2rem 0.8rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.sidebar-header h5 {
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}
.sidebar-header h5 i { color: var(--danger); }
.chapter-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}
.chapter-item { margin-bottom: 0; }
.chapter-header {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.7rem 1.2rem;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-left: 3px solid transparent;
  letter-spacing: 0.3px;
}
.chapter-header:hover {
  background: var(--danger-subtle);
  color: var(--danger);
  border-left-color: var(--danger);
}
.chapter-header .bi-chevron-down {
  transition: transform 0.3s;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.chapter-header.active .bi-chevron-down { transform: rotate(180deg); }
.chapter-header.active {
  color: var(--danger);
  border-left-color: var(--danger);
  background: var(--danger-subtle);
}
.subtitle-list { border-bottom: 1px solid var(--border-color); }
.subtitle-item {
  display: block;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.55rem 1.2rem 0.55rem 2.2rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  text-align: left;
  border-left: 3px solid transparent;
  position: relative;
}
.subtitle-item:hover {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.02);
  border-left-color: rgba(220,53,69,0.2);
}
.subtitle-item.active {
  color: var(--danger);
  border-left-color: var(--danger);
  background: var(--danger-subtle);
}
.subtitle-item::before {
  content: '>';
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  opacity: 0.4;
  font-family: 'Fira Code', monospace;
  font-size: 0.7rem;
}
.subtitle-item.active::before { color: var(--danger); opacity: 1; }

/* Content Area */
.chapters-content {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  background: var(--bg-primary);
}
.content-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 2.5rem;
}
.content-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
}
.content-placeholder i { font-size: 4rem; margin-bottom: 1rem; opacity: 0.3; }
.content-placeholder h4 { font-size: 1.2rem; font-weight: 600; }
.content-placeholder p { font-size: 0.85rem; }

/* Lesson Content Styling */
.lesson-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}
.lesson-header .chapter-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}
.lesson-header h2 {
  font-weight: 800;
  font-size: 1.6rem;
  margin-top: 0.3rem;
}
.lesson-part {
  margin-bottom: 2.5rem;
  padding: 1.8rem;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--danger);
  transition: border-color 0.3s;
}
.lesson-part:hover { border-color: var(--border-active); }
.lesson-part h5 {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 1.2rem;
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.lesson-part p {
  color: var(--text-secondary);
  line-height: 1.9;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.lesson-part p:last-child { margin-bottom: 0; }
.lesson-part strong { color: var(--text-primary); }
.lesson-part em { color: var(--text-muted); }

.lesson-part h6 {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.9rem;
  margin: 1.5rem 0 0.8rem;
}
.lesson-part h6:first-child { margin-top: 0; }

/* Step items */
.step-item {
  padding: 0.8rem 1rem;
  margin-bottom: 0.5rem;
  background: rgba(220,53,69,0.03);
  border-radius: 8px;
  border-left: 3px solid rgba(220,53,69,0.15);
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.7;
}
.step-item strong { color: var(--text-primary); }
.step-item code {
  background: rgba(220,53,69,0.1);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-family: 'Fira Code', monospace;
  font-size: 0.82rem;
  color: var(--danger);
}

/* Code blocks */
.lesson-part pre {
  background: #080810;
  padding: 1.2rem;
  border-radius: 8px;
  font-family: 'Fira Code', monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  overflow-x: auto;
  border: 1px solid rgba(255,255,255,0.04);
  margin: 1rem 0;
}
.lesson-part code {
  font-family: 'Fira Code', monospace;
}
.lesson-part pre code {
  color: #e0e0e0;
  background: transparent;
  padding: 0;
}

/* Lists in content */
.lesson-part ul, .lesson-part ol {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.9;
  padding-left: 1.5rem;
}
.lesson-part li { margin-bottom: 0.3rem; }
.lesson-part li strong { color: var(--text-primary); }

/* Info box */
.info-box {
  background: rgba(220,53,69,0.05);
  border: 1px solid rgba(220,53,69,0.1);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  margin: 1rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
}
.info-box strong { color: var(--danger); }

/* Tag */
.tag {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.tag-red { background: rgba(220,53,69,0.15); color: var(--danger); }
.tag-blue { background: rgba(13,110,253,0.15); color: #6ea8fe; }
.tag-green { background: rgba(25,135,84,0.15); color: #75b798; }

/* Footer */
.footer-section {
  background: var(--bg-secondary);
  padding: 3rem 0 1.5rem;
  border-top: 1px solid var(--border-color);
}
.footer-section h5 { color: var(--text-primary); font-size: 1rem; }
.footer-links { list-style: none; padding: 0; }
.footer-links li { margin-bottom: 0.4rem; }
.footer-links a { color: var(--text-muted); text-decoration: none; font-size: 0.85rem; transition: color 0.3s; }
.footer-links a:hover { color: var(--danger); }
.social-links { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.social-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.02); border-radius: 8px;
  color: var(--text-muted); font-size: 1.1rem;
  text-decoration: none; transition: all 0.3s;
  border: 1px solid rgba(255,255,255,0.04);
}
.social-link:hover { background: var(--danger); color: #fff; transform: translateY(-3px); box-shadow: 0 5px 20px var(--danger-glow); }
.credits { color: var(--text-muted); font-size: 0.85rem; }
.footer-bottom { border-top: 1px solid var(--border-color); }
.sidebar-handle { display: none; }

/* === RESPONSIVE === */
@media (max-width: 1199px) {
  .content-inner { padding: 1.5rem; }
  .lesson-part { padding: 1.2rem; }
}
@media (max-width: 991px) {
  :root { --sidebar-width: 240px; }
  .hero-title { font-size: 2.5rem; }
  .hero-visual { display: none; }
  .hero-desc { max-width: 100%; }
  .chapters-sidebar { width: var(--sidebar-width); min-width: var(--sidebar-width); }
  .content-inner { padding: 1.5rem; }
  .lesson-part { padding: 1.2rem; }
  .footer-section .row { gap: 2rem 0; }
}
@media (max-width: 768px) {
  :root { --sidebar-width: 100%; --navbar-height: 52px; --handle-height: 34px; }
  .chapters-section { position: relative; display: block; }
  .chapters-sidebar {
    position: absolute;
    top: var(--handle-height); left: 0; right: 0;
    z-index: 50;
    width: 100%;
    min-width: 100%;
    height: calc(100% - var(--handle-height));
    max-height: calc(100% - var(--handle-height));
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    transform: translateY(0);
    border-right: none;
  }
  .chapters-sidebar.hidden { transform: translateY(-100%); }
  .sidebar-header { padding: 0.8rem 1rem; }
  .sidebar-header h5 { font-size: 0.75rem; }
  .chapter-header { padding: 0.5rem 1rem; font-size: 0.75rem; }
  .subtitle-item { padding: 0.4rem 1rem 0.4rem 1.8rem; font-size: 0.72rem; }
  .sidebar-handle {
    position: relative;
    z-index: 51;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    height: var(--handle-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.2s, background 0.2s;
  }
  .sidebar-handle:hover { color: var(--danger); background: var(--danger-subtle); }
  .sidebar-handle i { font-size: 0.75rem; transition: transform 0.3s; }
  .chapters-content { height: calc(100% - var(--handle-height)); overflow-y: auto; }
  .content-inner { padding: 0.8rem 0.8rem 1rem; max-width: 100%; }
  .mobile-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    margin-bottom: 0.6rem;
    transition: color 0.2s, border-color 0.2s;
  }
  .mobile-back-btn:hover { color: var(--danger); border-color: var(--border-active); }
  .hero-section { min-height: 90vh; }
  .hero-title { font-size: 2rem; }
  .hero-content { padding-top: 70px; text-align: center; }
  .hero-desc { text-align: center; margin-left: auto; margin-right: auto; }
  .hero-buttons { text-align: center; }
  .hero-buttons .btn { display: block; width: 100%; margin: 0.5rem 0 !important; }
  .hero-buttons .btn-lg { padding: 10px 20px; font-size: 0.9rem; }
  .scroll-indicator { display: none; }
  .about-section { padding: 3rem 0; }
  .section-title { font-size: 1.5rem; }
  .about-card { padding: 1.5rem; }
  .lesson-part { padding: 0.8rem; margin-bottom: 1.2rem; border-left-width: 2px; }
  .lesson-part h5 { font-size: 0.85rem; }
  .lesson-part p, .lesson-part ul, .lesson-part ol { font-size: 0.82rem; }
  .lesson-part pre { padding: 0.7rem; font-size: 0.7rem; margin: 0.6rem -0.3rem; border-radius: 4px; }
  .lesson-part h6 { font-size: 0.82rem; }
  .step-item { font-size: 0.8rem; padding: 0.5rem 0.7rem; }
  .info-box { font-size: 0.78rem; padding: 0.7rem 0.8rem; }
  .content-placeholder i { font-size: 2.5rem; }
  .content-placeholder h4 { font-size: 0.95rem; }
  .footer-section { padding: 2rem 0 1rem; }
  .footer-section .col-lg-4 { margin-bottom: 1rem; }
  .social-links { justify-content: center; }
  .credits { text-align: center; }
  .footer-bottom p { font-size: 0.75rem; }
}
@media (max-width: 480px) {
  :root { --navbar-height: 48px; }
  #mainNav .navbar-brand { font-size: 1rem; }
  .navbar { padding: 0 0.8rem; }
  .navbar-toggler { padding: 0.3rem 0.5rem; font-size: 0.9rem; }
  .hero-title { font-size: 1.6rem; }
  .hero-content { padding-top: 60px; }
  .hero-desc { font-size: 0.9rem; line-height: 1.6; }
  .hero-buttons .btn-lg { padding: 8px 16px; font-size: 0.85rem; }
  .badge { font-size: 0.7rem; }
  .pulse-badge { padding: 5px 12px; }
  .highlight-list { font-size: 0.85rem; }
  .sidebar-header { padding: 0.6rem 0.8rem; }
  .chapter-header { padding: 0.45rem 0.8rem; font-size: 0.7rem; }
  .subtitle-item { padding: 0.4rem 0.8rem 0.4rem 1.5rem; font-size: 0.68rem; }
  .lesson-part { padding: 0.8rem; border-left-width: 2px; }
  .lesson-part pre { padding: 0.6rem; font-size: 0.68rem; }
  .lesson-part h5 { font-size: 0.82rem; }
  .section-title { font-size: 1.3rem; }
  .about-card { padding: 1.2rem; }
  .about-icon { font-size: 1.8rem; }
  .about-card h4 { font-size: 1rem; }
  .about-card p { font-size: 0.82rem; }
  .social-link { width: 32px; height: 32px; font-size: 0.95rem; }
  .footer-section h5 { font-size: 0.85rem; }
  .footer-links a { font-size: 0.78rem; }
}
