/*
 * PACE SYSTEM DOCUMENTATION
 * Main stylesheet - Modernized with enterprise color scheme
 * Refactored for consistency, maintainability, and performance
 */

/* -------------------------------------------
 * 1. THEME VARIABLES
 * ------------------------------------------- */
:root {
  --primary-color: #EB9110;
  --primary-dark: #d48209;
  --secondary-color: #505050;
  --accent-color: #0078d4;
  --background-color: #f9f9f9;
  --card-background: #fff;
  --text-color: #333;
  --text-light: #666;
  --border-color: #e5e5e5;
  --shadow-color: rgba(0,0,0,0.08);
  --header-height: 70px;
  --sidebar-width: 280px;
  --transition-speed: 0.2s;
  --border-radius: 6px;
  --card-border-radius: 10px;
  --spacing-md: 20px;
  --spacing-lg: 40px;
  --font-size-base: 15px;
  --font-size-lg: 28px;
  --font-size-md: 16px;
  --font-size-sm: 14px;
}

/* -------------------------------------------
 * 2. RESET & BASE STYLES
 * ------------------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Aptos', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--background-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a:focus, button:focus, .btn-primary:focus, .btn-secondary:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* -------------------------------------------
 * 3. AUTHENTICATION VIEW - Modernized
 * ------------------------------------------- */
#auth-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  padding: var(--spacing-md);
}

.auth-container {
  background: var(--card-background);
  border-radius: var(--card-border-radius);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
  padding: var(--spacing-lg);
  width: 100%;
  max-width: 480px;
  text-align: center;
}

.auth-container h1 {
  font-weight: 600;
  margin-bottom: var(--spacing-lg);
  color: var(--text-color);
}

.auth-container p {
  margin-bottom: var(--spacing-lg);
  color: var(--text-light);
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 30px;
  padding: 12px 30px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  box-shadow: 0 4px 10px rgba(235, 145, 16, 0.25);
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(235, 145, 16, 0.35);
}

/* Authentication error styling */
.auth-error {
  margin-top: var(--spacing-md);
  padding: 15px;
  background-color: rgba(231, 76, 60, 0.08);
  border-left: 4px solid #e74c3c;
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  color: #e74c3c;
  text-align: left;
}

.auth-error p {
  margin: 0 0 8px 0;
  font-size: var(--font-size-sm);
  color: #e74c3c;
}

.auth-error p:last-child {
  margin-bottom: 0;
}

/* Modern Authentication Layout */
.auth-background {
  min-height: 100vh;
  background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
}

