/* ============================================================
   Joomla Docs — unified stylesheet (all pages, deduplicated)
   ============================================================ */

/* ---- Smooth scroll ---- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

/* ---- Reset & base ---- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #0f1724;
  font-family: 'Inter', sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- Theme variables ---- */
:root {
  --background: #0f1724;
  --foreground: #e6eef8;
  --border: #ffffff2d;
  --input: #0b1220;
  --primary: #00a0ff;
  --primary-foreground: #001828;
  --secondary: #172033;
  --secondary-foreground: #bfd8f5;
  --muted: #0d1622;
  --muted-foreground: #8ea8c2;
  --success: #16a34a;
  --success-foreground: #031b0f;
  --accent: #ffb020;
  --accent-foreground: #1a1300;
  --destructive: #ef4444;
  --destructive-foreground: #2a0606;
  --warning: #f59e0b;
  --warning-foreground: #241400;
  --card: #0d1a27;
  --card-foreground: #dcecfb;
  --sidebar: #08121a;
  --sidebar-foreground: #9fc7f8;
  --sidebar-primary: #07263b;
  --sidebar-primary-foreground: #dff6ff;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --font-family-body: 'Inter', sans-serif;
}

/* ---- App layout ---- */
.app-layout {
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-family-body);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}

/* ---- Header ---- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.logo-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  border-radius: var(--radius-md);
}

.logo-icon iconify-icon {
  font-size: 20px;
  color: var(--primary-foreground);
}

.logo-text {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--foreground);
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 8px 16px;
  width: 400px;
  gap: 12px;
}

.search-placeholder {
  flex: 1;
  color: var(--muted-foreground);
  font-size: 14px;
  font-weight: 400;
}

.search-shortcut {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 12px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-actions iconify-icon {
  font-size: 20px;
  color: var(--foreground);
}

.search-bar iconify-icon {
  font-size: 18px;
  color: var(--muted-foreground);
}

.breadcrumbs iconify-icon {
  font-size: 14px;
  color: var(--muted-foreground);
}

.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

/* ---- Sidebar ---- */
.main-wrapper {
  display: flex;
  flex: 1;
  align-items: stretch;
}

.sidebar {
  width: 280px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 16px 0;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
}

.nav-section {
  padding: 8px 16px;
}

.nav-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted-foreground);
  margin-bottom: 8px;
  padding-left: 12px;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 2px;
  border-radius: var(--radius-md);
  color: var(--sidebar-foreground);
  font-size: 13px;
  font-weight: 500;
  gap: 10px;
  text-decoration: none;
  transition: 0.2s;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--sidebar-primary-foreground);
}

.nav-link.active {
  background: var(--sidebar-primary);
  color: var(--sidebar-primary-foreground);
}

.nav-link iconify-icon {
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: var(--radius-xl);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-left: 12px;
}

/* ---- Content area ---- */
.content-area {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 48px 48px 80px 48px;
  background: var(--background);
  gap: 64px;
}

.article-container {
  width: 100%;
  max-width: 840px;
}

.toc-sidebar {
  width: 240px;
  flex-shrink: 0;
}

/* ---- Breadcrumbs ---- */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
  font-size: 14px;
  color: var(--muted-foreground);
}

.breadcrumb-item {
  cursor: pointer;
}

.breadcrumb-item.active {
  color: var(--foreground);
  font-weight: 500;
}

.breadcrumb-item:not(.active) {
  cursor: default;
}

/* ---- Typography ---- */
.article-title-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.article-h1 {
  font-size: 40px;
  font-weight: 700;
  color: var(--foreground);
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 16px;
}

.article-desc {
  font-size: 18px;
  color: var(--muted-foreground);
  line-height: 1.6;
  margin-bottom: 32px;
}

