:root {
  --primary-color: #007bff;
  --secondary-color: #6c757d;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #fd7e14;
  --info-color: #17a2b8;
  --dark-color: #343a40;
  --light-color: #f8f9fa;
  --border-color: #dee2e6;
  --text-color: #212529;
  --bg-color: #ffffff;
  --sidebar-width: 280px;
  --nav-strip-height: 50px;
}

.dark-theme {
  --text-color: #e9ecef;
  --bg-color: #1a1a1a;
  --border-color: #404040;
  --light-color: #2d2d2d;
  --dark-color: #e9ecef;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  transition: background-color 0.3s, color 0.3s;
}

/* Header Styles */
.api-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 1000;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-left h1 {
  font-size: 1.2rem;
  font-weight: 600;
}

.header-center {
  flex: 1;
  max-width: 400px;
  margin: 0 2rem;
}

.search-container {
  position: relative;
}

#search-input {
  width: 100%;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: var(--light-color);
  color: var(--text-color);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  max-height: 300px;
  overflow-y: auto;
  display: none;
  z-index: 1001;
}

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

.btn-icon {
  background: none;
  border: 1px solid var(--border-color);
  padding: 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-color);
  transition: background-color 0.2s;
}

.btn-icon:hover {
  background: var(--light-color);
}

.version-selector select {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-color);
  color: var(--text-color);
}

.version-badge {
  position: fixed;
  top: 70px;
  right: 1rem;
  background: var(--primary-color);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.8rem;
  display: none;
  z-index: 999;
}

/* Main Layout */
.main-container {
  display: flex;
  margin-top: 60px;
  min-height: calc(100vh - 60px);
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--light-color);
  border-right: 1px solid var(--border-color);
  padding: 1rem;
  position: fixed;
  height: calc(100vh - 60px);
  overflow-y: auto;
  transition: transform 0.3s;
}

.sidebar.hidden {
  transform: translateX(-100%);
}

.sidebar-nav .nav-section {
  margin-bottom: 2rem;
}

.sidebar-nav h3 {
  font-size: 0.9rem;
  color: var(--secondary-color);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1rem;
  font-weight: 600;
}

/* Nav subsection styles for hierarchical structure */
.nav-subsection {
  margin-bottom: 1.5rem;
  margin-left: 0.5rem;
}

.nav-subsection h4 {
  font-size: 0.85rem;
  color: var(--text-color);
  font-weight: 600;
  margin-bottom: 0.5rem;
  padding-left: 0.5rem;
  border-left: 3px solid var(--primary-color);
}

/* Collapsible sidebar sections */
.collapsible-header {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.2s;
}

.collapsible-header:hover {
  color: var(--primary-color);
}

.collapse-icon {
  font-size: 0.8rem;
  transition: transform 0.3s;
}

.collapsible-header.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

.collapsible-content {
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
  max-height: 500px;
  opacity: 1;
}

.collapsible-content.collapsed {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
}

.nav-subsection ul {
  margin-left: 1rem;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 0.25rem;
}

.sidebar-nav a {
  display: block;
  padding: 0.5rem;
  color: var(--text-color);
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.2s;
  position: relative;
  font-size: 0.9rem;
}

.sidebar-nav a.selectable:hover,
.sidebar-nav a.selectable.active {
  background: var(--primary-color);
  color: white;
}

.sidebar-nav a.non-selectable {
  cursor: not-allowed;
  color: var(--secondary-color);
}

/* Page Navigation Strip */
.page-nav-strip {
  position: sticky;
  top: 60px;
  background: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  z-index: 900;
  margin: 0 -2rem 2rem -2rem;
  padding: 0 2rem;
}

.nav-strip-content {
  display: flex;
  gap: 0;
  overflow-x: auto;
  height: var(--nav-strip-height);
  align-items: center;
}

.nav-strip-link {
  white-space: nowrap;
  padding: 0.75rem 1rem;
  color: var(--secondary-color);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  font-size: 0.875rem;
  font-weight: 500;
}

.nav-strip-link:hover {
  color: var(--primary-color);
  background: var(--light-color);
}

.nav-strip-link.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: var(--light-color);
}

.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem;
  max-width: none;
  transition: margin-left 0.3s;
}

.content.full-width {
  margin-left: 0;
}

/* Content Sections */
.content-section {
  margin-bottom: 3rem;
  scroll-margin-top: 120px; /* Account for header + nav strip */
}

