/* ==========================================================================
   MANUAL BOOK SIMGOS V2 — Premium Modern Stylesheet
   Designed for RSUD Datoe Binangkang (Desktop & Mobile Responsive)
   ========================================================================== */

/* === CSS VARIABLES (LIGHT THEME DEFAULT) === */
:root {
  /* Colors */
  --primary: #0f766e; /* Teal-700 */
  --primary-light: #14b8a6; /* Teal-500 */
  --primary-dark: #115e59; /* Teal-800 */
  --accent: #0d9488; /* Teal-600 */
  --accent2: #2563eb; /* Blue-600 */
  --bg-dark: #f8fafc; /* Slate-50 */
  --bg-card: #ffffff; /* White */
  --bg-sidebar: #f1f5f9; /* Slate-100 */
  --bg-main: #f8fafc;
  --text-primary: #0f172a; /* Slate-900 */
  --text-secondary: #475569; /* Slate-600 */
  --text-muted: #64748b; /* Slate-500 */
  --border: #e2e8f0; /* Slate-200 */
  --border-light: #cbd5e1; /* Slate-300 */
  --success: #16a34a; /* Green-600 */
  --warning: #ca8a04; /* Yellow-600 */
  --danger: #dc2626; /* Red-600 */
  --info: #2563eb; /* Blue-600 */
  
  /* Badges color bg */
  --badge-bg-info: rgba(37, 99, 235, 0.1);
  --badge-bg-success: rgba(22, 163, 74, 0.1);
  --badge-bg-warning: rgba(202, 138, 4, 0.1);
  --badge-bg-danger: rgba(220, 38, 38, 0.1);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03), 0 10px 15px -3px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 16px rgba(15, 118, 110, 0.15);

  /* Layout */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --sidebar-width: 280px;
  --topnav-height: 64px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Fonts */
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-ui: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Consolas, monospace;
}

/* === CSS VARIABLES (DARK THEME OVERRIDE) === */
[data-theme="dark"] {
  --primary: #14b8a6; /* Teal-500 */
  --primary-light: #2dd4bf; /* Teal-400 */
  --primary-dark: #0f766e; /* Teal-700 */
  --accent: #2dd4bf;
  --accent2: #3b82f6; /* Blue-500 */
  --bg-dark: #090d16; /* Dark Obsidian Space */
  --bg-card: #111827; /* Slate-900 */
  --bg-sidebar: #0b0f19; /* Darker Slate-950 */
  --bg-main: #090d16;
  --text-primary: #f8fafc; /* Slate-50 */
  --text-secondary: #94a3b8; /* Slate-400 */
  --text-muted: #64748b; /* Slate-500 */
  --border: #1e293b; /* Slate-800 */
  --border-light: #334155; /* Slate-700 */
  --success: #10b981; /* Emerald-500 */
  --warning: #f59e0b; /* Amber-500 */
  --danger: #ef4444; /* Red-500 */
  --info: #3b82f6; /* Blue-500 */

  /* Badges color bg */
  --badge-bg-info: rgba(59, 130, 246, 0.15);
  --badge-bg-success: rgba(16, 185, 129, 0.15);
  --badge-bg-warning: rgba(245, 158, 11, 0.15);
  --badge-bg-danger: rgba(239, 68, 68, 0.15);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(20, 184, 166, 0.25);
}

/* === RESET & BASE === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
  font-size: 15px;
}
body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}
a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--primary-light);
}
code {
  font-family: var(--font-mono);
  background: rgba(148, 163, 184, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--primary-light);
  word-break: break-all;
}

/* === TOP NAVIGATION BAR === */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topnav-height);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}
[data-theme="dark"] .topnav {
  background: rgba(9, 13, 22, 0.8);
}
.topnav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 24px;
  max-width: 1600px;
  margin: 0 auto;
}
.topnav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-family: var(--font-ui);
}
.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: var(--shadow-glow);
  color: white;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.brand-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}
.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Theme Switcher Button */
.btn-theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 16px;
  transition: all var(--transition-fast);
}
.btn-theme-toggle:hover {
  background: var(--border);
  color: var(--text-primary);
  border-color: var(--border-light);
  transform: translateY(-1px);
}
/* Display correct theme icon */
.theme-icon-light { display: none; }
.theme-icon-dark { display: inline; }
[data-theme="dark"] .theme-icon-light { display: inline; }
[data-theme="dark"] .theme-icon-dark { display: none; }