.auth-split-container {
  display: flex;
  max-width: 1200px;
  width: 100%;
  height: 600px;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

/* Brand Section Styles */
.auth-brand-section {
  flex: 1.2;
  background: linear-gradient(135deg, #0c2e55 0%, #0a4a8b 100%);
  color: white;
  padding: 60px 40px;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.auth-brand-section::before {
  content: "";
  position: absolute;
  top: -10%;
  right: -10%;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  z-index: 1;
}

.auth-brand-section::after {
  content: "";
  position: absolute;
  bottom: -15%;
  left: -15%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  z-index: 1;
}

.brand-content {
  position: relative;
  z-index: 2;
  max-width: 90%;
}

.brand-logo {
  width: 120px;
  height: auto;
  margin-bottom: var(--spacing-lg);
  display: block;
}

.brand-tagline {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  line-height: 1.3;
}

.brand-description {
  font-size: var(--font-size-base);
  line-height: 1.6;
  margin-bottom: var(--spacing-lg);
  opacity: 0.9;
}

.brand-features {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 14px;
}

.feature-item i {
  font-size: 18px;
  background: rgba(255, 255, 255, 0.15);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-item span {
  font-size: var(--font-size-base);
  font-weight: 500;
}

/* Login Section Styles */
.auth-login-section {
  flex: 0.8;
  padding: 60px 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* -------------------------------------------
 * 4. MAIN LAYOUT - Fixed sidebar positioning
 * ------------------------------------------- */
#content-view {
  display: none;
}

/* Header Styles */
.app-header {
  height: var(--header-height);
  background-color: var(--card-background);
  box-shadow: 0 1px 10px var(--shadow-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 25px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 20px;
}

.logo {
  display: flex;
  align-items: center;
  margin-right: 20px;
}

.logo svg {
  margin-right: 12px;
}

.logo span {
  font-weight: 600;
  font-size: 17px;
  color: var(--text-color);
}

/* Logo link styling */
.logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.logo a:hover {
    opacity: 0.9;
}

.menu-toggle {
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 17px;
  cursor: pointer;
  margin-right: 15px;
  padding: 8px;
  border-radius: var(--border-radius);
  transition: background-color var(--transition-speed) ease;
}

.menu-toggle:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Search Box - Modern styling */
.search-container {
  position: relative;
  max-width: 480px;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: var(--font-size-sm);
}

#search-input {
  width: 100%;
  padding: 10px 15px 10px 40px;
  border: 1px solid var(--border-color);
  border-radius: 30px;
  font-size: var(--font-size-sm);
  background-color: var(--background-color);
  transition: all var(--transition-speed) ease;
}

#search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(235, 145, 16, 0.15);
  background-color: white;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  background-color: white;
  border-radius: var(--card-border-radius);
  box-shadow: 0 6px 20px var(--shadow-color);
  max-height: 80vh;
  overflow-y: auto;
  z-index: 110;
  display: none;
}

.search-results.active {
  display: block;
}

/* Improved highlight styling */
.highlight-section {
  animation: highlight-pulse 2s;
  position: relative;
  z-index: 2;
}

.highlight-section-parent {
  animation: highlight-pulse-light 2s;
}

@keyframes highlight-pulse {
  0%, 50% {
    background-color: rgba(255, 233, 167, 0.5);
    box-shadow: 0 0 10px rgba(235, 145, 16, 0.3);
  }
  100% {
    background-color: transparent;
    box-shadow: none;
  }
}

@keyframes highlight-pulse-light {
  0%, 40% {
    background-color: rgba(255, 233, 167, 0.2);
  }
  100% {
    background-color: transparent;
  }
}

.search-results-header {
  padding: 12px 15px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  font-size: var(--font-size-sm);
}

.search-results-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.search-result-item {
  padding: 12px 15px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color var(--transition-speed) ease;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background-color: rgba(235, 145, 16, 0.05);
}

.search-result-title {
  font-weight: 500;
  margin-bottom: 5px;
  color: var(--text-color);
}

.search-result-snippet {
  font-size: var(--font-size-sm);
  color: var(--text-light);
  margin: 0;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-highlight {
  background-color: rgba(235, 145, 16, 0.2);
  border-radius: 2px;
  padding: 0 2px;
  font-weight: 500;
}

.search-no-results {
  padding: 15px;
  text-align: center;
  color: var(--text-light);
}

/* Improved search styling */
.search-result-group {
  padding: 0;
  border-bottom: 1px solid var(--border-color);
}

.search-result-group:last-child {
  border-bottom: none;
}

.search-result-doc-title {
  font-weight: 600;
  padding: 12px 15px 8px;
  color: var(--primary-color);
  font-size: var(--font-size-sm);
}

/* Add scroll styling */
.search-results::-webkit-scrollbar {
  width: 8px;
}

.search-results::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.2);
}

/* User Profile - Modern styling */
.user-profile {
  display: flex;
  align-items: center;
  position: relative;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  margin-right: 10px;
  background-color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid rgba(235, 145, 16, 0.2);
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-avatar.no-photo {
  background-color: var(--primary-color);
}

.user-info-container {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 500;
  font-size: var(--font-size-sm);
  color: var(--text-color);
}

.user-email {
  font-size: 12px;
  color: var(--text-light);
}

.user-menu-toggle {
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  padding: 8px;
  margin-left: 5px;
  border-radius: 50%;
  transition: background-color var(--transition-speed) ease;
}

.user-menu-toggle:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  width: 260px;
  z-index: 100;
  overflow: hidden;
  display: none; /* Add this line to hide by default */
}

.user-dropdown.active {
  display: block;
}

.user-dropdown-header {
  padding: 15px;
  border-bottom: 1px solid var(--border-color);
}

.user-dropdown-email {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 5px;
}

.user-dropdown-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.user-dropdown-item {
  padding: 12px 15px;
  cursor: pointer;
  transition: background-color var(--transition-speed) ease;
  display: flex;
  align-items: center;
}

.user-dropdown-item:hover {
  background-color: rgba(235, 145, 16, 0.05);
}

.user-dropdown-item i {
  margin-right: 10px;
  width: 20px;
  text-align: center;
  color: var(--text-light);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.main-content {
  display: flex;
  padding-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
  width: 100%;
}

/* FIXED SIDEBAR POSITIONING */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--card-background);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  position: fixed;
  top: var(--header-height); /* Position below header */
  left: 0;
  height: calc(100vh - var(--header-height)); /* Height is viewport minus header */
  z-index: 90;
  box-shadow: 1px 0 5px var(--shadow-color);
  padding-bottom: var(--spacing-md);
  transition: transform var(--transition-speed) ease;
}

/* Content positioning */
.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: var(--spacing-lg);
  min-height: calc(100vh - var(--header-height));
}

