/* ==========================================================================
   CBT&A LEVEL-4 DOCUMENTATION & HANDBOOK DESIGN SYSTEM
   Mobile-First • Ultra-Responsive • Deshi Startup / GitBook Style
   ========================================================================== */

:root {
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Fira Code', monospace;

  /* Clean Green & Neutral Palette */
  --bg-page: #ffffff;
  --bg-surface: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-mint-tint: #f0fdf4;
  --bg-mint-light: #ecfdf5;

  --border-light: #e2e8f0;
  --border-green: #059669;
  --border-green-light: #a7f3d0;
  --border-dark-green: #064e3b;

  --text-dark: #0f172a;           /* Slate 900 */
  --text-body: #334155;           /* Slate 700 */
  --text-muted: #64748b;          /* Slate 500 */
  --text-green: #047857;          /* Emerald 700 */
  --text-green-dark: #064e3b;     /* Forest Green */

  --accent-primary: #059669;
  --accent-hover: #047857;

  --sidebar-width: 290px;
  --header-height: 100px;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-body);
  line-height: 1.7;
  font-size: 15.5px;
  -webkit-font-smoothing: antialiased;
}

/* --- HEADER CONTAINER --- */
.docs-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1380px;
  margin: 0 auto;
  padding: 10px 20px;
  gap: 12px;
}

/* Brand Box */
.brand-box {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.brand-logo-cube {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #064e3b, #059669);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.3);
}

.brand-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.2;
}

.brand-tagline {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  display: block;
}

/* Desktop Search Bar */
.header-search-wrapper {
  flex: 1;
  max-width: 440px;
}

.search-input-group {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  transition: border-color 0.2s ease;
}

.search-input-group:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

.search-input-group input {
  flex: 1;
  padding: 8px 12px;
  border: none;
  font-family: inherit;
  font-size: 0.86rem;
  color: var(--text-dark);
}

.search-input-group input:focus {
  outline: none;
}

.search-submit-btn {
  background: none;
  border: none;
  padding: 8px 12px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-submit-btn:hover {
  color: var(--accent-primary);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-icon-btn {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 6px 8px;
  color: var(--text-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-icon-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.mobile-search-toggle {
  display: none;
}

.mobile-sidebar-toggle {
  display: none;
}

.action-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  color: var(--accent-primary);
  border: 1px solid var(--border-light);
  padding: 6px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-pill-btn:hover {
  background: var(--bg-mint-light);
  border-color: var(--border-green);
}

.action-pill-btn-green {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-primary);
  color: #ffffff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease;
}

.action-pill-btn-green:hover {
  background: var(--accent-hover);
}

/* Mobile Collapsible Search */
.mobile-search-bar {
  padding: 8px 14px 12px 14px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-subtle);
}

.close-mobile-search-btn {
  background: none;
  border: none;
  padding: 8px 12px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
}

/* --- TABS BAR (Horizontal Scrolling on Mobile) --- */
.docs-tabs-bar {
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.docs-tabs-bar::-webkit-scrollbar {
  display: none;
}

.tabs-container {
  display: flex;
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 16px;
  gap: 4px;
  width: max-content;
}

.tab-item {
  background: none;
  border: none;
  border-top: 3px solid transparent;
  padding: 9px 14px;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.tab-item:hover {
  color: var(--text-dark);
  background: var(--bg-subtle);
}

.tab-item.active {
  color: var(--text-green-dark);
  font-weight: 800;
  border-top: 3px solid var(--border-dark-green);
  background: #ffffff;
}

.tab-badge {
  background: var(--bg-mint-light);
  color: var(--accent-primary);
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 0.7rem;
  margin-left: 4px;
  font-weight: 700;
}

/* --- MAIN LAYOUT --- */
.docs-layout {
  display: flex;
  max-width: 1380px;
  margin: 0 auto;
  min-height: calc(100vh - 110px);
}

/* Sidebar */
.docs-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  border-right: 1px solid var(--border-light);
  background: #ffffff;
  padding: 20px 16px;
  height: calc(100vh - 110px);
  position: sticky;
  top: 96px;
  overflow-y: auto;
  transition: transform 0.25s ease;
}

.sidebar-header-mobile {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
}

.sidebar-group-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  padding-left: 8px;
}

.sidebar-toc {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-link {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-body);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  transition: all 0.15s ease;
}

.toc-link:hover {
  background: var(--bg-mint-light);
  color: var(--text-green);
}

.toc-link.active {
  background: var(--bg-mint-light);
  color: var(--text-green-dark);
  font-weight: 800;
  border-left: 3px solid var(--accent-primary);
}

.sidebar-footer-box {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}

.footer-btn-row {
  display: flex;
  gap: 8px;
}

.footer-mini-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--text-body);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.footer-mini-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.drawer-backdrop {
  display: none;
}

/* --- ARTICLE CONTENT AREA --- */
.docs-content-area {
  flex: 1;
  padding: 28px 40px;
  max-width: 900px;
  min-width: 0; /* Prevents overflow */
}

/* Breadcrumbs */
.doc-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.bc-item {
  color: var(--text-muted);
}

.bc-item.current {
  color: var(--text-green);
  font-weight: 700;
}

.bc-sep {
  color: #cbd5e1;
}

/* Metadata Bar */
.doc-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  margin-bottom: 14px;
}