.article-h2 {
  font-size: 28px;
  font-weight: 600;
  color: var(--foreground);
  margin: 48px 0 20px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.article-h3 {
  font-size: 22px;
  font-weight: 600;
  color: var(--foreground);
  margin: 32px 0 16px 0;
}

.article-h4 {
  font-size: 18px;
  font-weight: 600;
  margin: 24px 0 12px 0;
  color: var(--primary);
}

.article-p {
  font-size: 16px;
  color: var(--foreground);
  line-height: 1.7;
  margin-bottom: 20px;
}

.article-list {
  margin-bottom: 24px;
  padding-left: 24px;
}

.article-li {
  font-size: 16px;
  color: var(--foreground);
  line-height: 1.7;
  margin-bottom: 12px;
}

.inline-code {
  background: var(--muted);
  color: var(--foreground);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  border: 1px solid var(--border);
}

/* ---- Callouts ---- */
.callout {
  display: flex;
  gap: 16px;
  background: var(--card);
  border-left: 4px solid var(--primary);
  padding: 20px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 32px 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.callout.callout-primary {
  border-left-color: var(--primary);
}

.callout.callout-success {
  border-left-color: var(--success);
}

.callout.warning {
  border-left-color: var(--warning);
  background: var(--warning);
}

.callout.success {
  border-left-color: var(--success);
  background: var(--success);
}

.callout-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.callout-title {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 6px;
}

.callout-text {
  font-size: 14px;
  line-height: 1.6;
}

/* Standard (primary) callout text colours */
.callout .callout-title,
.callout .callout-text {
  color: #ffe2b5;
}

.callout .callout-title {
  color: #f5b042;
}

.callout.warning .callout-title,
.callout.warning .callout-text {
  color: var(--warning-foreground);
}

.callout.success .callout-title,
.callout.success .callout-text {
  color: var(--success-foreground);
}

.callout iconify-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.callout iconify-icon[icon="lucide:info"] {
  color: #f5b042;
}

.callout iconify-icon[icon="lucide:alert-triangle"] {
  color: var(--primary);
}

.callout iconify-icon[icon="lucide:party-popper"],
.callout iconify-icon[icon="lucide:eye"] {
  color: var(--success);
}

.callout.warning iconify-icon[icon="lucide:shield"],
.callout.warning iconify-icon[icon="lucide:triangle-alert"] {
  color: var(--warning-foreground);
}

/* ---- Code blocks ---- */
.code-block-container {
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: 24px 0;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.code-lang {
  font-size: 12px;
  color: var(--muted-foreground);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.copy-btn {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.copy-btn iconify-icon {
  font-size: 16px;
  color: var(--muted-foreground);
}

.code-content {
  padding: 20px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  line-height: 1.6;
  color: #e6e6e6;
  overflow-x: auto;
}

/* Syntax tokens */
.token-keyword   { color: #c678dd; }
.token-string    { color: #98c379; }
.token-comment   { color: #5c6370; font-style: italic; }
.token-function  { color: #61afef; }
.token-tag       { color: #e06c75; }
.token-attr      { color: #d19a66; }

/* ---- Tables ---- */
.article-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  background: var(--card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.article-table thead {
  background: var(--sidebar-primary);
}

.article-table th {
  padding: 14px 16px;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  color: var(--sidebar-primary-foreground);
  border-bottom: 1px solid var(--border);
}

.article-table td {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--foreground);
  border-bottom: 1px solid var(--border);
}

.article-table tbody tr:last-child td {
  border-bottom: none;
}

.article-table tbody tr:hover {
  background: rgba(0, 160, 255, 0.05);
}

/* ---- Screenshot note ---- */
.screenshot-note {
  background: rgba(0, 160, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 24px 0;
  text-align: center;
  border: 1px dashed var(--primary);
  font-size: 14px;
}

.screenshot-caption {
  margin-top: 8px;
  background: #0a101a;
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  color: var(--muted-foreground);
}

/* ---- TOC (Table of Contents) ---- */
.toc-sidebar {
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  height: calc(100vh - 80px);
  overflow-y: auto;
  align-self: flex-start;
}

.toc-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 16px;
}

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

.toc-item {
  font-size: 13px;
  color: var(--muted-foreground);
  cursor: pointer;
  padding-left: 12px;
  border-left: 2px solid transparent;
}

.toc-item.active {
  color: var(--primary);
  font-weight: 500;
  border-left-color: var(--primary);
}

.toc-item.nested {
  padding-left: 24px;
}

/* TOC links (used in HTML pages) */
.toc-link {
  display: block;
  font-size: 13px;
  color: var(--muted-foreground);
  text-decoration: none;
  padding: 6px 12px;
  margin-bottom: 4px;
  border-radius: var(--radius-md);
  border-left: 2px solid transparent;
  transition: 0.2s;
}

.toc-link:hover {
  color: var(--primary);
  background: rgba(0, 160, 255, 0.05);
  border-left-color: var(--primary);
}

.toc-link.active {
  color: var(--primary);
  font-weight: 500;
  border-left-color: var(--primary);
  background: rgba(0, 160, 255, 0.08);
}

.toc-divider {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted-foreground);
  padding: 16px 12px 6px 12px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

/* ---- Pagination ---- */
.pagination-cards {
  display: flex;
  gap: 24px;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.page-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: 0.2s;
  text-decoration: none;
  color: inherit;
}

.page-card-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.page-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.page-card-label {
  font-size: 12px;
  color: var(--muted-foreground);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.page-card-title {
  font-size: 16px;
  color: var(--primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-card.next {
  align-items: flex-end;
  text-align: right;
}

.page-card.next .page-card-title {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

/* ---- Scroll to Top Button ---- */
.scroll-top-btn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 160, 255, 0.4);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background 0.2s ease;
  z-index: 100;
}

.scroll-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top-btn:hover {
  background: #0090e6;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 160, 255, 0.5);
}

.scroll-top-btn:active {
  transform: translateY(0);
}

/* ---- Responsive ---- */
@media (max-width: 1100px) {
  .content-area {
    flex-direction: column;
    gap: 32px;
  }

  .toc-sidebar {
    width: 100%;
    order: 2;
  }

  .article-container {
    order: 1;
  }

  .search-bar {
    width: 280px;
  }
}

@media (max-width: 768px) {
  .header {
    flex-wrap: wrap;
    height: auto;
    gap: 12px;
    padding: 12px 16px;
  }

  .search-bar {
    width: 100%;
    order: 3;
  }

  .main-wrapper {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    position: static;
    height: auto;
    overflow: visible;
  }

  .toc-sidebar {
    position: static;
    height: auto;
    overflow: visible;
  }

  .content-area {
    padding: 24px 16px;
  }

  .article-h1 {
    font-size: 32px;
  }

  .scroll-top-btn {
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
  }
}
