/* Documentation Page Styling */

.docs-container {
  display: flex;
  min-height: calc(100vh - 86px);
  margin-top: 0;
  padding-top: 0;
  background-color: #ffffff;
  overflow-x: hidden;
}

/* Left Sidebar */
.docs-sidebar {
  width: 260px;
  background-color: #f8f9fa;
  border-right: 1px solid #e1e4e8;
  padding: 0;
  padding-top: 86px;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.docs-sidebar::-webkit-scrollbar {
  display: none;
}

.docs-sidebar h4 {
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #24292e;
  margin: 0 0 15px 0;
  padding: 20px 15px 10px 15px;
  border-bottom: 1px solid #e1e4e8;
}

.docs-nav {
  list-style: none;
  padding: 15px;
  margin: 0;
}

.docs-nav > li {
  margin-bottom: 5px;
}

.docs-nav > li > a {
  display: block;
  padding: 6px 10px;
  color: #586069;
  text-decoration: none;
  border-radius: 3px;
  transition: all 0.15s ease;
  font-size: 0.9rem;
  font-weight: 600;
}

.docs-nav a i {
  margin-right: 6px;
  font-size: 0.95rem;
}

.docs-nav > li > a:hover {
  background-color: #f6f8fa;
  color: #054e73;
  text-decoration: none;
}

.docs-nav > li > a.active,
.docs-nav > li > a.active-parent {
  background-color: #054e73;
  color: white;
  font-weight: 600;
}

/* Nested sections */
.docs-nav ul {
  list-style: none;
  padding-left: 0;
  margin: 8px 0 12px 0;
}

.docs-nav ul li {
  margin-bottom: 2px;
}

.docs-nav ul a {
  display: block;
  font-size: 0.85rem;
  color: #6c757d;
  padding: 5px 10px 5px 38px;
  position: relative;
  text-decoration: none;
  border-radius: 3px;
  transition: all 0.15s ease;
}

.docs-nav ul a::before {
  content: "›";
  position: absolute;
  left: 20px;
  color: #adb5bd;
  font-weight: bold;
}

.docs-nav ul a:hover {
  color: #054e73;
  background-color: #f6f8fa;
  text-decoration: none;
}

.docs-nav ul a.active {
  background-color: transparent;
  color: #054e73;
  font-weight: 600;
}

.docs-nav ul a.active::before {
  color: #054e73;
}

/* Main Content Area */
.docs-content {
  margin-left: 260px;
  padding: 30px 50px;
  width: calc(100% - 260px);
  max-width: 1000px;
}

/* Version Selector */
.version-selector {
  position: sticky;
  top: 0;
  background-color: white;
  padding: 15px 0;
  margin-bottom: 30px;
  border-bottom: 1px solid #e1e4e8;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
}

.version-selector label {
  font-weight: 600;
  color: #343a40;
  margin-bottom: 0;
  font-size: 0.9rem;
}

.version-selector select {
  max-width: 200px;
  font-size: 0.875rem;
}

/* Documentation Sections */
.docs-section {
  margin-bottom: 50px;
  scroll-margin-top: 100px;
}

@media (max-width: 991px) {
  .docs-section {
    scroll-margin-top: 115px;
  }
}

.docs-section h2 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.75rem;
  font-weight: 600;
  color: #24292e;
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e1e4e8;
}

.docs-section h2 i {
  margin-right: 8px;
  color: #054e73;
}

.docs-section h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: #24292e;
  margin-top: 30px;
  margin-bottom: 15px;
}

.docs-section h4 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: #24292e;
  margin-top: 20px;
  margin-bottom: 10px;
}

.docs-section p {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #495057;
  margin-bottom: 15px;
}

.docs-section ul, .docs-section ol {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #495057;
  margin-bottom: 15px;
}

.docs-section li {
  margin-bottom: 8px;
}

/* Code Blocks */
.docs-code-block {
  background-color: #f6f8fa;
  border: 1px solid #d1d5da;
  border-radius: 6px;
  padding: 16px;
  margin: 16px 0;
  font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', monospace;
  font-size: 13px;
  overflow-x: auto;
  position: relative;
}

.docs-code-block pre {
  margin: 0;
  white-space: pre;
  word-wrap: normal;
  overflow-x: auto;
}

.docs-code-block code {
  background: none;
  padding: 0;
  color: #24292e;
  font-size: 13px;
}

/* Code block with copy button */
.code-block-wrapper {
  position: relative;
}

.copy-button {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 10px;
  font-size: 0.8rem;
  background-color: #6c757d;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.copy-button:hover {
  background-color: #5a6268;
}

.copy-button.copied {
  background-color: #28a745;
}

/* Info Boxes */
.info-box {
  background-color: #f1f8ff;
  border-left: 3px solid #0366d6;
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: 3px;
}

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