/* Print Button */
.btn-print {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-print:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}
.rs-badge {
  padding: 8px 14px;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary));
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-ui);
  color: white;
  letter-spacing: 0.2px;
}

/* Hamburger button for mobile menu drawer */
.hamburger-menu {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 22px;
  height: 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1010;
}
.hamburger-menu .bar {
  width: 100%;
  height: 2px;
  background-color: var(--text-primary);
  border-radius: 2px;
  transition: all var(--transition-fast);
}

/* === LAYOUT CONTAINERS === */
.layout {
  display: flex;
  margin-top: var(--topnav-height);
  min-height: calc(100vh - var(--topnav-height));
  position: relative;
}

/* === SIDEBAR (NAVIGATION DRAWER) === */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--topnav-height);
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 90;
  transition: background-color var(--transition-normal), border-color var(--transition-normal), transform var(--transition-normal);
}
.sidebar-header {
  padding: 20px 24px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-family: var(--font-ui);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sidebar-close {
  display: none;
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}
.sidebar-close:hover {
  color: var(--text-primary);
}

/* Sidebar Search Bar */
.sidebar-search-container {
  padding: 8px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 12px;
  font-size: 14px;
  color: var(--text-muted);
  pointer-events: none;
}
.sidebar-search-container input {
  width: 100%;
  padding: 10px 36px 10px 36px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 13px;
  outline: none;
  transition: all var(--transition-fast);
}
.sidebar-search-container input::placeholder {
  color: var(--text-muted);
}
.sidebar-search-container input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
  background: var(--bg-card);
}
#search-clear-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  transition: all var(--transition-fast);
}
#search-clear-btn:hover {
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-primary);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 24px;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  border-left: 4px solid transparent;
  position: relative;
}
.sidebar-item:hover {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-primary);
  border-left-color: var(--border-light);
}
.sidebar-item.active {
  background: rgba(15, 118, 110, 0.08);
  color: var(--primary-light);
  border-left-color: var(--primary);
  font-weight: 600;
}
[data-theme="dark"] .sidebar-item.active {
  background: rgba(20, 184, 166, 0.1);
  color: var(--primary-light);
}
.sidebar-icon {
  font-size: 18px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.sidebar-text {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}
.sidebar-num {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sidebar-title {
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font-ui);
}

/* Sidebar submenu layout */
.sidebar-group-header-wrapper {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  width: 100%;
}
.sidebar-group-title {
  flex-grow: 1;
}
.sidebar-chevron-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.sidebar-chevron-btn:hover {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-primary);
}
.chevron-svg {
  transition: transform var(--transition-normal);
  color: var(--text-muted);
}
.sidebar-group.expanded .chevron-svg {
  transform: rotate(180deg);
}
.sidebar-group-items {
  display: none;
  margin-top: 2px;
}
.sidebar-group.expanded .sidebar-group-items {
  display: block;
}
.sidebar-subitem {
  padding-left: 48px !important;
  font-size: 13.0px !important;
  border-left: 4px solid transparent !important;
}
.sidebar-subitem:hover {
  border-left-color: var(--border-light) !important;
}
.sidebar-subitem.active {
  border-left-color: var(--primary) !important;
  background: rgba(15, 118, 110, 0.04) !important;
}
[data-theme="dark"] .sidebar-subitem.active {
  background: rgba(20, 184, 166, 0.05) !important;
}

.sidebar-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.version-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--badge-bg-success);
  border: 1px solid rgba(22, 163, 74, 0.2);
  border-radius: 20px;
  font-size: 11px;
  color: var(--success);
  font-weight: 700;
  text-align: center;
  font-family: var(--font-ui);
}
.sidebar-foot-text {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  font-weight: 500;
}

/* Drawer overlay for mobile menu drawer */
.sidebar-overlay {
  display: none;
}

/* === MAIN CONTENT CONTAINER === */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100%;
  overflow-x: hidden;
  transition: margin-left var(--transition-normal);
}