#content-container {
  max-width: 1000px;
  margin: 20px auto 0;
  padding-bottom: var(--spacing-lg);
}

/* -------------------------------------------
 * 5. TABLE OF CONTENTS & NAVIGATION
 * ------------------------------------------- */
.toc-container {
  padding: var(--spacing-md);
}
.toc-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}
.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc-item {
  margin-bottom: 6px;
}
.toc-item a {
  display: block;
  padding: 8px 12px;
  color: var(--text-light);
  text-decoration: none;
  border-radius: var(--border-radius);
  font-weight: 400;
  transition: all var(--transition-speed) ease;
  font-size: var(--font-size-sm);
}
.toc-item a:hover {
  color: var(--primary-color);
  background-color: rgba(235,145,16,0.08);
}
.toc-item.active a {
  color: var(--primary-color);
  background-color: rgba(235,145,16,0.12);
  font-weight: 500;
}
.toc-home-link { margin-bottom: 20px; }
.toc-home-button {
  display: flex;
  align-items: center;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: var(--border-radius);
  transition: background-color var(--transition-speed) ease;
  background-color: rgba(235,145,16,0.08);
}
.toc-home-button:hover { background-color: rgba(235,145,16,0.15); }
.toc-home-button i { margin-right: 8px; font-size: 14px; }
.toc-item.loading > a {
  color: var(--text-light);
  pointer-events: none;
  opacity: 0.7;
  cursor: not-allowed;
  position: relative;
}
.toc-spinner {
  display: inline-block;
  margin-left: 0.5em;
  font-size: 0.95em;
  vertical-align: middle;
}
.toc-spinner .fa-spinner { color: var(--primary-color); }

/* -------------------------------------------
 * 6. UNIFIED CONTENT - Sleeker cards
 * ------------------------------------------- */
.content-unified {
  margin-bottom: var(--spacing-lg);
}

.content-header {
  text-align: center;
  margin-bottom: var(--spacing-lg);
}

.content-header h1 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-bottom: 15px;
  color: var(--text-color);
}

.content-header .description {
  font-size: var(--font-size-md);
  color: var(--text-light);
  margin-bottom: var(--spacing-lg);
}

.content-sections {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.content-section {
  scroll-margin-top: calc(var(--header-height) + var(--spacing-md));
}

.section-card {
  background-color: var(--card-background);
  border-radius: var(--card-border-radius);
  box-shadow: 0 5px 15px var(--shadow-color);
  padding: var(--spacing-lg);
  overflow: hidden;
  transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
  border: 1px solid var(--border-color);
}

.section-card:hover {
  background-color: #faf8f3; /* subtle highlight */
  border-color: var(--primary-color);
}

/* -------------------------------------------
 * 7. GITHUB HTML CONTENT - Enterprise styling
 * ------------------------------------------- */
.github-html-content {
  font-family: 'Aptos', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
}

.github-html-content h1,
.github-html-content h2,
.github-html-content h3,
.github-html-content h4,
.github-html-content h5,
.github-html-content h6 {
  margin-top: 24px;
  margin-bottom: 16px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-color);
}

