/* Knowledge Hub — K V Reddy & Co. */
.kh-page {
  margin-top: 80px;
  min-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  background: var(--bg-light);
}

.kh-hero {
  background: linear-gradient(135deg, var(--primary-navy) 0%, var(--primary-blue) 100%);
  color: #fff;
  padding: var(--space-lg) var(--space-md);
  text-align: center;
}

.kh-hero h1 {
  color: #fff;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin-bottom: var(--space-xs);
}

.kh-hero p {
  opacity: 0.9;
  max-width: 640px;
  margin: 0 auto var(--space-md);
  font-size: 1.05rem;
}

.kh-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.kh-stat {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 0.85rem;
}

.kh-stat strong {
  display: block;
  font-size: 1.25rem;
  color: var(--accent-gold);
}

.kh-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: var(--space-sm) var(--space-md);
  background: #fff;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 80px;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.kh-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: #fff;
  color: var(--text-dark);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.kh-tab:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

.kh-tab.active {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
  color: #fff;
}

.kh-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.kh-layout.acts-mode {
  height: calc(100vh - 220px);
}

.kh-sidebar {
  width: 340px;
  min-width: 280px;
  background: #f8f9fa;
  border-right: 1px solid var(--border-light);
  display: none;
  flex-direction: column;
  z-index: 10;
}

.kh-layout.acts-mode .kh-sidebar {
  display: flex;
}

.kh-sidebar-header {
  padding: 16px;
  background: var(--primary-navy);
  color: #fff;
}

.kh-act-select,
.kh-sidebar-search input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.kh-act-select option,
.kh-act-select optgroup {
  background: var(--primary-navy);
  color: #fff;
}

.kh-sidebar-search {
  position: relative;
}

.kh-sidebar-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.6;
  font-size: 0.85rem;
}

.kh-sidebar-search input {
  padding-left: 36px;
  margin-bottom: 0;
}

.kh-sidebar-search input::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

.kh-reader-tools {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.kh-tool-btn {
  flex: 1;
  min-width: 36px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: var(--transition-fast);
}

.kh-tool-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.kh-toc {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.kh-toc-chapter {
  margin-bottom: 2px;
}

.kh-toc-chapter-header {
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: var(--primary-navy);
  font-size: 0.88rem;
  transition: background 0.2s;
}

.kh-toc-chapter-header:hover {
  background: rgba(30, 91, 168, 0.06);
}

.kh-toc-chapter.open .kh-toc-chevron {
  transform: rotate(180deg);
}

.kh-toc-chevron {
  font-size: 0.7rem;
  transition: transform 0.25s;
}

.kh-toc-sections {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
  background: #fff;
  border-bottom: 1px solid var(--border-light);
}

.kh-toc-chapter.open .kh-toc-sections {
  display: block;
}

.kh-toc-section-item {
  padding: 8px 16px 8px 24px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-dark);
  border-left: 3px solid transparent;
  line-height: 1.35;
}

.kh-toc-section-item:hover {
  background: #f0f4f8;
}

.kh-toc-section-item.active {
  background: #eef2f6;
  border-left-color: var(--primary-blue);
  color: var(--primary-blue);
  font-weight: 600;
}

.kh-main {
  flex: 1;
  overflow-y: auto;
  background: #fff;
  scroll-behavior: smooth;
}

.kh-main-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
}

.kh-panel {
  display: none;
}

.kh-panel.active {
  display: block;
}

/* Updates / bulletins */
.kh-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: var(--space-md);
}

.kh-chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.kh-chip:hover,
.kh-chip.active {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
  color: #fff;
}

.kh-updates-search {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
  position: relative;
}

.kh-updates-search input {
  width: 100%;
  padding: 10px 12px 10px 38px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-family: var(--font-body);
}

.kh-updates-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
}

.kh-bulletin-card {
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}

.kh-bulletin-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-blue);
}

.kh-bulletin-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.kh-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.kh-badge-cat {
  background: #e0e7ff;
  color: #3730a3;
}

.kh-badge-auto {
  background: #fef3c7;
  color: #b45309;
}

.kh-bulletin-card h3 {
  font-size: 1.15rem;
  color: var(--primary-navy);
  margin-bottom: 8px;
}

.kh-empty {
  text-align: center;
  padding: 48px 24px;
  background: var(--bg-light);
  border-radius: 16px;
  color: var(--text-light);
}

