/* ==========================================================================
   WebDev Hinglish - Modern Core Stylesheet
   Zero-framework, high-performance, dark/light CSS tokens and layout
   ========================================================================== */

:root {
  /* Light Theme Color Palette */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-primary-bg: #eff6ff;

  --accent-success: #10b981;
  --accent-success-bg: #ecfdf5;
  --accent-warning: #f59e0b;
  --accent-warning-bg: #fffbeb;
  --accent-danger: #ef4444;
  --accent-danger-bg: #fef2f2;
  --accent-info: #06b6d4;
  --accent-info-bg: #ecfeff;

  --code-bg: #1e293b;
  --code-inline-bg: #f1f5f9;
  --code-inline-color: #0f172a;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --header-height: 64px;
  --sidebar-width: 300px;
  --content-max-width: 1200px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

[data-theme="dark"] {
  /* Dark Theme Color Palette */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  --bg-card: #131d31;
  --bg-hover: #1e293b;
  --border-color: #24324a;
  --border-focus: #60a5fa;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-primary: #3b82f6;
  --accent-primary-hover: #60a5fa;
  --accent-primary-bg: rgba(59, 130, 246, 0.15);

  --accent-success: #10b981;
  --accent-success-bg: rgba(16, 185, 129, 0.15);
  --accent-warning: #f59e0b;
  --accent-warning-bg: rgba(245, 158, 11, 0.15);
  --accent-danger: #f87171;
  --accent-danger-bg: rgba(239, 68, 68, 0.15);
  --accent-info: #38bdf8;
  --accent-info-bg: rgba(56, 189, 248, 0.15);

  --code-bg: #090d16;
  --code-inline-bg: #1e293b;
  --code-inline-color: #f1f5f9;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.7);
}

/* Modern Box-Sizing Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 20px);
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  text-decoration: underline;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.8rem;
}

h1 { font-size: clamp(2rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-top: 2rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.4rem; }
h3 { font-size: clamp(1.2rem, 2vw, 1.45rem); margin-top: 1.5rem; }
h4 { font-size: 1.15rem; margin-top: 1.2rem; }

p {
  margin-bottom: 1.1rem;
  color: var(--text-secondary);
  font-size: 1.05rem;
}

strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Layout Structure */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text-primary);
  text-decoration: none;
}

.header-brand:hover {
  text-decoration: none;
}

.brand-badge {
  background: linear-gradient(135deg, #2563eb, #8a2be2);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-trigger-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.search-trigger-btn:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
}

.kbd-shortcut {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

.theme-toggle-btn, .mobile-menu-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover, .mobile-menu-btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--accent-primary);
}

.mobile-menu-btn {
  display: none;
}

/* Main Documentation / Course Container */
.docs-layout {
  display: flex;
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  position: relative;
}

/* Sidebar Navigation */
.docs-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
  overflow-y: auto;
  padding: 1.5rem 1rem;
  border-right: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  transition: transform var(--transition-normal);
}

.sidebar-progress-widget {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #10b981);
  width: 0%;
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.sidebar-nav-group {
  margin-bottom: 1.5rem;
}

.sidebar-group-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  padding-left: 0.5rem;
}

.sidebar-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.sidebar-link:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.sidebar-link.active {
  background-color: var(--accent-primary-bg);
  color: var(--accent-primary);
  font-weight: 600;
}

.sidebar-link .topic-badge {
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background-color: var(--bg-tertiary);
  color: var(--text-muted);
}

/* Content Area */
.docs-content {
  flex: 1;
  min-width: 0;
  padding: 2rem 3rem 4rem;
  max-width: 900px;
}

/* Breadcrumbs */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--text-muted);
}

.breadcrumb a:hover {
  color: var(--accent-primary);
}

.breadcrumb-sep {
  color: var(--border-color);
}

/* Right Table of Contents (TOC) */
.docs-toc {
  width: 240px;
  min-width: 240px;
  height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
  overflow-y: auto;
  padding: 2rem 1rem;
  border-left: 1px solid var(--border-color);
  display: block;
}

.toc-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.toc-link {
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-decoration: none;
  display: block;
  padding: 2px 0;
  line-height: 1.4;
  transition: color var(--transition-fast);
}

.toc-link:hover {
  color: var(--accent-primary);
  text-decoration: none;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  padding: 3rem 1.5rem;
  margin-top: auto;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
}

.footer-brand h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.footer-brand p {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 340px;
}

.footer-col h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-col a {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-col a:hover {
  color: var(--accent-primary);
}

.footer-bottom {
  max-width: 1200px;
  margin: 2.5rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}