.github-html-content h1 {
  font-size: 26px;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border-color);
}

.github-html-content h2 {
  font-size: 22px;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border-color);
}

.github-html-content h3 {
  font-size: 18px;
}

.github-html-content h4 {
  font-size: var(--font-size-md);
}

.github-html-content p,
.github-html-content ul,
.github-html-content ol {
  margin-bottom: 16px;
}

.github-html-content a {
  color: var(--primary-color);
  text-decoration: none;
}

.github-html-content a:hover {
  text-decoration: underline;
}

.github-html-content img {
  max-width: 100% !important;
  height: auto !important;
  box-sizing: border-box;
  border-radius: 8px;
  box-shadow: 0 4px 8px var(--shadow-color);
  margin: 1em 0;
}

.github-html-content pre {
  background-color: #f6f8fa;
  border-radius: var(--border-radius);
  padding: 16px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin-bottom: 16px;
}

.github-html-content code {
  font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 85%;
  background-color: rgba(27, 31, 35, 0.05);
  padding: 0.2em 0.4em;
  border-radius: 3px;
}

.github-html-content pre code {
  background-color: transparent;
  padding: 0;
}

.github-html-content blockquote {
  padding: 0.5em 1em;
  color: var(--text-light);
  border-left: 4px solid var(--primary-color);
  background-color: rgba(235, 145, 16, 0.05);
  margin: 1em 0;
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.github-html-content table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 16px;
  overflow-x: auto;
  display: block;
  -webkit-overflow-scrolling: touch;
}

.github-html-content table th,
.github-html-content table td {
  border: 1px solid #dfe2e5;
  padding: 8px 13px;
}

.github-html-content table th {
  background-color: #f6f8fa;
  font-weight: 600;
}

.github-html-content table tr:nth-child(even) {
  background-color: #f8f8f8;
}

.github-html-content ul,
.github-html-content ol {
  padding-left: 2em;
  margin: 1em 0;
}

/* Force content to respect container width */
.github-html-content * {
  max-width: 100%;
  box-sizing: border-box;
}

/* GitHub anchor links styling */
.github-html-content .anchor {
  float: left;
  padding-right: 4px;
  margin-left: -20px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* Only show anchors on hover for better UX */
.github-html-content h1:hover .anchor,
.github-html-content h2:hover .anchor,
.github-html-content h3:hover .anchor,
.github-html-content h4:hover .anchor,
.github-html-content h5:hover .anchor,
.github-html-content h6:hover .anchor {
  opacity: 0.5;
}

.github-html-content .anchor:hover {
  opacity: 1;
}

/* Adjust heading positioning to accommodate anchors */
.github-html-content h1,
.github-html-content h2,
.github-html-content h3,
.github-html-content h4,
.github-html-content h5,
.github-html-content h6 {
  position: relative;
}

/* Octicon styling */
.github-html-content .octicon-link {
  color: var(--text-light);
  vertical-align: middle;
}

/* To completely hide anchors, uncomment this rule */
/*
.github-html-content .anchor {
  display: none !important;
}
*/

/* Modern Loading Spinner */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(235, 145, 16, 0.2);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s linear infinite, fadeIn 0.5s forwards;
  margin-bottom: 15px;
  opacity: 0;
}

.loading-text {
  color: var(--text-light);
  font-size: var(--font-size-sm);
  font-weight: 500;
}

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

@keyframes fadeIn {
  to { opacity: 1; }
}

.error-message {
  background-color: #fff5f5;
  border-left: 4px solid #e74c3c;
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  padding: var(--spacing-lg);
  margin: var(--spacing-lg) 0;
}

.error-message h2 {
  color: #e74c3c;
  margin-bottom: 10px;
}

/* -------------------------------------------
 * 8. HOME PAGE - Enterprise grid styling
 * ------------------------------------------- */
.home-page {
  padding: 0 var(--spacing-md);
}