.warning-box {
  background-color: #fff5b1;
  border-left: 3px solid #e36209;
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: 3px;
}

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

/* Inline code */
.docs-section code {
  background-color: rgba(27,31,35,0.05);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', monospace;
  font-size: 85%;
  color: #24292e;
}

.docs-section pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 13px;
}

/* Mobile Docs Header Bar */
.mobile-docs-header {
  display: none;
}

/* Mobile Responsive */
@media (max-width: 991px) {
  body.sidebar-open {
    overflow: hidden;
  }

  .mobile-docs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    height: 50px;
    background-color: #054e73;
    color: white;
    padding: 0 10px;
    z-index: 900;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  }

  .mobile-docs-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    flex: 1;
    text-align: center;
  }

  .mobile-header-spacer {
    width: 48px;
    flex-shrink: 0;
  }

  .docs-sidebar {
    position: fixed;
    left: -280px;
    width: 280px;
    padding-top: 106px;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    z-index: 1020;
  }

  .docs-sidebar.mobile-open {
    left: 0;
  }

  .docs-content {
    margin-left: 0;
    width: 100%;
    padding: 20px 15px;
    padding-top: 115px;
  }

  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 1.5rem;
    transition: all 0.2s ease;
    border-radius: 4px;
  }

  .mobile-menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }

  .mobile-menu-toggle:active {
    background-color: rgba(255, 255, 255, 0.2);
  }

  .mobile-menu-toggle i {
    margin: 0;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 1010;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .sidebar-overlay.active {
    display: block;
    opacity: 1;
  }

  /* Adjust version selector for mobile */
  .version-selector {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .version-selector select {
    width: 100%;
    max-width: 100%;
  }
}

/* Tablet adjustments */
@media (max-width: 768px) {
  .mobile-docs-header {
    padding: 0 5px;
  }

  .mobile-docs-title {
    font-size: 0.9rem;
  }

  .mobile-menu-toggle {
    font-size: 1.3rem;
    width: 44px;
    height: 44px;
  }

  .mobile-header-spacer {
    width: 44px;
  }

  .docs-sidebar {
    width: 100%;
    max-width: 280px;
    left: -100%;
  }

  .docs-content {
    padding: 15px 10px;
    padding-top: 115px;
  }
}

@media (min-width: 992px) {
  .mobile-menu-toggle {
    display: none;
  }
}

/* Table styling */
.docs-section table {
  width: 100%;
  margin: 20px 0;
  border-collapse: collapse;
}

.docs-section table th {
  background-color: #054e73;
  color: white;
  padding: 12px;
  text-align: left;
  font-weight: 600;
}

.docs-section table td {
  padding: 12px;
  border-bottom: 1px solid #dee2e6;
}

.docs-section table tr:hover {
  background-color: #f8f9fa;
}

/* FAQ Items */
.faq-item {
  background-color: #ffffff;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 20px;
  transition: box-shadow 0.2s ease;
}

.faq-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.faq-item h4 {
  color: #054e73;
  font-size: 1.2rem;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e1e4e8;
}

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

.faq-item ul, .faq-item ol {
  margin-bottom: 12px;
}

.faq-item .docs-code-block {
  margin-top: 12px;
  margin-bottom: 12px;
}

/* ========================================
   Changelog Timeline Styles
   ======================================== */

.changelog-container {
  max-width: 1000px;
  margin: 40px auto;
  padding: 0 20px;
}

.changelog-header {
  text-align: center;
  margin-bottom: 50px;
}

.changelog-header h2 {
  color: #054e73;
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.changelog-header p {
  color: #6c757d;
  font-size: 1.1rem;
}

/* Platform Tabs */
.platform-tabs {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.platform-tab {
  padding: 10px 24px;
  border: 2px solid #e1e4e8;
  border-radius: 6px;
  background-color: #ffffff;
  color: #586069;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 1rem;
}

.platform-tab:hover {
  border-color: #054e73;
  color: #054e73;
}

.platform-tab.active {
  background-color: #054e73;
  border-color: #054e73;
  color: #ffffff;
}

.platform-tab i {
  margin-right: 6px;
}

.platform-tab img {
  width: 24px;
  height: 24px;
  margin-right: 8px;
  filter: brightness(0) saturate(100%) invert(42%) sepia(10%) saturate(500%) hue-rotate(180deg);
  transition: filter 0.2s ease;
  object-fit: contain;
}

.platform-tab.active img,
.platform-tab:hover img {
  filter: brightness(0) invert(1);
}

/* Timeline Container */
.changelog-timeline {
  position: relative;
  padding: 20px 0;
}

/* Vertical line */
.changelog-timeline::before {
  content: '';
  position: absolute;
  left: 30px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, #054e73, #0a7fb5);
}

/* Version Item */
.version-item {
  position: relative;
  margin-bottom: 50px;
  padding-left: 80px;
  animation: fadeIn 0.5s ease-in;
}

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

/* Timeline Badge */
.version-badge {
  position: absolute;
  left: 13px;
  top: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: #ffffff;
  border: 3px solid #054e73;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #054e73;
  font-size: 0.9rem;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.version-badge.major {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  color: #ffffff;
  border: 3px solid #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.version-badge.minor {
  background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
  color: #ffffff;
  border: 3px solid #06b6d4;
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

.version-badge.patch {
  background: linear-gradient(135deg, #64748b 0%, #94a3b8 100%);
  color: #ffffff;
  border: 3px solid #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.2);
}

/* Version Card */
.version-card {
  background-color: #ffffff;
  border: 1px solid #e1e4e8;
  border-radius: 8px;
  padding: 25px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: all 0.3s ease;
}

.version-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  transform: translateY(-2px);
}

/* Version Header */
.version-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
}

.version-number {
  font-size: 1.8rem;
  font-weight: 700;
  color: #054e73;
  margin: 0;
}

.version-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.version-date {
  color: #6c757d;
  font-size: 0.95rem;
}

.version-type-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
}

.version-type-badge.major {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(30, 64, 175, 0.2);
}

.version-type-badge.minor {
  background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(8, 145, 178, 0.2);
}

.version-type-badge.patch {
  background: linear-gradient(135deg, #64748b 0%, #94a3b8 100%);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(100, 116, 139, 0.2);
}

/* Platform Badges */
.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: all 0.2s ease;
}

.platform-badge.stata {
  background: linear-gradient(135deg, #054e73 0%, #0a7fb5 100%);
}

.platform-badge.python {
  background: linear-gradient(135deg, #306998 0%, #4B8BBE 100%);
}

/* Version Notes */
.version-notes {
  color: #24292e;
  font-size: 1rem;
  margin-bottom: 20px;
  line-height: 1.6;
}

/* Highlights */
.version-highlights {
  margin-bottom: 20px;
}

.version-highlights h4 {
  color: #054e73;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.version-highlights ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.version-highlights li {
  padding: 6px 0 6px 24px;
  position: relative;
  color: #586069;
  line-height: 1.6;
}

.version-highlights li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #28a745;
  font-weight: 700;
}

/* Breaking Changes */
.version-breaking {
  background-color: #fff3cd;
  border-left: 4px solid #ffc107;
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 4px;
}

.version-breaking h4 {
  color: #856404;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.version-breaking ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.version-breaking li {
  padding: 4px 0 4px 24px;
  position: relative;
  color: #856404;
  line-height: 1.6;
}

.version-breaking li::before {
  content: '⚠';
  position: absolute;
  left: 0;
  font-weight: 700;
}

/* Bug Fixes */
.version-bugfixes {
  margin-bottom: 20px;
}

.version-bugfixes h4 {
  color: #054e73;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.version-bugfixes ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.version-bugfixes li {
  padding: 4px 0 4px 24px;
  position: relative;
  color: #586069;
  line-height: 1.6;
}

.version-bugfixes li::before {
  content: '🐛';
  position: absolute;
  left: 0;
  font-size: 0.9rem;
}

/* GitHub Link */
.version-github-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #054e73;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.version-github-link:hover {
  color: #0a7fb5;
  text-decoration: underline;
}

.version-github-link i {
  font-size: 1.1rem;
}

/* Loading State */
.changelog-loading {
  text-align: center;
  padding: 60px 20px;
  color: #6c757d;
}

.changelog-loading i {
  font-size: 3rem;
  margin-bottom: 20px;
  display: block;
  animation: spin 2s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Error State */
.changelog-error {
  text-align: center;
  padding: 60px 20px;
  color: #dc3545;
}

.changelog-error i {
  font-size: 3rem;
  margin-bottom: 20px;
  display: block;
}

/* Embedded Changelog */
.changelog-embedded {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 2px solid #e1e4e8;
}

.changelog-embedded .changelog-header {
  text-align: left;
  margin-bottom: 30px;
}

.changelog-embedded .changelog-header h3 {
  color: #054e73;
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.changelog-embedded .changelog-timeline::before {
  left: 20px;
}

.changelog-embedded .version-item {
  padding-left: 60px;
}

.changelog-embedded .version-badge {
  left: 4px;
  width: 34px;
  height: 34px;
  font-size: 0.8rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .changelog-timeline::before {
    left: 20px;
  }

  .version-item {
    padding-left: 60px;
  }

  .version-badge {
    left: 4px;
    width: 34px;
    height: 34px;
    font-size: 0.8rem;
  }

  .version-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .version-number {
    font-size: 1.5rem;
  }

  .platform-tabs {
    flex-direction: column;
    align-items: stretch;
  }

  .platform-tab {
    text-align: center;
  }
}
