/* APRS Service Registry — modern UI
   Variables, typography, and components
*/
:root {
  --bg: #f8fafc;
  --bg-elevated: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --accent: #0d9488;
  --accent-hover: #0f766e;
  --accent-soft: rgba(13, 148, 136, 0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --transition: 0.2s ease;
  
  /* Code block colors (light mode) */
  --code-bg: #1e293b;
  --code-text: #e2e8f0;
  --code-btn-bg: rgba(255, 255, 255, 0.08);
  --code-btn-border: rgba(255, 255, 255, 0.12);
  --code-btn-text: #94a3b8;
}

/* Dark mode */
[data-theme="dark"] {
  --bg: #0f172a;
  --bg-elevated: #1e293b;
  --border: #334155;
  --border-strong: #475569;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #2dd4bf;
  --accent-hover: #5eead4;
  --accent-soft: rgba(45, 212, 191, 0.15);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  
  /* Code block colors (dark mode - lighter to contrast) */
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --code-btn-bg: rgba(255, 255, 255, 0.1);
  --code-btn-border: rgba(255, 255, 255, 0.15);
  --code-btn-text: #cbd5e1;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Header ---- */
.site-header {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--text);
}

.site-title a {
  color: inherit;
  text-decoration: none;
}

.site-title a:hover {
  opacity: 0.8;
}

.site-tagline {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0 0;
}

.site-author {
  font-weight: 600;
  color: var(--accent);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  padding: 0.5rem 0.9rem;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-link--outline {
  border: 1px solid var(--border-strong);
}

.nav-link--outline:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ---- Main ---- */
main {
  flex: 1;
  padding: 2rem 0 3rem;
}

.section {
  margin-bottom: 2.5rem;
}

.section:last-of-type {
  margin-bottom: 0;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.section-header h2,
.section h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.02em;
}

.section-desc {
  color: var(--text-muted);
  margin: 0 0 1.25rem 0;
  max-width: 42rem;
}

.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
}

.legend-item .badge {
  font-size: 0.75rem;
}

.legend-count {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.badge-count {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
}

/* ---- Table card ---- */
.table-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.services-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.services-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.9rem 1.1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.services-table td {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.services-table tbody tr {
  transition: background var(--transition);
}

.services-table tbody tr:hover {
  background: var(--accent-soft);
}

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

.callsign {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.featured-star {
  color: #ffd700;
  margin-left: 0.35rem;
  font-size: 1.1em;
  text-shadow: 0 0 2px rgba(255, 215, 0, 0.5);
}

.link-external {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
  transition: color var(--transition);
}

.link-external:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.software {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--bg);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  color: var(--text-muted);
}

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}

.empty-state__icon {
  font-size: 2.5rem;
  color: var(--border-strong);
  margin-bottom: 0.75rem;
  line-height: 1;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.5rem 0;
}

.empty-state p {
  margin: 0;
}

.empty-state a {
  color: var(--accent);
  font-weight: 500;
}

/* ---- Register section ---- */
.section--register h2 {
  margin-bottom: 0.5rem;
}

.section--register > .container > p:first-of-type {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.section--register a {
  color: var(--accent);
  font-weight: 500;
}

.section--register a:hover {
  color: var(--accent-hover);
}

/* ---- Accordion overrides ---- */
.accordion-docs {
  --bs-accordion-border-color: var(--border);
  --bs-accordion-btn-bg: var(--bg-elevated);
  --bs-accordion-active-bg: var(--accent-soft);
  --bs-accordion-btn-focus-box-shadow: 0 0 0 0.2rem var(--accent-soft);
  --bs-accordion-border-radius: var(--radius);
}

.accordion-docs .accordion-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.accordion-docs .accordion-item:last-child {
  margin-bottom: 0;
}

.accordion-docs .accordion-button {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  padding: 1rem 1.25rem;
  background: transparent;
  box-shadow: none;
}

.accordion-docs .accordion-button:not(.collapsed) {
  color: var(--accent);
  background: var(--accent-soft);
}

.accordion-docs .accordion-button::after {
  width: 1rem;
  height: 1rem;
}

.accordion-docs .accordion-body {
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
}

.accordion-docs .accordion-body p {
  margin: 0 0 0.75rem 0;
}

.accordion-docs .accordion-body p:last-child {
  margin-bottom: 0;
}

.accordion-docs .accordion-body .mb-2 { margin-bottom: 0.5rem; }
.accordion-docs .accordion-body .mt-3 { margin-top: 1rem; }

/* ---- Code blocks ---- */
.code-block {
  position: relative;
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.code-block:last-child {
  margin-bottom: 0;
}

.code-block pre {
  margin: 0;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--code-text);
}

.code-block pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.btn-copy {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--code-btn-text);
  background: var(--code-btn-bg);
  border: 1px solid var(--code-btn-border);
  border-radius: 4px;
  cursor: pointer;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.btn-copy:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-copy--done {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.1);
}

/* ---- Footer ---- */
.site-footer {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
  margin-top: auto;
}

.site-footer p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.site-footer a {
  color: var(--accent);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* ---- DataTables overrides ---- */
.dataTables_wrapper {
  padding: 0;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  padding: 1rem 1.1rem;
  padding-bottom: 0.75rem;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.dataTables_wrapper .dataTables_length select {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 0.3rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 0 0.25rem;
  background: var(--bg-elevated);
  color: var(--text);
}

.dataTables_wrapper .dataTables_filter input {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 0.45rem 0.75rem;
  margin-left: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.dataTables_wrapper .dataTables_filter input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.dataTables_wrapper .dataTables_info {
  padding: 0.75rem 1.1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.dataTables_wrapper .dataTables_paginate {
  padding: 0.75rem 1.1rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: 0.4rem 0.75rem;
  margin: 0 0.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  transition: all var(--transition);
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Service status styling */
.service-down {
    opacity: 0.7;
}

.service-down td {
    color: #6c757d;
}

/* Health check status styling */
.health-check-success {
    color: #198754;
    font-weight: 500;
}

.health-check-failure {
    color: #dc3545;
    font-weight: 500;
}

.health-check-none {
    color: #6c757d;
}

/* Responsive: stack header nav on small screens */
@media (max-width: 576px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-title {
    font-size: 1.3rem;
  }

  .section-header h2,
  .section h2 {
    font-size: 1.2rem;
  }

  .services-table th,
  .services-table td {
    padding: 0.7rem 0.9rem;
    font-size: 0.875rem;
  }

  .code-block pre {
    padding: 0.9rem 1rem;
    font-size: 0.8rem;
  }

  .btn-copy {
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
  }
}

/* ---- Service Cards ---- */
.service-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
}

.service-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.service-card:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.service-card.expanded {
  box-shadow: var(--shadow-md);
}

.card-header-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.service-card .callsign {
  font-size: 1.25rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-active {
  background-color: rgba(40, 167, 69, 0.15);
  color: #198754;
}

.status-pending {
  background-color: rgba(255, 193, 7, 0.15);
  color: #856404;
}

.status-down {
  background-color: rgba(220, 53, 69, 0.15);
  color: #dc3545;
}

.service-card .description {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.service-card .description.truncated {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* Fixed height for 2 lines to ensure consistent card heights */
  min-height: calc(2 * 0.9rem * 1.4);
}

/* Heatmap */
.heatmap-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.heatmap {
  display: flex;
  gap: 3px;
  flex-wrap: nowrap;
  position: relative;
}

.heatmap-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
}

/* Custom instant tooltip */
.heatmap-dot::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.1s ease;
  pointer-events: none;
  z-index: 1000;
}

.heatmap-dot:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Arrow for tooltip */
.heatmap-dot::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--text);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.1s ease;
  pointer-events: none;
  z-index: 1000;
}

.heatmap-dot:hover::before {
  opacity: 1;
  visibility: visible;
}

.dot-success {
  background-color: #198754;
}

.dot-failure {
  background-color: #dc3545;
}

.dot-nodata {
  background-color: #d0d0d0;
}

.uptime {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  color: var(--text);
}

.website-link {
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  display: block;
}

.website-link:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

/* Expanded card details */
.expanded-details {
  border-top: 1px solid var(--border);
  margin-top: 1rem;
  padding-top: 1rem;
}

.detail-row {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.detail-label {
  color: var(--text-muted);
  width: 120px;
  flex-shrink: 0;
}

.detail-value {
  color: var(--text);
  font-weight: 500;
}

.health-log {
  margin-top: 1rem;
}

.health-log-title {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.health-log-item {
  font-size: 0.8rem;
  padding: 0.25rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.check-success {
  color: #198754;
  font-weight: bold;
}

.check-failure {
  color: #dc3545;
  font-weight: bold;
}

/* Active nav link */
.nav-link--active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Theme toggle button */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  color: var(--text-muted);
}

.theme-toggle:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.theme-toggle:hover svg {
  transform: rotate(15deg);
}

/* Hide/show icons based on theme */
.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle .icon-moon {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

/* Responsive heatmap */
@media (max-width: 768px) {
  .heatmap-dot {
    width: 8px;
    height: 8px;
  }
  .heatmap {
    gap: 2px;
  }
}

/* ---- Documentation Layout ---- */
.docs-layout {
  display: flex;
  min-height: calc(100vh - 70px);
}

.docs-sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  position: sticky;
  top: 70px;
  height: calc(100vh - 70px);
  overflow-y: auto;
}

.docs-nav {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.docs-nav-section {
  padding: 0 1rem;
  margin-bottom: 1.5rem;
}

.docs-nav-section--bottom {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.docs-nav-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  padding: 0 0.5rem;
}

.docs-nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}

.docs-nav-item:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.docs-nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.docs-nav-item--home {
  color: var(--text-muted);
}

.docs-nav-item--home:hover {
  color: var(--accent);
}

.docs-nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Documentation Content */
.docs-content {
  flex: 1;
  max-width: 800px;
  padding: 2rem 3rem;
  margin: 0 auto;
}

.docs-article {
  line-height: 1.7;
}

.docs-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.docs-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.02em;
}

.docs-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 0;
}

/* Quick Start Box */
.quick-start {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

.quick-start h2 {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin: 0 0 0.75rem 0;
}

.quick-start p {
  margin: 0 0 0.75rem 0;
}

.quick-start p:last-child {
  margin-bottom: 0;
}

.quick-start ul {
  margin: 0;
  padding-left: 1.25rem;
}

.quick-start li {
  margin-bottom: 0.25rem;
}

.quick-start .code-block {
  margin-top: 0.75rem;
  margin-bottom: 0;
}

/* Documentation Sections */
.docs-section {
  margin-bottom: 2.5rem;
}

.docs-section h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
  padding-top: 0.5rem;
  letter-spacing: -0.01em;
}

.docs-section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem 0;
}

.docs-section h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem 0;
  color: var(--text-muted);
}

.docs-section p {
  margin: 0 0 1rem 0;
}

.docs-section ul,
.docs-section ol {
  margin: 0 0 1rem 0;
  padding-left: 1.5rem;
}

.docs-section li {
  margin-bottom: 0.35rem;
}

.docs-section code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: var(--text);
}

/* Documentation Tables */
.docs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem 0;
  font-size: 0.9rem;
}