.home-page h1 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-bottom: var(--spacing-md);
  color: var(--text-color);
  text-align: center;
}

.home-page .description {
  font-size: var(--font-size-md);
  color: var(--text-light);
  margin-bottom: var(--spacing-lg);
  text-align: center;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.section-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 25px;
}

.home-page .section-card {
  background-color: var(--card-background);
  border-radius: var(--card-border-radius);
  box-shadow: 0 5px 15px var(--shadow-color);
  padding: 25px;
  transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--border-color);
}

.home-page .section-card:hover {
  background-color: #faf8f3; /* subtle highlight */
  border-color: var(--primary-color);
}

.home-page .section-card.test-run-card {
  border-color: var(--accent-color);
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.home-page .section-card.test-run-card:hover {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  border-color: var(--accent-color);
  box-shadow: 0 8px 25px rgba(0, 120, 212, 0.2);
}

.home-page .section-card.test-run-card h2 {
  color: var(--accent-color);
}

.home-page .section-card.test-run-card h2 i {
  margin-right: 8px;
}

.home-page .section-card h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 15px;
  color: var(--text-color);
}

.home-page .section-card p {
  margin-bottom: var(--spacing-md);
  color: var(--text-light);
  line-height: 1.6;
  flex-grow: 1;
}

.btn-secondary {
  display: inline-block;
  background-color: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  border-radius: 30px;
  padding: 8px 20px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  text-decoration: none;
  text-align: center;
}

.btn-secondary:hover {
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 3px 8px rgba(235, 145, 16, 0.2);
}

/* Clear session button for error states */
.btn-clear-session {
  margin-top: 10px;
  background-color: #f0f0f0;
  color: #333;
  border: 1px solid #ccc;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: var(--font-size-sm);
}

.btn-clear-session:hover {
  background-color: #e0e0e0;
}

/* Download PDF button */
.btn-download-pdf {
    background: #e53e3e;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 1rem;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
}
.btn-download-pdf i {
    font-size: 1.2em;
}
.btn-download-pdf:hover {
    background: #c53030;
}

/* -------------------------------------------
 * 9. MOBILE RESPONSIVE DESIGN
 * ------------------------------------------- */