.kh-empty i {
  font-size: 2.5rem;
  margin-bottom: 16px;
  color: var(--primary-blue);
  opacity: 0.5;
}

/* Tools grid */
.kh-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.kh-tool-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 20px;
  transition: var(--transition-base);
}

.kh-tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-blue);
}

.kh-tool-card h3 {
  font-size: 1.1rem;
  color: var(--primary-navy);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.kh-tool-card h3 i {
  color: var(--primary-blue);
}

.kh-tool-list {
  list-style: none;
}

.kh-tool-list li {
  margin-bottom: 8px;
}

.kh-tool-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-blue);
  font-size: 0.9rem;
  font-weight: 500;
}

.kh-tool-list a:hover {
  text-decoration: underline;
}

/* Compliance calendar */
.kh-calendar-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.kh-calendar-table th,
.kh-calendar-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.kh-calendar-table th {
  background: var(--primary-navy);
  color: #fff;
  font-weight: 600;
}

.kh-calendar-table tr:hover td {
  background: var(--bg-light);
}

.kh-due-soon {
  color: #b45309;
  font-weight: 600;
}

.kh-due-past {
  color: var(--text-light);
}

/* Act reader */
.kh-act-metadata {
  text-align: center;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--border-light);
}

.kh-act-metadata h1 {
  font-family: var(--font-display);
  color: var(--primary-navy);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  margin-bottom: 8px;
}

.kh-act-metadata .kh-preamble {
  max-width: 640px;
  margin: 16px auto 0;
  font-size: 0.95rem;
  color: var(--text-light);
  line-height: 1.7;
}

.kh-chapter-banner {
  text-align: center;
  margin: 48px 0 32px;
  padding: 20px;
  background: var(--bg-light);
  border-radius: 12px;
}

.kh-section-block {
  margin-bottom: 48px;
  scroll-margin-top: 100px;
}

.kh-section-header {
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.kh-sec-num {
  display: inline-block;
  background: var(--bg-light);
  color: var(--primary-blue);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.kh-section-header h3 {
  font-family: var(--font-display);
  color: var(--primary-navy);
  font-size: 1.35rem;
  margin: 0;
}

.kh-section-text {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #2d3748;
}

.kh-section-text.font-sm { font-size: 0.95rem; }
.kh-section-text.font-lg { font-size: 1.15rem; }

.kh-section-text ol,
.kh-section-text ul {
  padding-left: 1.25rem;
  margin-bottom: 12px;
}

.kh-section-text li {
  margin-bottom: 8px;
}

.kh-section-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.kh-section-actions button {
  padding: 6px 12px;
  font-size: 0.8rem;
  border: 1px solid var(--border-light);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-light);
}

.kh-section-actions button:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

.kh-section-history {
  margin-top: 16px;
  padding: 14px;
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
  font-size: 0.85rem;
  color: #92400e;
}

.kh-coming-soon {
  text-align: center;
  padding: 48px 24px;
  background: var(--bg-light);
  border-radius: 16px;
  max-width: 560px;
  margin: 0 auto;
}

.kh-loading {
  text-align: center;
  padding: 48px;
  color: var(--text-light);
}

.kh-loading i {
  font-size: 2rem;
  color: var(--primary-blue);
  margin-bottom: 12px;
}

.kh-progress {
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid var(--border-light);
  padding: 8px 0;
  margin-bottom: 20px;
  font-size: 0.85rem;
  color: var(--text-light);
  z-index: 5;
}

.kh-progress-bar {
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.kh-progress-fill {
  height: 100%;
  background: var(--primary-blue);
  border-radius: 2px;
  transition: width 0.2s;
}

mark.kh-highlight {
  background: #fef08a;
  color: #1e293b;
  padding: 0 2px;
  border-radius: 2px;
}

.kh-mobile-toggle {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary-blue);
  color: #fff;
  border: none;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  font-size: 1.2rem;
  cursor: pointer;
}

@media (max-width: 900px) {
  .kh-layout.acts-mode {
    height: auto;
    min-height: calc(100vh - 220px);
  }

  .kh-sidebar {
    position: fixed;
    left: 0;
    top: 140px;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-xl);
  }

  .kh-sidebar.mobile-open {
    transform: translateX(0);
  }

  .kh-mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .kh-tabs {
    top: 80px;
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .kh-main-inner {
    padding: var(--space-md);
  }
}