/* === HOME / LANDING PAGE === */
.hero-section {
  position: relative;
  padding: 90px 48px 70px;
  overflow: hidden;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}
.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 70% at 50% -20%, rgba(20, 184, 166, 0.12) 0%, transparent 80%),
    radial-gradient(circle at 90% 90%, rgba(37, 99, 235, 0.05) 0%, transparent 60%);
  pointer-events: none;
}
[data-theme="dark"] .hero-bg {
  background:
    radial-gradient(ellipse 60% 70% at 50% -20%, rgba(20, 184, 166, 0.2) 0%, transparent 80%),
    radial-gradient(circle at 90% 90%, rgba(59, 130, 246, 0.08) 0%, transparent 60%);
}
.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
}
.hero-badge {
  display: inline-block;
  padding: 6px 16px;
  background: rgba(15, 118, 110, 0.08);
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 30px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 24px;
  letter-spacing: 0.5px;
  font-family: var(--font-ui);
  text-transform: uppercase;
}
[data-theme="dark"] .hero-badge {
  background: rgba(20, 184, 166, 0.15);
  border-color: rgba(20, 184, 166, 0.3);
  color: var(--primary-light);
}
.hero-title {
  font-size: 3.25rem;
  font-weight: 800;
  font-family: var(--font-ui);
  color: var(--text-primary);
  line-height: 1.15;
  margin-bottom: 12px;
  letter-spacing: -1px;
}
.hero-subtitle {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 24px;
  font-family: var(--font-ui);
}
[data-theme="dark"] .hero-subtitle {
  color: var(--primary-light);
}
.hero-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 600px;
  margin: 0 auto 36px;
}
.hero-meta {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--text-muted);
  font-weight: 600;
}
.hero-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chapter-section {
  padding: 60px 48px;
  max-width: 1200px;
  margin: 0 auto;
}
.section-header {
  margin-bottom: 36px;
}
.section-header h2 {
  font-size: 1.75rem;
  font-weight: 800;
  font-family: var(--font-ui);
  color: var(--text-primary);
  letter-spacing: -0.5px;
}
.section-header p {
  color: var(--text-secondary);
  font-size: 14.5px;
  margin-top: 6px;
  font-weight: 500;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}
.chapter-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-decoration: none;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.chapter-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-normal);
}
.chapter-card:hover {
  border-color: var(--primary-light);
  background: var(--bg-card);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  color: var(--text-primary);
}
.chapter-card:hover::before {
  transform: scaleX(1);
}
.card-num {
  position: absolute;
  top: 12px; right: 16px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}
.card-icon {
  font-size: 2.25rem;
  flex-shrink: 0;
  width: 54px;
  height: 54px;
  background: rgba(148, 163, 184, 0.08);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast);
}
.chapter-card:hover .card-icon {
  background: rgba(20, 184, 166, 0.1);
}
.card-body {
  flex: 1;
  min-width: 0;
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-ui);
  color: var(--text-primary);
  margin-bottom: 4px;
}
.card-sub {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-arrow {
  font-size: 18px;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.chapter-card:hover .card-arrow {
  color: var(--primary-light);
  transform: translateX(4px);
}

.info-section {
  padding: 0 48px 60px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}
.info-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}
.info-icon {
  font-size: 26px;
  width: 46px;
  height: 46px;
  background: rgba(148, 163, 184, 0.08);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.info-card strong {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.info-card p {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

/* === CHAPTER DETAILS PAGE === */
.chapter-header {
  padding: 60px 48px 40px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}
.chapter-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 70% at 50% -10%, rgba(20, 184, 166, 0.08) 0%, transparent 70%);
  pointer-events: none;
}
.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-ui);
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 24px;
  transition: color var(--transition-fast);
  position: relative;
}
.breadcrumb:hover {
  color: var(--primary-light);
}
.chapter-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--primary);
  margin-bottom: 14px;
  position: relative;
}
[data-theme="dark"] .chapter-label {
  color: var(--primary-light);
}
.chapter-hero-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  position: relative;
}
.chapter-hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  font-family: var(--font-ui);
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 10px;
  position: relative;
  letter-spacing: -0.5px;
}
.chapter-hero-sub {
  font-size: 1.1rem;
  color: var(--text-secondary);
  position: relative;
  font-weight: 500;
}