.meta-tags-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--text-green);
  font-weight: 700;
}

.meta-dot {
  color: #cbd5e1;
}

.code-badge {
  background: var(--bg-mint-light);
  border: 1px solid var(--border-green-light);
  color: var(--text-green-dark);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.meta-actions {
  display: flex;
  gap: 6px;
}

.mini-tool-btn {
  background: #ffffff;
  border: 1px solid var(--border-light);
  color: var(--text-body);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.mini-tool-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Article Title */
.doc-article-title {
  font-size: 1.95rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.25;
  margin-bottom: 14px;
  letter-spacing: -0.4px;
  word-break: break-word;
}

.doc-title-divider {
  border: none;
  height: 1px;
  background: var(--border-light);
  margin-bottom: 20px;
}

/* --- SUMMARY CALLOUT BOX --- */
.doc-callout-summary {
  background: #ffffff;
  border: 1.5px solid var(--border-green);
  border-radius: 6px;
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.05);
}

.doc-callout-summary p {
  color: var(--text-dark);
  font-size: 0.92rem;
  line-height: 1.6;
}

.doc-callout-summary strong {
  color: var(--text-green-dark);
  font-weight: 800;
}

/* Article Typography */
.doc-body-content h3 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-dark);
  margin: 24px 0 10px 0;
}

.doc-body-content h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-green-dark);
  margin: 16px 0 8px 0;
}

.doc-body-content p {
  margin-bottom: 14px;
  color: var(--text-body);
  line-height: 1.65;
}

.doc-body-content ul, .doc-body-content ol {
  margin-bottom: 18px;
  padding-left: 22px;
}

.doc-body-content li {
  margin-bottom: 6px;
  color: var(--text-body);
}

/* Tables in Docs */
.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 0.86rem;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  display: table;
  overflow-x: auto;
}

.doc-table th {
  background: var(--bg-subtle);
  color: var(--text-dark);
  font-weight: 800;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 2px solid var(--border-light);
}

.doc-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-body);
  vertical-align: top;
}

.doc-quote-box {
  background: var(--bg-mint-tint);
  border-left: 4px solid var(--accent-primary);
  padding: 12px 16px;
  margin: 14px 0;
  font-size: 0.92rem;
  color: var(--text-green-dark);
  border-radius: 0 6px 6px 0;
}

.doc-callout {
  padding: 12px 16px;
  border-radius: 6px;
  margin: 18px 0;
  font-size: 0.88rem;
}

.doc-callout.tip {
  background: var(--bg-mint-light);
  border-left: 4px solid var(--accent-primary);
  color: var(--text-green-dark);
}

.unit-meta-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.82rem;
  margin-bottom: 18px;
}

.element-doc-box {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 14px;
  margin-bottom: 14px;
}

.element-doc-box h4 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.criteria-list {
  list-style: square;
  padding-left: 18px;
}

.viva-qa-box {
  background: var(--bg-mint-tint);
  border: 1px solid var(--border-green-light);
  border-radius: 6px;
  padding: 16px;
  margin: 18px 0;
}

.viva-qa-box p {
  margin-bottom: 12px;
}

.viva-qa-box p:last-child {
  margin-bottom: 0;
}

/* Code Explainer */
.code-explainer-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.code-chip {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 6px 10px;
  text-align: center;
}

.code-chip span {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-primary);
}

.code-chip small {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* 4 Dimensions Grid */
.dimension-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.dim-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 14px;
}

.dim-badge {
  display: inline-block;
  background: var(--bg-mint-light);
  color: var(--text-green);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.dim-card h4 {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.dim-eg {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* 4-Step Process Box */
.step-process-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px 0;
}

.step-card {
  background: var(--bg-subtle);
  border-left: 4px solid var(--accent-primary);
  border-radius: 0 6px 6px 0;
  padding: 12px 16px;
}

.step-num {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent-primary);
  margin-bottom: 2px;
}

.step-card h4 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 4px;
}

