/* Pebble Documentation Site - Supplemental Stylesheet */
/* Works alongside the main site styles.css */
/* Version: 2.0.0 */

/* ===== DOCS-SPECIFIC VARIABLES ===== */
:root {
  /* Docs Layout */
  --docs-sidebar-width: 260px;
  --docs-content-max-width: 900px;

  /* Docs Colors (consistent with main site) */
  --docs-code-bg: #f1f5f9;
  --docs-code-text: #0891B2;
}

/* ===== DOCS LAYOUT ===== */
.docs-layout {
  display: flex;
  min-height: calc(100vh - 57px); /* Account for main nav height */
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 57px; /* Below main nav */
  left: 0;
  width: 280px;
  max-width: 85vw;
  height: calc(100vh - 57px);
  background: var(--bg-surface, #ffffff);
  border-right: 1px solid var(--border, #e2e8f0);
  overflow-y: auto;
  padding: var(--space-6, 1.5rem);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 100;
}

.sidebar.open {
  transform: translateX(0);
}

/* Sidebar close button - mobile only */
.sidebar-close {
  display: none;
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.sidebar-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
}

@media (max-width: 767px) {
  .sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 57px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

.sidebar-overlay.visible {
  display: block;
}

/* Back Links */
.back-links {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: var(--space-6);
}

.back-to-site,
.back-to-docs {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8125rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.back-to-site:only-child {
  margin-bottom: var(--space-6);
}

.back-to-site:hover,
.back-to-docs:hover {
  background: rgba(6, 182, 212, 0.1);
  color: var(--primary);
}

/* Sidebar Sections */
.sidebar-section {
  margin-bottom: var(--space-8);
}

.sidebar-section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav li {
  margin-bottom: 2px;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.875rem;
  transition: all 0.15s ease;
}

.sidebar-nav .nav-link:hover {
  background: rgba(6, 182, 212, 0.08);
  color: var(--primary);
}

.sidebar-nav .nav-link.active {
  background: var(--primary);
  color: white;
  font-weight: 500;
}

/* Coming Soon Badge */
.coming-soon {
  display: inline-block;
  padding: 1px 6px;
  background: rgba(251, 191, 36, 0.15);
  color: #b45309;
  border-radius: 4px;
  font-size: 0.625rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  margin-left: 0;
  padding: var(--space-6);
  width: 100%;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: var(--space-8);
  position: relative;
  z-index: 1; /* Below main nav (z-index: 1000) */
}

.breadcrumbs a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.breadcrumbs a:hover {
  color: var(--primary);
}

.breadcrumbs .separator {
  color: var(--border);
}

/* ===== CONTENT TYPOGRAPHY ===== */
.content {
  max-width: var(--docs-content-max-width);
}

.content h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: var(--space-4);
  color: var(--primary-dark);
  line-height: 1.2;
}

.content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: var(--space-12);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--border);
  color: var(--text-main);
}

.content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
  color: var(--text-main);
}

.content h4 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
  color: var(--text-main);
}

.content p {
  margin-bottom: var(--space-4);
  line-height: 1.7;
  color: var(--text-muted);
}

.content .lead {
  font-size: 1.125rem;
  color: var(--text-main);
  margin-bottom: var(--space-6);
}

.content a {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}

.content a:hover {
  border-bottom-color: var(--primary);
}

/* Lists */
.content ul,
.content ol {
  margin-bottom: var(--space-4);
  padding-left: var(--space-8);
  color: var(--text-muted);
}

.content li {
  margin-bottom: var(--space-2);
  line-height: 1.7;
}

.content li strong {
  color: var(--text-main);
}

/* Code Blocks */
.content code {
  font-family: 'Fira Code', 'SF Mono', 'Consolas', monospace;
  font-size: 0.875rem;
  padding: 2px 6px;
  background: var(--docs-code-bg);
  border-radius: 4px;
  color: var(--docs-code-text);
}

.content pre {
  background: var(--off-white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  overflow-x: auto;
  position: relative;
}

.content pre code {
  background: none;
  padding: 0;
  color: var(--text-main);
  font-size: 0.8125rem;
  line-height: 1.6;
}

/* Code block wrapper for copy button positioning */
.code-block-wrapper {
  position: relative;
}

/* Copy button - modern inline style */
.copy-button {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s ease;
  font-family: inherit;
}

.code-block-wrapper:hover .copy-button {
  opacity: 1;
}

.copy-button:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.copy-button.copied {
  background: var(--success, #10b981);
  color: white;
  border-color: var(--success, #10b981);
  opacity: 1;
}

/* Callouts */
.callout {
  padding: var(--space-4);
  border-radius: 8px;
  margin-bottom: var(--space-4);
  border-left: 4px solid;
}

.callout p {
  margin-bottom: var(--space-2);
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout.info {
  background: rgba(6, 182, 212, 0.08);
  border-left-color: var(--primary);
}

.callout.warning {
  background: rgba(251, 191, 36, 0.1);
  border-left-color: #fbbf24;
}

.callout.error {
  background: rgba(239, 68, 68, 0.08);
  border-left-color: #ef4444;
}

.callout.success {
  background: rgba(16, 185, 129, 0.08);
  border-left-color: #10b981;
}

/* Callout Icons */
.callout-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  margin-right: 6px;
  flex-shrink: 0;
}

/* Tables */
.content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-4);
  font-size: 0.875rem;
}

.content th,
.content td {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  text-align: left;
}

.content th {
  background: var(--off-white);
  font-weight: 600;
  color: var(--text-main);
}

.content td {
  color: var(--text-muted);
}

/* Table status icons */
.status-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  vertical-align: -2px;
}