.overview-box {
  margin: 32px 48px;
  padding: 24px;
  background: rgba(37, 99, 235, 0.04);
  border: 1px solid rgba(37, 99, 235, 0.1);
  border-left: 4px solid var(--accent2);
  border-radius: var(--radius-md);
  transition: all var(--transition-normal);
}
[data-theme="dark"] .overview-box {
  background: rgba(59, 130, 246, 0.05);
}
.overview-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent2);
  margin-bottom: 10px;
  font-family: var(--font-ui);
}
.overview-box p {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 14.5px;
}

/* TWO-COLUMN GRID */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 40px;
  margin: 0 48px 48px;
  align-items: start;
}

/* Steps Column */
.steps-col {
  min-width: 0;
}
.steps-heading {
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-ui);
  color: var(--text-primary);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.2px;
}

/* Vertical Steps connector progress path */
.steps-list {
  position: relative;
  display: flex;
  flex-direction: column;
}
.steps-list::before {
  content: '';
  position: absolute;
  top: 36px;
  bottom: 36px;
  left: 17px; /* Matches center of 34px number badge */
  width: 2px;
  background: var(--border);
  z-index: 1;
}
[data-theme="dark"] .steps-list::before {
  background: rgba(255, 255, 255, 0.08);
}

.step-item {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 20px;
  padding: 24px 16px;
  border-bottom: 1px solid var(--border);
  transition: all var(--transition-fast);
  scroll-margin-top: 100px;
  border-radius: var(--radius-md);
}
.step-item:last-child {
  border-bottom: none;
}
.step-item:hover {
  background: rgba(148, 163, 184, 0.04);
}
[data-theme="dark"] .step-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

.step-number {
  width: 34px;
  height: 34px;
  min-width: 34px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: white;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}
