/* ============================================
   Documentation Page Styles
   ============================================ */

/* Reusing the policy layout from privacy.css for consistency */
.policy {
  padding: 4rem 0;
  min-height: calc(100vh - var(--header-height));
}

@media (max-width: 768px) {
  .policy {
    padding: 32px 0 60px;
  }
}

.policy__title {
  font-size: 2.5rem;
  margin-bottom: 8px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent) 0%, #51cf66 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.policy__subtitle {
  color: var(--text-secondary);
  font-size: 1.125rem;
  margin-bottom: 48px;
}

.policy__layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 48px;
  align-items: start;
}

.policy__content {
  min-width: 0;
}

.policy__section {
  margin-bottom: 48px;
  scroll-margin-top: 100px;
}

.policy__section h2 {
  font-size: 1.75rem;
  margin-bottom: 16px;
  color: var(--text-primary);
  font-weight: 600;
}

.policy__section h3 {
  font-size: 1.25rem;
  margin-bottom: 12px;
  margin-top: 24px;
  color: var(--text-primary);
  font-weight: 600;
}

.policy__section h4 {
  font-size: 1.125rem;
  margin-bottom: 10px;
  margin-top: 20px;
  color: var(--text-primary);
  font-weight: 600;
}

.policy__section p {
  line-height: 1.8;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.policy__section ul,
.policy__section ol {
  margin: 16px 0 16px 24px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.policy__section li {
  margin-bottom: 8px;
}

.policy__section a {
  color: var(--accent);
  text-decoration: underline;
  transition: opacity 0.2s ease;
}

.policy__section a:hover {
  opacity: 0.8;
}

.policy__section strong {
  color: var(--text-primary);
  font-weight: 600;
}

.policy__section code {
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.875rem;
  color: var(--accent);
}

.policy__section pre {
  background: var(--bg-secondary);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--border);
}

.policy__section pre code {
  background: transparent;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.6;
}

.policy__section table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.875rem;
}

.policy__section th,
.policy__section td {
  padding: 12px;
  text-align: left;
  border: 1px solid var(--border);
}

.policy__section th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
}

.policy__section td {
  color: var(--text-secondary);
}

/* Table of Contents (Sticky Sidebar) */
.policy__toc {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.policy__toc-title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  color: var(--text-primary);
}

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

.policy__toc-item {
  margin-bottom: 8px;
}

.policy__toc-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  display: block;
  padding: 4px 0;
  transition: color 0.2s ease;
}

.policy__toc-link:hover {
  color: var(--accent);
}

.policy__toc-link.active {
  color: var(--accent);
  font-weight: 600;
}

/* Docs-specific: Badge styles */
.docs__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: border-color 0.2s ease;
  margin-right: 8px;
  margin-bottom: 8px;
}

.docs__badge:hover {
  border-color: var(--accent);
}

.docs__badges {
  display: flex;
  flex-wrap: wrap;
  margin: 16px 0;
}

/* Docs-specific: Code blocks with language labels */
.docs__code-wrapper {
  position: relative;
  margin: 24px 0;
}