@media (max-width: 768px) {
  .menu-toggle { display: block !important; }
  .sidebar { /* ...existing code... */ }
  .sidebar.open { /* ...existing code... */ }
  .sidebar-overlay { /* ...existing code... */ }
  .sidebar-overlay.active { /* ...existing code... */ }
  .content { margin-left: 0; padding: 15px; width: 100%; box-sizing: border-box; }
  .user-name, .user-email, .user-info-container { display: none; }
  .user-avatar { width: 32px; height: 32px; margin-right: 5px; }
  .user-dropdown { right: -10px; width: 240px; }
  .app-header { padding: 0 15px; }
  #page-title { font-size: 16px; margin-left: 15px; }
  .section-cards { grid-template-columns: 1fr; }
  .content-header h1 { font-size: 24px; }
  .github-html-content pre { max-width: 100%; overflow-x: auto; }
  html, body { overflow-x: hidden; width: 100%; max-width: 100vw; position: relative; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  #content-container { width: 100%; padding-left: 15px; padding-right: 15px; box-sizing: border-box; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; }
  .github-html-content { max-width: 100%; overflow-wrap: break-word; word-wrap: break-word; }
  .github-html-content table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .github-html-content img { max-width: 100%; height: auto; }
  .github-html-content pre { max-width: 100%; font-size: 13px; padding: 12px; white-space: pre-wrap; }
  .section-card { width: 100%; box-sizing: border-box; padding: 15px; overflow-x: hidden; }
  .commit-meta { flex-wrap: wrap; gap: 5px; }
  .commit-date { display: block; width: 100%; }
  .commit-link { margin-left: 0; margin-top: 5px; }
  .auth-split-container { flex-direction: column; height: auto; overflow: auto; max-height: none; }
  .auth-brand-section, .auth-login-section { flex: 1; width: 100%; padding: 30px 20px; }
  .auth-background { height: auto; min-height: 100vh; padding: 0; }
  .brand-content { text-align: center; max-width: 100%; }
  .brand-features { align-items: center; margin: 0 auto; max-width: 300px; }
  .auth-container { padding: 30px 20px; margin: 0 auto; }
  .login-header h1 { font-size: 22px; }
  #sidebar { position: fixed; left: 0; top: 0; width: 80vw; max-width: 320px; height: 100vh; background: #fff; z-index: 1001; transform: translateX(-100%); transition: transform 0.3s; box-shadow: 2px 0 8px rgba(0,0,0,0.1); overflow-y: auto; }
  #sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: none; position: fixed; z-index: 1000; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.3); }
  .sidebar-overlay.active { display: block; }
  #menu-toggle { display: block; position: fixed; top: 16px; left: 16px; z-index: 1100; background: #fff; border: none; font-size: 2rem; box-shadow: 0 2px 8px rgba(0,0,0,0.1); border-radius: 50%; width: 48px; height: 48px; }
  .content-container, .content-unified { margin-left: 0 !important; padding: 1rem !important; }
  .toc-container { display: none !important; }
}

@media (max-width: 480px) {
  .content-header h1, .content-header h2 { font-size: 1.2rem !important; }
  .section-card { padding: 0.5rem !important; }
  .user-info-container, .user-dropdown { font-size: 0.9rem !important; }
  .header-center { display: none; }
  .home-page .section-card { padding: 15px; }
  .github-html-content h1 { font-size: 22px; }
  .github-html-content h2 { font-size: 20px; }
  .auth-container { padding: 25px 15px; }
  .btn-primary, .btn-secondary { width: 100%; box-sizing: border-box; }
  .auth-brand-section { padding: 25px 15px; }
  .brand-tagline { font-size: 22px; }
  .brand-logo { width: 90px; margin: 0 auto 20px; }
  .auth-container { padding: 20px 15px; }
  .login-header img { width: 50px; }
}

@media (max-width: 375px) {
  .app-header { padding: 0 10px; }
  .logo img { width: 25px; }
  .content { padding: 10px; }
  .section-card { padding: 15px 10px; }
  .commit-avatar { width: 24px; height: 24px; margin-right: 8px; }
  .commit-message { font-size: 0.8rem; }
  .commit-meta { font-size: 0.7rem; }
}

/* -------------------------------------------
 * 10. CHANGE CONTROL PANEL - New addition
 * ------------------------------------------- */
.change-control-panel {
    margin-top: 2rem;
    padding: 1rem;
    border-radius: 8px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
}

.change-control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.change-control-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #64748b;
    margin: 0;
}

.change-control-toggle {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
}

.change-control-toggle:hover {
    color: #0f172a;
}

.change-control-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.commit-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.commit-item {
    display: flex;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

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

.commit-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 0.75rem;
    background-color: #e2e8f0;
    overflow: hidden;
    flex-shrink: 0;
}

.commit-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.commit-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #3b82f6;
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
}

.commit-details {
    flex: 1;
}

.commit-message {
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0 0 0.25rem 0;
    color: #1e293b;
}

.commit-meta {
    display: flex;
    font-size: 0.75rem;
    color: #64748b;
}

.commit-author {
    margin-right: 0.5rem;
}

.commit-date {
    white-space: nowrap;
}

.commit-link {
    margin-left: auto;
    color: #3b82f6;
    text-decoration: none;
    font-size: 0.75rem;
}

.commit-link:hover {
    text-decoration: underline;
}

/* Document Change Control Panels */
.document-change-control {
    margin-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
    font-size: 0.9rem;
}

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