.step-body {
  flex: 1;
}
.step-title {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-ui);
  color: var(--text-primary);
  margin-bottom: 8px;
}
.step-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.75;
}
.step-desc ul {
  margin: 12px 0 4px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.step-desc li {
  line-height: 1.7;
  padding-left: 4px;
}
.step-desc strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Screenshot Column (Sticky) */
.screenshot-col {
  position: relative;
}
.screenshot-sticky {
  position: sticky;
  top: calc(var(--topnav-height) + 24px);
}
.screenshot-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-family: var(--font-ui);
}
.screenshot-frame {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
}
.screenshot-frame:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-light);
}
.screenshot-browser-bar {
  background: var(--bg-sidebar);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
.browser-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.browser-dot.red { background: #ff5f57; }
.browser-dot.yellow { background: #febc2e; }
.browser-dot.green { background: #28c840; }
.browser-url {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 10px;
}
.screenshot-img {
  width: 100%;
  display: block;
  max-height: 460px;
  object-fit: cover;
  object-position: top;
  cursor: zoom-in;
  transition: transform var(--transition-normal);
}
.screenshot-img:hover {
  transform: scale(1.025);
}
.img-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  gap: 16px;
  background: rgba(148, 163, 184, 0.05);
  min-height: 280px;
  text-align: center;
}
.fallback-icon {
  font-size: 3.5rem;
}
.img-fallback p {
  color: var(--text-secondary);
  font-size: 14.5px;
  font-weight: 600;
}
.img-fallback small {
  color: var(--text-muted);
  font-size: 11.5px;
  font-family: var(--font-mono);
  line-height: 1.5;
}

.screenshot-caption {
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 12px;
  font-style: italic;
  font-weight: 500;
}

/* Quick Steps Navigation Panel */
.quick-steps {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.quick-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-family: var(--font-ui);
}
.quick-step-btn {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition-fast);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quick-step-btn:hover {
  background: rgba(15, 118, 110, 0.06);
  color: var(--primary);
  transform: translateX(2px);
}
[data-theme="dark"] .quick-step-btn:hover {
  background: rgba(20, 184, 166, 0.1);
  color: var(--primary-light);
}

/* Notes & Alert Section */
.notes-section {
  margin: 0 48px 48px;
}
.notes-heading {
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-ui);
  color: var(--text-primary);
  margin-bottom: 20px;
}
.notes-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.note-card {
  display: flex;
  gap: 16px;
  padding: 18px 24px;
  border-radius: var(--radius-md);
  border: 1px solid;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
}
.note-warning {
  background: var(--badge-bg-warning);
  border-color: rgba(202, 138, 4, 0.3);
  color: var(--warning);
}
.note-warning .note-text {
  color: var(--text-primary);
}
.note-info {
  background: var(--badge-bg-info);
  border-color: rgba(37, 99, 235, 0.3);
  color: var(--info);
}
.note-info .note-text {
  color: var(--text-primary);
}
.note-tip {
  background: var(--badge-bg-success);
  border-color: rgba(22, 163, 74, 0.3);
  color: var(--success);
}
.note-tip .note-text {
  color: var(--text-primary);
}
.note-icon {
  font-size: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 24px;
}
.note-text {
  font-size: 14px;
  line-height: 1.7;
  font-weight: 500;
}

/* Bottom Chapter Navigation */
.chapter-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 48px 60px;
  padding: 32px 0 0;
  border-top: 1px solid var(--border);
  gap: 20px;
}
.chapter-nav-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-decoration: none;
  transition: all var(--transition-normal);
  max-width: 320px;
  min-width: 0;
  box-shadow: var(--shadow-sm);
}
.chapter-nav-btn:hover {
  border-color: var(--primary-light);
  background: var(--bg-card);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  transform: translateY(-2px);
  color: var(--text-primary);
}
.nav-arrow {
  font-size: 22px;
  color: var(--primary-light);
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}
.prev-btn:hover .nav-arrow {
  transform: translateX(-4px);
}
.next-btn:hover .nav-arrow {
  transform: translateX(4px);
}
.nav-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.nav-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 700;
}
.nav-title {
  font-size: 14px;
  font-weight: 700;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-ui);
}
.chapter-nav-home {
  padding: 14px 24px;
  background: rgba(15, 118, 110, 0.08);
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: var(--radius-md);
  color: var(--primary);
  font-size: 13.5px;
  font-weight: 700;
  transition: all var(--transition-fast);
  white-space: nowrap;
  font-family: var(--font-ui);
}
[data-theme="dark"] .chapter-nav-home {
  background: rgba(20, 184, 166, 0.12);
  border-color: rgba(20, 184, 166, 0.2);
  color: var(--primary-light);
}
.chapter-nav-home:hover {
  background: var(--primary);
  color: white !important;
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

/* === MOBILE SCREENSHOT FLOATING ACTION BUTTON (FAB) === */
.mobile-screenshot-fab {
  display: none; /* Desktop default: hidden */
  position: fixed;
  bottom: 24px;
  right: 24px;
  height: 52px;
  padding: 0 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  border-radius: 26px;
  box-shadow: 0 10px 25px rgba(20, 184, 166, 0.4);
  cursor: pointer;
  z-index: 95;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  font-family: var(--font-ui);
  transition: all var(--transition-normal);
  transform: scale(0);
}
.mobile-screenshot-fab.visible {
  transform: scale(1);
}
.mobile-screenshot-fab:hover {
  box-shadow: 0 12px 30px rgba(20, 184, 166, 0.5);
  transform: scale(1.05) translateY(-2px);
}
.mobile-screenshot-fab:active {
  transform: scale(0.95);
}

/* === LIGHTBOX MODAL (ZOOM IMAGE) === */
#lightbox-overlay {
  transition: opacity var(--transition-normal);
}
#lightbox-img {
  transition: transform var(--transition-normal);
}

/* === CUSTOM SCROLLBAR === */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   RESPONSIVE LAYOUT & MOBILE UX OVERRIDE
   ========================================================================== */
@media (max-width: 1100px) {
  /* Re-order layout columns on tablets: screenshot on top, steps below */
  .content-grid {
    grid-template-columns: 1fr;
    gap: 32px;
    margin: 0 32px 40px;
    display: flex;
    flex-direction: column-reverse; /* Puts steps at the bottom, screenshot at the top */
  }
  .steps-col {
    padding-right: 0;
  }
  .screenshot-sticky {
    position: static;
  }
  .screenshot-img {
    max-height: 380px;
  }
  .quick-steps {
    display: none; /* Hide quick steps on mobile columns */
  }
}