.docs__code-label {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--bg-primary);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* Docs-specific: Benchmarks visualization */
.docs__benchmark {
  margin: 24px 0;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.docs__benchmark-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.docs__benchmark-bar {
  display: flex;
  align-items: center;
  margin: 8px 0;
  font-size: 0.875rem;
  flex-wrap: wrap;
}

.docs__benchmark-label {
  min-width: 120px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.docs__benchmark-visual {
  flex: 1;
  height: 20px;
  background: var(--accent);
  border-radius: 4px;
  margin-right: 12px;
  position: relative;
  overflow: hidden;
  min-width: 100px;
}

.docs__benchmark-value {
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Docs-specific: Note/Tip/Warning boxes */
.docs__note {
  padding: 16px;
  margin: 24px 0;
  border-left: 4px solid var(--accent);
  background: var(--bg-secondary);
  border-radius: 4px;
}

.docs__note-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.docs__note-content {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
}

.docs__note--tip {
  border-left-color: #51cf66;
}

.docs__note--warning {
  border-left-color: #ff6b6b;
}

/* Docs Images */
.docs__image-wrapper {
  margin-top: 2rem;
  text-align: center;
  margin-bottom: 1rem;
}

.docs__image {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Get Started Cards Grid */
.docs__cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.docs__card {
  text-decoration: none;
  color: inherit;
  display: block;
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}

.docs__card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.docs__card h3 {
  color: var(--accent);
  margin-bottom: 0.5rem;
  font-size: 1.125rem;
}

.docs__card p {
  color: var(--text-secondary);
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* Responsive */
@media (max-width: 1024px) {
  .policy__layout {
    grid-template-columns: 1fr;
  }

  .policy__toc {
    position: static;
    max-height: none;
    order: -1;
  }
  
  .docs__benchmark-bar {
    font-size: 0.8125rem;
  }
  
  .docs__benchmark-label {
    min-width: 100px;
  }
}

@media (max-width: 768px) {
  .policy {
    padding: 80px 0 60px;
  }

  .policy__title {
    font-size: 1.75rem;
    line-height: 1.2;
  }

  .policy__subtitle {
    font-size: 1rem;
    margin-bottom: 32px;
    line-height: 1.5;
  }

  .policy__section {
    margin-bottom: 36px;
  }

  .policy__section h2 {
    font-size: 1.5rem;
    margin-bottom: 14px;
    line-height: 1.3;
  }

  .policy__section h3 {
    font-size: 1.125rem;
    margin-bottom: 10px;
    margin-top: 20px;
    line-height: 1.3;
  }

  .policy__section h4 {
    font-size: 1rem;
    margin-bottom: 8px;
    margin-top: 16px;
    line-height: 1.3;
  }

  .policy__section p {
    font-size: 0.9375rem;
    line-height: 1.7;
    margin-bottom: 14px;
  }

  .policy__section ul,
  .policy__section ol {
    margin: 14px 0 14px 20px;
  }

  .policy__section li {
    font-size: 0.9375rem;
    margin-bottom: 6px;
  }

  .policy__section pre {
    padding: 12px;
    font-size: 0.8125rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 12px -8px;
    border-radius: 6px;
  }
  
  .policy__section pre code {
    font-size: 0.8125rem;
    line-height: 1.5;
  }

  .policy__section table {
    font-size: 0.8125rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    margin: 12px -8px;
  }

  .policy__section th,
  .policy__section td {
    padding: 8px 10px;
    min-width: 100px;
    font-size: 0.8125rem;
  }

  .policy__section code {
    font-size: 0.8125rem;
    word-break: break-word;
    padding: 2px 6px;
  }

  /* Mobile-specific TOC styles */
  .policy__toc {
    margin-bottom: 24px;
    padding: 16px;
  }

  .policy__toc-title {
    font-size: 0.875rem;
  }

  .policy__toc-link {
    font-size: 0.8125rem;
    padding: 6px 0;
  }

  /* Ensure container has proper padding on mobile */
  .container {
    padding-left: 20px;
    padding-right: 20px;
  }
  
  /* Docs-specific mobile styles */
  .docs__note {
    padding: 12px;
    margin: 16px -8px;
    border-radius: 6px;
  }
  
  .docs__note-title {
    font-size: 0.8125rem;
  }
  
  .docs__note-content {
    font-size: 0.8125rem;
    line-height: 1.5;
  }
  
  .docs__benchmark {
    padding: 12px;
    margin: 16px -8px;
    border-radius: 6px;
  }
  
  .docs__benchmark-title {
    font-size: 0.875rem;
    margin-bottom: 10px;
  }
  
  .docs__benchmark-bar {
    font-size: 0.75rem;
    margin: 6px 0;
  }
  
  .docs__benchmark-label {
    min-width: 70px;
    font-size: 0.75rem;
  }
  
  .docs__benchmark-visual {
    height: 16px;
    margin-right: 8px;
    min-width: 60px;
  }
  
  .docs__benchmark-value {
    font-size: 0.75rem;
  }
  
  .docs__badges {
    margin: 12px 0;
  }
  
  .docs__badge {
    font-size: 0.8125rem;
    padding: 6px 10px;
    margin-right: 6px;
    margin-bottom: 6px;
  }
  
  .docs__code-wrapper {
    margin: 16px -8px;
  }
  
  .docs__code-label {
    font-size: 0.6875rem;
    padding: 3px 6px;
  }
  
  /* Cards Grid for mobile */
  .docs__cards-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
  }
  
  .docs__card {
    padding: 1.25rem;
  }
  
  .docs__card h3 {
    font-size: 1rem;
    margin-bottom: 0.4rem;
  }
  
  .docs__card p {
    font-size: 0.875rem;
  }
  
  /* Image adjustments for mobile */
  .docs__image-wrapper {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
  }
  
  .docs__image {
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
}

@media (max-width: 480px) {
  .policy {
    padding: 60px 0 40px;
  }

  .policy__title {
    font-size: 1.5rem;
  }

  .policy__subtitle {
    font-size: 0.9375rem;
    line-height: 1.4;
  }

  .policy__section h2 {
    font-size: 1.375rem;
  }

  .policy__section h3 {
    font-size: 1.0625rem;
  }
  
  .policy__section h4 {
    font-size: 0.9375rem;
  }

  .policy__section pre {
    font-size: 0.75rem;
    padding: 10px;
    margin: 10px -12px;
  }
  
  .policy__section pre code {
    font-size: 0.75rem;
    line-height: 1.4;
  }

  .policy__section code {
    padding: 2px 5px;
    font-size: 0.75rem;
  }

  /* Extra small screens - ensure text readability */
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .policy__section table {
    font-size: 0.75rem;
    margin: 10px -12px;
  }

  .policy__section th,
  .policy__section td {
    padding: 6px 8px;
    min-width: 80px;
    font-size: 0.75rem;
  }
  
  .policy__section p {
    font-size: 0.875rem;
  }
  
  .policy__section ul,
  .policy__section ol {
    margin: 12px 0 12px 18px;
  }
  
  .policy__section li {
    font-size: 0.875rem;
    margin-bottom: 5px;
  }
  
  .docs__note {
    padding: 10px;
    margin: 12px -12px;
  }
  
  .docs__note-title {
    font-size: 0.75rem;
  }
  
  .docs__note-content {
    font-size: 0.75rem;
  }
  
  .docs__benchmark {
    padding: 10px;
    margin: 12px -12px;
  }
  
  .docs__benchmark-title {
    font-size: 0.8125rem;
    margin-bottom: 8px;
    line-height: 1.3;
  }
  
  .docs__benchmark-bar {
    font-size: 0.6875rem;
    margin: 5px 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .docs__benchmark-label {
    min-width: auto;
    font-size: 0.6875rem;
    width: 100%;
  }
  
  .docs__benchmark-visual {
    height: 14px;
    margin-right: 0;
    width: 100%;
    min-width: auto;
  }
  
  .docs__benchmark-value {
    font-size: 0.6875rem;
    width: 100%;
    text-align: right;
  }
  
  .docs__badge {
    font-size: 0.75rem;
    padding: 5px 8px;
  }
  
  .docs__code-label {
    font-size: 0.625rem;
    padding: 2px 5px;
  }
  
  .policy__toc {
    padding: 12px;
  }
  
  .policy__toc-title {
    font-size: 0.8125rem;
    margin-bottom: 12px;
  }
  
  .policy__toc-link {
    font-size: 0.75rem;
    padding: 5px 0;
  }
  
  /* Cards Grid for extra small screens */
  .docs__cards-grid {
    gap: 0.875rem;
    margin-top: 1.25rem;
  }
  
  .docs__card {
    padding: 1rem;
    border-radius: 8px;
  }
  
  .docs__card h3 {
    font-size: 0.9375rem;
    margin-bottom: 0.35rem;
  }
  
  .docs__card p {
    font-size: 0.8125rem;
    line-height: 1.5;
  }
  
  /* Image adjustments for small mobile */
  .docs__image-wrapper {
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
  }
  
  .docs__image {
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  }
}

/* Code Copy Button Styles */
.code-copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0;
  transition: all 0.2s ease;
  font-family: system-ui, -apple-system, sans-serif;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.code-copy-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.code-copy-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.code-copy-btn.copied {
  background: var(--success);
  color: white;
  border-color: var(--success);
  opacity: 1 !important;
}

.code-copy-btn.copied::before {
  content: '✓ ';
  margin-right: 0.25rem;
}

/* Show button on code block hover */
pre:hover .code-copy-btn {
  opacity: 1;
}

/* Always show button on mobile */
@media (max-width: 768px) {
  .code-copy-btn {
    opacity: 1;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    top: 0.5rem;
    right: 0.5rem;
  }
}