.change-control-title {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.change-control-title i {
    color: #64748b;
}

.change-control-toggle {
    background: none;
    border: none;
    padding: 0.25rem;
    color: #64748b;
    cursor: pointer;
    border-radius: 4px;
}

.change-control-toggle:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

.change-control-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.change-control-content.collapsed {
    max-height: 0;
    overflow: hidden;
}

.change-control-loading {
    color: #64748b;
    padding: 0.5rem 0;
    font-style: italic;
}

.change-control-error {
    color: #ef4444;
    padding: 0.5rem 0;
}

.change-control-empty {
    color: #64748b;
    padding: 0.5rem 0;
    font-style: italic;
}

.commit-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.commit-item {
    display: flex;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

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

.commit-item.view-more {
    justify-content: center;
    padding-top: 0.5rem;
}

.view-more-link {
    color: #3b82f6;
    text-decoration: none;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.view-more-link:hover {
    text-decoration: underline;
}

.commit-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    margin-right: 0.75rem;
    background-color: #e2e8f0;
    overflow: hidden;
    flex-shrink: 0;
}

.commit-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.commit-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #3b82f6;
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
}

.commit-details {
    flex: 1;
}

.commit-message {
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0 0 0.25rem 0;
    color: #1e293b;
}

.commit-meta {
    display: flex;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: #64748b;
    align-items: center;
}

.commit-author {
    margin-right: 0.5rem;
    font-weight: 500;
}

.commit-date {
    white-space: nowrap;
}

.commit-link {
    margin-left: auto;
    color: #3b82f6;
    text-decoration: none;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.commit-link:hover {
    text-decoration: underline;
}

/* Make history panels more subtle in print mode */
@media print {
    .document-change-control {
        display: none;
    }
}

/* -------------------------------------------
 * 11. POWERSHELL CODE STYLING
 * ------------------------------------------- */
/* PowerShell Code Styling */
.code-container {
  margin: 1.5rem 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background-color: #1e1e1e;
  color: #e2e2e2;
}

.code-filename {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: var(--font-size-sm);
}

.copy-button {
  background-color: rgba(255, 255, 255, 0.1);
  color: #e2e2e2;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.2s ease;
}

.copy-button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.copy-button.copied {
  background-color: #4CAF50;
  color: white;
}

.powershell-code {
  margin: 0;
  padding: 16px;
  background-color: #1e1e1e;
  color: #d4d4d4;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: var(--font-size-sm);
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
  tab-size: 4;
}

/* PowerShell syntax highlighting */
.powershell-code .keyword {
  color: #569cd6;
}

.powershell-code .function {
  color: #dcdcaa;
}

.powershell-code .variable {
  color: #9cdcfe;
}

.powershell-code .string {
  color: #ce9178;
}

.powershell-code .comment {
  color: #6a9955;
}

.powershell-code .type {
  color: #4ec9b0;
}

/* -------------------------------------------
 * 12. LOADING PROGRESS - New addition
 * ------------------------------------------- */
.loading-progress {
    text-align: center;
    margin-top: 15px;
}

.progress-text {
    font-size: var(--font-size-sm);
    margin-bottom: 8px;
    color: var(--text-light);
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background-color: #eee;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-bar {
    height: 100%;
    background-color: #4CAF50;
    transition: width 0.3s ease;
}

.progressive-loaded {
    animation: fadeIn 0.5s ease;
}

.progressive-badge {
    display: inline-block;
    background-color: #f0f0f0;
    color: var(--text-light);
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    margin-top: 10px;
}

.progressive-badge.complete {
    background-color: #e6f7e6;
    color: #4CAF50;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Print optimization */
@media print {
  body, html {
    background: #fff !important;
    color: #000 !important;
    font-size: 12pt !important;
  }
  #sidebar, .sidebar-overlay, #menu-toggle, .user-info-container, .user-dropdown, .toc-container, .search-bar, .search-results, .content-header .document-metadata, .change-control-loading, .document-change-control, .user-avatar, .user-menu-toggle {
    display: none !important;
  }
  .content-container, .content-unified, .content-sections, .section-card, .github-html-content, .markdown-body {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
    color: #000 !important;
  }
  a {
    color: #000 !important;
    text-decoration: underline !important;
  }
  img {
    max-width: 100% !important;
    height: auto !important;
    page-break-inside: avoid;
  }
  h1, h2, h3, h4, h5, h6 {
    color: #000 !important;
    page-break-after: avoid;
  }
  .content-section {
    page-break-inside: avoid;
    break-inside: avoid;
  }
}