@media (max-width: 992px) {
  /* Sidebar becomes Drawer navigation on mobile */
  :root {
    --sidebar-width: 0px;
  }
  .hamburger-menu {
    display: flex;
  }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 290px;
    transform: translateX(-100%);
    transition: transform var(--transition-normal) !important;
    z-index: 1020;
    box-shadow: none;
    background: var(--bg-sidebar);
  }
  .sidebar-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-close {
    display: inline-block;
  }
  .sidebar-search-container {
    padding: 16px 20px;
  }
  .sidebar-nav {
    padding: 8px 0;
  }
  .main-content {
    margin-left: 0 !important;
    padding-bottom: 80px; /* space for FAB */
  }

  /* Hamburger transformation when active */
  .sidebar-open .hamburger-menu .bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .sidebar-open .hamburger-menu .bar:nth-child(2) {
    opacity: 0;
  }
  .sidebar-open .hamburger-menu .bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* Mobile Drawer Overlay */
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
  }
  .sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }
  .sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.25);
  }
  
  /* Show screenshot FAB button on mobile */
  .mobile-screenshot-fab {
    display: flex;
  }
}

@media (max-width: 768px) {
  html {
    font-size: 14px;
  }
  
  /* Navbar adjustments */
  .topnav-inner {
    padding: 0 16px;
  }
  .btn-print-text {
    display: none; /* Hide text, keep icon */
  }
  .btn-print {
    padding: 8px;
  }
  .rs-badge {
    display: none; /* Hide badge to make space */
  }

  /* Landing page adaptations */
  .hero-section {
    padding: 60px 20px 40px;
  }
  .hero-title {
    font-size: 2.25rem;
  }
  .hero-subtitle {
    font-size: 1.3rem;
  }
  .hero-meta {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  
  .chapter-section {
    padding: 40px 20px;
  }
  .chapter-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .info-section {
    padding: 0 20px 40px;
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Chapter view adaptations */
  .chapter-header {
    padding: 40px 20px 28px;
  }
  .chapter-hero-title {
    font-size: 1.85rem;
  }
  .overview-box {
    margin: 20px 20px;
    padding: 16px;
  }
  .content-grid {
    margin: 0 20px 32px;
  }
  .notes-section {
    margin: 0 20px 32px;
  }
  .note-card {
    padding: 14px 18px;
  }
  .chapter-nav {
    margin: 0 20px 40px;
    flex-direction: column;
    gap: 12px;
  }
  .chapter-nav-btn {
    max-width: 100%;
    width: 100%;
    justify-content: space-between;
  }
  .chapter-nav-home {
    width: 100%;
    text-align: center;
    order: 3; /* Push home btn to the bottom */
  }
}

/* Subchapters Grid for parent modules */
.subchapters-section {
  margin: 0 48px 48px;
}
.subchapters-heading {
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-ui);
  color: var(--text-primary);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.2px;
}
.subchapters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.subchapter-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
}
.subchapter-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}
.subchapter-icon {
  font-size: 24px;
  width: 48px;
  height: 48px;
  background: rgba(15, 118, 110, 0.08);
  color: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}
[data-theme="dark"] .subchapter-icon {
  background: rgba(20, 184, 166, 0.1);
  color: var(--primary-light);
}
.subchapter-card:hover .subchapter-icon {
  background: var(--primary);
  color: #fff;
}
[data-theme="dark"] .subchapter-card:hover .subchapter-icon {
  background: var(--primary-light);
  color: #000;
}
.subchapter-info {
  flex-grow: 1;
  min-width: 0;
}
.subchapter-title {
  font-size: 14.5px;
  font-weight: 700;
  font-family: var(--font-ui);
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.subchapter-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.subchapter-arrow {
  font-size: 16px;
  color: var(--text-muted);
  transition: transform var(--transition-fast), color var(--transition-fast);
}
.subchapter-card:hover .subchapter-arrow {
  transform: translateX(4px);
  color: var(--primary-light);
}

/* ==========================================================================
   PRINT LAYOUT OVERRIDES (Do not break when viewing /print)
   ========================================================================== */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  .topnav, .sidebar, .sidebar-overlay, .mobile-screenshot-fab, .breadcrumb, .chapter-nav {
    display: none !important;
  }
  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }
}