/* Article Pagination (Bottom Prev/Next) */
.article-pagination-bar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.pagination-btn {
  flex: 1;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 12px 16px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pagination-btn.next {
  text-align: right;
}

.pagination-btn:hover {
  border-color: var(--accent-primary);
  background: var(--bg-mint-tint);
}

.pag-direction {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-green);
  margin-bottom: 4px;
}

.pag-title {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-dark);
}

/* --- EXTRA VIEWS (Units, Flashcards, SAG, Notes) --- */
.doc-extra-view {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
  gap: 10px;
}

.view-header h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-dark);
}

.view-header p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Units Grid & Collapsible Accordion */
.units-grid-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.unit-card-doc {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.unit-card-header {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  background: #ffffff;
  gap: 10px;
}

.unit-card-header:hover {
  background: var(--bg-subtle);
}

.unit-card-code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent-primary);
}

.unit-card-hours {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.unit-tag-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-mint-light);
  color: var(--text-green-dark);
}

.unit-card-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-top: 2px;
}

.expand-btn-icon {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
}

.unit-card-body-collapsible {
  padding: 16px;
  border-top: 1px solid var(--border-light);
  background: #ffffff;
}

/* Flashcards */
.flashcard-box-centered {
  max-width: 540px;
  margin: 20px auto;
  perspective: 1000px;
}

.fc-meta-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.fc-category-tag {
  background: var(--bg-mint-light);
  color: var(--text-green);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
}

.flashcard-3d {
  width: 100%;
  min-height: 260px;
  cursor: pointer;
  user-select: none;
}

.fc-flipper {
  position: relative;
  width: 100%;
  min-height: 260px;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.flashcard-3d.flipped .fc-flipper {
  transform: rotateY(180deg);
}

.fc-face {
  position: absolute;
  width: 100%;
  min-height: 260px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 8px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.fc-front {
  background: #ffffff;
  border: 1.5px solid var(--border-light);
  color: var(--text-dark);
}

.fc-back {
  background: linear-gradient(135deg, #064e3b, #047857);
  color: #ffffff;
  transform: rotateY(180deg);
}

.fc-cue {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--accent-primary);
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}

.fc-back .fc-cue {
  color: #a7f3d0;
}

.fc-text {
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: pre-line;
}

.fc-nav-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}

.fc-ctrl-btn {
  background: #ffffff;
  border: 1px solid var(--border-light);
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
}

.fc-flip-btn {
  background: var(--accent-primary);
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 0.86rem;
  cursor: pointer;
}

/* SAG View */
.readiness-gauge {
  background: var(--bg-mint-light);
  border: 1px solid var(--border-green-light);
  border-radius: 6px;
  padding: 6px 14px;
  text-align: center;
}

.gauge-num {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-green-dark);
  display: block;
}

.gauge-lbl {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
}

.sag-list-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sag-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 14px 16px;
}

.sag-card-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-dark);
}

.sag-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
}

.sag-row input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--accent-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.sag-row label {
  font-size: 0.85rem;
  color: var(--text-body);
  cursor: pointer;
}

/* Notes Grid */
.notes-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.note-card-item {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.note-card-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.note-card-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.note-card-body {
  font-size: 0.84rem;
  color: var(--text-body);
  white-space: pre-wrap;
  flex: 1;
  margin-bottom: 12px;
}

.note-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--border-light);
  padding-top: 8px;
}

.btn-icon-note {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.btn-icon-note:hover {
  color: var(--accent-primary);
}

/* Search Overlay */
.search-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  z-index: 50;
  padding: 18px 24px;
}

.search-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.close-search-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--text-muted);
  cursor: pointer;
}

.search-result-row {
  padding: 10px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
}

.search-result-row:hover {
  background: var(--bg-mint-light);
}

.sr-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-dark);
}

.sr-snippet {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Modal Dialog */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-dialog {
  background: #ffffff;
  border-radius: 8px;
  width: 100%;
  max-width: 500px;
  padding: 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.modal-dialog-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
}

.form-field {
  margin-bottom: 12px;
}

.form-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.86rem;
}

.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.modal-actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.btn-cancel {
  background: #ffffff;
  border: 1px solid var(--border-light);
  padding: 7px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.84rem;
  cursor: pointer;
}

.btn-save {
  background: var(--accent-primary);
  color: #fff;
  border: none;
  padding: 7px 18px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
}

/* Toast */
.toast-popup {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--text-dark);
  color: #ffffff;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: none;
  z-index: 350;
}