.content-section h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.content-section h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: var(--text-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  scroll-margin-top: 120px; /* Account for sticky elements */
}

.content-section h3 {
  font-size: 1.3rem;
  margin-bottom: 0.75rem;
  color: var(--text-color);
}

.section-description {
  font-size: 1.1rem;
  color: var(--secondary-color);
  margin-bottom: 2rem;
  line-height: 1.7;
}

/* Overview Section */
.overview-section {
  margin-bottom: 3rem;
  scroll-margin-top: 120px;
}

.overview-content {
  margin-bottom: 2rem;
}

.overview-content p {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-color);
  margin-bottom: 1rem;
}

/* Tab Container */
.tab-container {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 2rem;
}

/* Tabs */
.tabs {
  display: flex;
  background: var(--light-color);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0;
}

.tab-btn {
  background: none;
  border: none;
  padding: 0.75rem 1rem;
  cursor: pointer;
  color: var(--secondary-color);
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: var(--bg-color);
}

.tab-content {
  display: none;
  padding: 1.5rem;
}

.tab-content.active {
  display: block;
}

/* Tables */
.attributes-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  background: var(--bg-color);
}

.attributes-table th {
  background: var(--light-color);
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-color);
  border-bottom: 2px solid var(--border-color);
}

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

.attributes-table td code {
  background: var(--light-color);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.9rem;
}

/* JSON Section */
.json-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.copy-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background-color 0.2s;
}

.copy-btn:hover {
  background: #0056b3;
}

/* HTTP Method Badges */
.method-get { 
  background: var(--success-color); 
  color: white; 
  padding: 0.25rem 0.5rem; 
  border-radius: 4px; 
  font-size: 0.8rem; 
  font-weight: bold; 
  margin-right: 0.5rem;
}

.method-post { 
  background: var(--primary-color); 
  color: white; 
  padding: 0.25rem 0.5rem; 
  border-radius: 4px; 
  font-size: 0.8rem; 
  font-weight: bold; 
  margin-right: 0.5rem;
}

.method-patch { 
  background: var(--warning-color); 
  color: white; 
  padding: 0.25rem 0.5rem; 
  border-radius: 4px; 
  font-size: 0.8rem; 
  font-weight: bold; 
  margin-right: 0.5rem;
}

.method-delete { 
  background: var(--danger-color); 
  color: white; 
  padding: 0.25rem 0.5rem; 
  border-radius: 4px; 
  font-size: 0.8rem; 
  font-weight: bold; 
  margin-right: 0.5rem;
}

/* Code Blocks */
.code-block {
  position: relative;
  background: var(--light-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  margin: 1rem 0;
}

.code-block pre {
  margin: 0;
  padding: 1rem;
  overflow-x: auto;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Endpoint Sections */
.endpoint-section {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  scroll-margin-top: 120px;
}

.endpoint-url {
  background: var(--light-color);
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
  border-left: 4px solid var(--primary-color);
}

.endpoint-url code {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 1.1rem;
  font-weight: 600;
}

.code-example {
  margin-top: 1.5rem;
}

/* Focus Mode */
body.focus-mode .sidebar {
  transform: translateX(-100%);
}

body.focus-mode .content {
  margin-left: 0;
}

body.focus-mode .version-badge {
  display: block;
}

body.focus-mode .api-header .header-left,
body.focus-mode .api-header .header-center {
  display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .content {
    margin-left: 0;
  }

  .header-center {
    display: none;
  }

  .tabs {
    flex-wrap: wrap;
  }

  .nav-subsection {
    margin-left: 0;
  }

  .nav-subsection ul {
    margin-left: 0.5rem;
  }

  .nav-strip-content {
    gap: 0;
  }

  .nav-strip-link {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
  }

  .page-nav-strip {
    margin: 0 -1rem 1rem -1rem;
    padding: 0 1rem;
  }
}

/* Dark theme specific adjustments */
.dark-theme .code-block {
  background: #2d2d2d;
}

.dark-theme .copy-btn {
  background: #404040;
}

.dark-theme .attributes-table {
  border-color: #404040;
}

.dark-theme .attributes-table th {
  background: #2d2d2d;
}

.dark-theme .attributes-table td {
  border-color: #404040;
}

.dark-theme .page-nav-strip {
  background: #1a1a1a;
  border-color: #404040;
}

.dark-theme .nav-strip-link:hover {
  background: #2d2d2d;
}

.dark-theme .nav-strip-link.active {
  background: #2d2d2d;
}