.docs-table th {
  text-align: left;
  font-weight: 600;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

.docs-table td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  vertical-align: top;
}

.docs-table code {
  font-size: 0.85em;
}

/* HTTP Method Badges */
.http-method {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.http-get {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.http-post {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

.http-delete {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

.http-put {
  background: rgba(249, 115, 22, 0.15);
  color: #ea580c;
}

/* Documentation Notes */
.docs-note {
  background: var(--bg);
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  font-size: 0.9rem;
}

/* FAQ Items */
.faq-item {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.faq-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.faq-item h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: var(--text);
}

.faq-item p {
  margin: 0 0 0.75rem 0;
}

.faq-item p:last-child {
  margin-bottom: 0;
}

.faq-item ul,
.faq-item ol {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

/* Dot Legend (for FAQ) */
.dot-legend {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 0.25rem;
}

.dot-legend.dot-success {
  background: #198754;
}

.dot-legend.dot-failure {
  background: #dc3545;
}

.dot-legend.dot-nodata {
  background: #d0d0d0;
}

/* Mobile sidebar */
@media (max-width: 768px) {
  .docs-layout {
    flex-direction: column;
  }

  .docs-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    top: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
  }

  .docs-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0 1rem;
  }

  .docs-nav-section {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0;
    margin-bottom: 0;
  }

  .docs-nav-section--bottom {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
  }

  .docs-nav-label {
    display: none;
  }

  .docs-nav-item {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
  }

  .docs-content {
    padding: 1.5rem;
    max-width: 100%;
  }

  .docs-header h1 {
    font-size: 1.5rem;
  }

  .docs-section h2 {
    font-size: 1.2rem;
  }
}

/* ---- Sort and Filter Controls ---- */
.controls-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.controls-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.controls-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.controls-select {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  padding: 0.4rem 2rem 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1.25rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.controls-select:hover {
  border-color: var(--border-strong);
}

.controls-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

[data-theme="dark"] .controls-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
}

.filter-buttons {
  display: flex;
  gap: 0.25rem;
}

.filter-btn {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.filter-btn.active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.controls-count {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Mobile responsiveness for controls */
@media (max-width: 768px) {
  .controls-toolbar {
    gap: 1rem;
    padding: 0.875rem 1rem;
  }

  .controls-group {
    flex-wrap: wrap;
  }

  .controls-count {
    width: 100%;
    margin-left: 0;
    margin-top: 0.25rem;
    text-align: center;
  }

  .filter-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
  }
}

/* ---- Service Commands Section ---- */
.commands-section {
  border-top: 1px solid var(--border);
  margin-top: 1rem;
  padding-top: 1rem;
}

.commands-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.commands-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.btn-suggest-command {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-suggest-command:hover {
  background: var(--accent);
  color: #fff;
}

.commands-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.command-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.5rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.command-name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.command-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.commands-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
}

/* Suggestion Form */
.suggest-form {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.suggest-form-group {
  margin-bottom: 0.75rem;
}

.suggest-form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.suggest-input {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.suggest-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.suggest-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.suggest-form-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.btn-cancel,
.btn-submit {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-cancel {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-cancel:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-submit {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
}

.btn-submit:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.suggest-form-message {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.suggest-form-message.success {
  background: rgba(40, 167, 69, 0.1);
  color: #198754;
  border: 1px solid rgba(40, 167, 69, 0.2);
}

.suggest-form-message.error {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
  border: 1px solid rgba(220, 53, 69, 0.2);
}

/* Modal Overlay - Floating Card Style */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
  max-width: 400px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalFloat 0.15s ease-out;
}

@keyframes modalFloat {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--bg);
  color: var(--text);
}

.modal-body {
  padding: 1.5rem;
}

.modal-subtitle {
  margin: 0 0 1.25rem 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.modal-subtitle strong {
  color: var(--accent);
  font-family: var(--font-mono);
}

.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* Dark mode adjustments for modal */
[data-theme="dark"] .modal-overlay {
  background: rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .modal-content {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
}