/* ==========================================================================
   MOBILE RESPONSIVENESS OVERRIDES (PHONES < 768px)
   ========================================================================== */
@media (max-width: 768px) {
  /* 1. Header is compact and clean on 1 single row */
  .header-container {
    padding: 8px 12px;
    gap: 8px;
  }

  .brand-name {
    font-size: 0.95rem;
  }

  .brand-tagline {
    display: none; /* Hide long subtitle to prevent wrapping */
  }

  .header-search-wrapper {
    display: none; /* Hidden by default, toggled with search icon */
  }

  .mobile-search-toggle {
    display: flex;
  }

  .mobile-sidebar-toggle {
    display: flex;
  }

  .btn-text-desktop {
    display: none;
  }

  .action-pill-btn {
    padding: 6px 8px;
  }

  /* 2. Tabs Bar */
  .tabs-container {
    padding: 0 8px;
    gap: 2px;
  }

  .tab-item {
    padding: 8px 10px;
    font-size: 0.78rem;
  }

  /* 3. Sidebar Drawer overlay on mobile */
  .docs-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 290px;
    max-width: 85vw;
    height: 100vh;
    background: #ffffff;
    z-index: 250;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    transform: translateX(-100%);
    padding: 18px 16px;
  }

  .docs-sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-close-btn {
    display: block;
  }

  .drawer-backdrop.active {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(3px);
    z-index: 240;
  }

  /* 4. Content Area on mobile */
  .docs-content-area {
    padding: 16px 14px;
  }

  .doc-article-title {
    font-size: 1.45rem;
    line-height: 1.3;
    margin-bottom: 10px;
  }

  .doc-meta-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .meta-actions {
    width: 100%;
  }

  .doc-callout-summary {
    padding: 12px 14px;
    font-size: 0.86rem;
    margin-bottom: 18px;
  }

  /* 5. Pagination Stacks vertically on phone */
  .article-pagination-bar {
    flex-direction: column;
    gap: 10px;
  }

  .pagination-btn.next {
    text-align: left;
  }

  /* 6. Dimensions grid on phone */
  .dimension-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   NEW UI/UX FEATURES (Dark Mode, Progress Bar, Personal Guide)
   ========================================================================== */

/* Dark Mode Variables */
body.dark-mode {
  --bg-page: #0f172a;
  --bg-surface: #1e293b;
  --bg-subtle: #334155;
  --bg-mint-tint: rgba(5, 150, 105, 0.1);
  --bg-mint-light: rgba(5, 150, 105, 0.15);
  --border-light: #334155;
  --text-dark: #f8fafc;
  --text-body: #cbd5e1;
  --text-muted: #94a3b8;
  --text-green: #34d399;
  --text-green-dark: #6ee7b7;
}

body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

.docs-header, .docs-sidebar, .docs-tabs-bar, .search-input-group, .header-icon-btn, .action-pill-btn {
  background-color: var(--bg-surface);
}

/* Reading Progress Bar */
.reading-progress-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: transparent;
  z-index: 1000;
}
.reading-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #059669, #34d399);
  transition: width 0.1s ease-out;
}

/* Personal Guide Specific Styles */
.personal-guide-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.pg-block {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.pg-block.qa-block { border-left: 4px solid #8b5cf6; }
.pg-block.note-block { border-left: 4px solid var(--accent-primary); background: var(--bg-mint-tint); }
.pg-block h3 { margin-bottom: 10px; color: var(--text-dark); }
.pg-badge {
  display: inline-block;
  background: rgba(139, 92, 246, 0.15);
  color: #8b5cf6;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: bold;
  margin-bottom: 12px;
}
.pg-image {
  width: 100%;
  border-radius: 6px;
  cursor: zoom-in;
  transition: transform 0.2s;
}
.pg-image:hover { transform: scale(1.01); }

/* ==========================================================================
   DASHBOARD PILLARS UI
   ========================================================================== */
.dashboard-hero {
  text-align: center;
  padding: 40px 20px;
  background: var(--bg-subtle);
  border-radius: 12px;
  margin-bottom: 30px;
  border: 1px solid var(--border-light);
}
.dashboard-hero h1 {
  font-size: 2rem;
  color: var(--text-dark);
  margin-bottom: 10px;
}
.dashboard-hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.dashboard-pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.pillar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.pillar-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.05);
  border-color: var(--accent-primary);
}

.pillar-icon {
  font-size: 3.5rem;
  margin-bottom: 15px;
}

.pillar-card h3 {
  font-size: 1.3rem;
  color: var(--text-dark);
  margin-bottom: 10px;
}

.pillar-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}