.status-check { color: #10b981; }
.status-x { color: #ef4444; }
.status-alert { color: #f59e0b; }
.status-circle-green { color: #10b981; }
.status-circle-red { color: #ef4444; }
.status-circle-yellow { color: #f59e0b; }

/* Docs Footer */
.docs-footer {
  margin-top: var(--space-12);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.docs-footer a {
  color: var(--primary);
  text-decoration: none;
}

.docs-footer a:hover {
  text-decoration: underline;
}

/* ===== MOBILE SIDEBAR TOGGLE ===== */
.docs-sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2, 0.5rem);
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-top: none;
  border-radius: 0;
  color: var(--text-muted, #64748b);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  /* Fixed positioning on mobile */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  margin: 0;
  z-index: 90;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.docs-sidebar-toggle:hover {
  background: var(--bg-surface);
  color: var(--primary);
  border-color: var(--primary);
}

.docs-sidebar-toggle svg {
  width: 18px;
  height: 18px;
}

/* ===== RESPONSIVE ===== */

/* Tablet and up (768px) */
@media (min-width: 768px) {
  .sidebar {
    position: fixed;
    width: var(--docs-sidebar-width);
    max-width: none;
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none !important;
  }

  .main-content {
    margin-left: var(--docs-sidebar-width);
    padding: var(--space-8);
  }

  .docs-sidebar-toggle {
    display: none;
  }

  .content h1 {
    font-size: 2.5rem;
  }

  .content h2 {
    font-size: 1.75rem;
  }

  .content h3 {
    font-size: 1.375rem;
  }

  .docs-footer {
    flex-direction: row;
    text-align: left;
  }
}

/* Mobile adjustments */
@media (max-width: 767px) {
  .content table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .docs-footer {
    flex-direction: column;
    gap: var(--space-4);
    text-align: center;
  }

  /* Add bottom padding to main content to account for fixed toggle button */
  .main-content {
    padding-bottom: calc(var(--space-6) + 52px); /* Button height + extra space */
  }
}

/* Docs page mobile - both nav systems coexist */
/* Main nav hamburger: site-wide navigation (Features, Docs, Tools, etc.) */
/* Docs sidebar toggle: docs-specific table of contents */
@media (max-width: 767px) {
  /* Ensure docs sidebar sits below main nav's mobile menu z-index (999) */
  .is-docs-page .sidebar {
    z-index: 98; /* Below mobile-menu (999) but still above content */
  }

  .is-docs-page .sidebar-overlay {
    z-index: 97;
  }

  /* Ensure main mobile menu appears above docs sidebar when open */
  .is-docs-page .mobile-menu {
    z-index: 999;
  }
}

/* ===== CHANGELOG STYLES ===== */
.version-date {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: var(--space-2);
}

.version-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-1) var(--space-2);
  border-radius: 4px;
  margin-left: var(--space-2);
  vertical-align: middle;
}

.version-badge.current {
  background: rgba(6, 182, 212, 0.15);
  color: var(--primary);
}

/* ===== DARK MODE ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --docs-code-bg: #1e293b;
    --docs-code-text: #22d3ee;
  }

  .sidebar {
    background: #0F172A;
    border-color: rgba(255, 255, 255, 0.06);
  }

  .back-to-site:hover,
  .back-to-docs:hover {
    background: rgba(34, 211, 238, 0.1);
    color: var(--primary-light);
  }

  .sidebar-nav .nav-link {
    color: var(--text-subtle);
  }

  .sidebar-nav .nav-link:hover {
    background: rgba(34, 211, 238, 0.1);
    color: var(--primary-light);
  }

  .sidebar-nav .nav-link.active {
    background: var(--primary);
    color: white;
  }

  .coming-soon {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
  }

  .content h1 {
    color: var(--primary-light);
  }

  .content code {
    background: var(--docs-code-bg);
    color: var(--docs-code-text);
  }

  .content pre {
    background: var(--bg-elevated);
    border-color: var(--border-default);
  }

  .content pre code {
    color: var(--text-body);
  }

  .content th {
    background: var(--bg-elevated);
    color: var(--text-heading);
  }

  .content td {
    border-color: var(--border-default);
    color: var(--text-body);
  }

  .callout.info {
    background: rgba(34, 211, 238, 0.1);
  }

  .copy-button {
    background: rgba(30, 41, 59, 0.9);
    border-color: var(--border-default);
    color: var(--text-subtle);
  }

  .copy-button:hover {
    background: var(--primary);
    border-color: var(--primary);
  }

  .docs-sidebar-toggle {
    background: var(--bg-elevated, #1e293b);
    border-color: var(--border-default, #334155);
    color: var(--text-body, #cbd5e1);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
  }

  .docs-sidebar-toggle:hover {
    border-color: var(--primary-light, #22d3ee);
    color: var(--primary-light, #22d3ee);
  }

  .sidebar {
    background: #0F172A;
    border-color: rgba(255, 255, 255, 0.06);
  }
}
