/* Knotical Help — Shared Theme */
:root {
  --bg-base: #0a1628;
  --bg-surface: #0f1e36;
  --bg-surface-2: #142847;
  --bg-hover: #1a3357;
  --border: #1f3a5f;
  --text-primary: #ffffff;
  --text-secondary: #8fa3c0;
  --text-muted: #6b809e;
  --accent: #4a90e2;
  --accent-soft: rgba(74, 144, 226, 0.12);
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  --transition: all 0.2s ease;
  --max-width: 1200px;
}

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

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* === Header === */
.site-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  overflow: hidden;
  max-height: 80px;
}

.site-header .container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-primary);
  transition: var(--transition);
}

.brand:hover { opacity: 0.85; }

.brand .logo-mark {
  height: 56px;
  max-height: 56px;
  width: auto;
  max-width: 180px;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  overflow: hidden;
}

.brand .logo-mark img {
  height: 56px;
  max-height: 56px;
  width: auto;
  max-width: 180px;
  display: block;
  object-fit: contain;
}

@media (max-width: 600px) {
  .brand .logo-mark,
  .brand .logo-mark img { height: 40px; max-height: 40px; max-width: 140px; }
  .brand { font-size: 15px; }
}

/* === Back button === */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
  margin-bottom: 16px;
  font-family: inherit;
}

.back-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent);
  transform: translateX(-2px);
}

.back-btn svg { width: 14px; height: 14px; }

.breadcrumb {
  font-size: 14px;
  color: var(--text-secondary);
}

.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { margin: 0 8px; opacity: 0.5; }
.breadcrumb .current { color: var(--text-primary); }

/* === Page === */
.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
}

.page-header .subtitle {
  color: var(--text-secondary);
  font-size: 15px;
}

/* === Module List (home) === */
.module-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.module-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: transparent;
  border: 1px solid transparent;
  transition: var(--transition);
  cursor: pointer;
}

.module-row:hover {
  background: var(--bg-surface);
  border-color: var(--border);
  transform: translateX(2px);
}

.module-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.module-icon svg {
  width: 24px;
  height: 24px;
}

.module-info {
  flex: 1;
  min-width: 0;
}

.module-info h3 {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 2px;
}

.module-info p {
  font-size: 13px;
  color: var(--text-muted);
}

.module-row .chevron {
  color: var(--text-muted);
  font-size: 18px;
  flex-shrink: 0;
}

/* === Video Layout (module page) === */
.video-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: start;
}

.video-sidebar {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.video-sidebar h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding: 0 8px;
}

.video-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.video-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  font-size: 14px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.video-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.video-nav-item.active {
  background: var(--accent-soft);
  color: var(--text-primary);
  border-left: 3px solid var(--accent);
  padding-left: 9px;
}

.video-nav-item .play-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.video-nav-item .title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-nav-item .duration {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* === Video Main === */
.video-main {
  min-width: 0;
}

.video-player-wrap {
  position: relative;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 16 / 9;
}

.video-player-wrap video {
  width: 100%;
  height: 100%;
  display: block;
}

.video-meta {
  margin-top: 20px;
}

.video-meta h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 6px;
}

.video-meta .video-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 18px;
}

.help-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-top: 16px;
}

.help-box h3 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.help-box p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.65;
}

.help-box + .help-box { margin-top: 12px; }

/* === PDF actions === */
.video-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  font-family: inherit;
}

.btn:hover { background: #3a7fcc; transform: translateY(-1px); }

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

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

.btn[hidden] { display: none; }

.btn svg { width: 16px; height: 16px; }

/* === Reference docs section === */
.reference-section {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.reference-section h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-primary);
}

.reference-section .subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.doc-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
}

.doc-card:hover {
  background: var(--bg-surface-2);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.doc-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(229, 79, 79, 0.12);
  display: grid;
  place-items: center;
  color: #e54f4f;
  flex-shrink: 0;
}

.doc-info { flex: 1; min-width: 0; }
.doc-info .doc-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-info .doc-meta { font-size: 12px; color: var(--text-muted); }

/* === Empty/coming-soon state === */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

.empty-state svg {
  width: 56px;
  height: 56px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.empty-state h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 14px;
  max-width: 420px;
  margin: 0 auto;
}

/* === Mobile menu toggle === */
.mobile-menu-toggle {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 16px;
  align-items: center;
  gap: 8px;
  width: 100%;
  font-family: inherit;
}

/* === Responsive === */
@media (max-width: 900px) {
  .video-layout {
    grid-template-columns: 1fr;
  }
  .video-sidebar {
    position: static;
    max-height: none;
    display: none;
  }
  .video-sidebar.open { display: block; }
  .mobile-menu-toggle { display: flex; }
}

@media (max-width: 600px) {
  .page { padding: 20px 16px 48px; }
  .site-header { padding: 14px 16px; }
  .page-header h1 { font-size: 22px; }
  .module-row { padding: 14px 14px; gap: 14px; }
  .module-info h3 { font-size: 16px; }
  .video-meta h1 { font-size: 18px; }
  .breadcrumb { font-size: 13px; }
}

/* === Protections === */
video::-webkit-media-controls-download-button { display: none; }
video::-webkit-media-controls-enclosure { overflow: hidden; }
video::-internal-media-controls-download-button { display: none; }

.no-select {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}

.video-player-wrap video {
  pointer-events: auto;
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-hover); }
