/* -----------------------------------------
   Design System & Variable Definitions
   ----------------------------------------- */
:root {
  --bg-primary: #050b14;
  --bg-secondary: #0b1526;
  --bg-tertiary: #14223c;
  --accent-purple: #063e8a;         /* brand primary */
  --accent-blue: #2486c8;           /* brand secondary */
  --accent-purple-glow: rgba(6, 62, 137, 0.15);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --border-color: #1b2f54;
  --border-hover: #264275;
  --gradient-brand: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --max-width: 1200px;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Global Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Typography Helper */
.accent-text {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* -----------------------------------------
   Header & Navigation
   ----------------------------------------- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  height: 72px;
}

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

.logo-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 32px;
  height: 32px;
  transition: var(--transition-smooth);
}

.logo-wrapper:hover .logo {
  transform: rotate(-10deg) scale(1.05);
}

.logo-text {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-body);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-secondary {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

.btn-tiny {
  padding: 4px 8px;
  font-size: 11px;
  background-color: var(--bg-tertiary);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.btn-tiny:hover {
  background-color: var(--accent-purple);
  border-color: var(--accent-purple);
  color: #fff;
}

.btn-icon {
  width: 16px;
  height: 16px;
}

/* -----------------------------------------
   Hero Section
   ----------------------------------------- */
.hero {
  padding: 80px 0 60px 0;
  background: radial-gradient(circle at 75% 20%, var(--accent-purple-glow) 0%, transparent 60%);
  border-bottom: 1px solid var(--border-color);
}

.hero-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 800px;
  margin-left: max(24px, calc((100% - var(--max-width)) / 2 + 24px));
}

.badge {
  background: var(--accent-purple-glow);
  border: 1px solid rgba(6, 62, 137, 0.15);
  color: var(--accent-blue);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 100px;
  letter-spacing: 0.5px;
  margin-bottom: 24px;
  text-transform: uppercase;
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: 48px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 640px;
  margin-bottom: 40px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  width: 100%;
  max-width: 600px;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.meta-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* -----------------------------------------
   Main Document Layout
   ----------------------------------------- */
.main-content {
  display: flex;
  gap: 64px;
  padding-top: 60px;
  padding-bottom: 120px;
}

/* Sidebar TOC */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  position: sticky;
  top: 120px;
  align-self: flex-start;
  height: auto;
}

.toc-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.toc-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition-smooth);
  border-left: 2px solid var(--border-color);
  padding-left: 16px;
  display: block;
}

.toc-link:hover {
  color: var(--text-primary);
  border-left-color: var(--text-muted);
  padding-left: 20px;
}

.toc-link.active {
  color: var(--accent-purple);
  font-weight: 600;
  border-left-color: var(--accent-purple);
  padding-left: 20px;
}

/* Document Body Content */
.doc-body {
  flex-grow: 1;
  max-width: 800px;
}

.doc-section {
  padding-bottom: 60px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--border-color);
}

.doc-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.doc-section h2 {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 24px;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.section-content p {
  color: var(--text-secondary);
  font-size: 16px;
  margin-bottom: 20px;
}

.section-content p strong {
  color: var(--text-primary);
}

.section-content ul, .section-content ol {
  color: var(--text-secondary);
  padding-left: 24px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-content li strong {
  color: var(--text-primary);
}

/* Cards Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin: 32px 0;
}

.card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: var(--transition-smooth);
}

.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.icon-circle svg {
  width: 22px;
  height: 22px;
}

.bg-blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.bg-purple { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.bg-pink { background: linear-gradient(135deg, #ec4899, #be185d); }
.bg-orange { background: linear-gradient(135deg, #f97316, #c2410c); }

.card-header h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  font-size: 14px;
  color: var(--text-secondary);
  flex-grow: 1;
}

.card-purpose {
  font-size: 13px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-purple);
  color: var(--text-secondary);
}

.subsection-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  margin: 40px 0 16px 0;
  color: var(--text-primary);
}

/* SDK Table */
.sdk-table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 24px;
}

.sdk-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.sdk-table th, .sdk-table td {
  padding: 16px 20px;
}

.sdk-table th {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.sdk-table td {
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.sdk-table tr:last-child td {
  border-bottom: none;
}

.sdk-table a {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.sdk-table a:hover {
  text-decoration: underline;
  color: #60a5fa;
}

/* Action Box */
.action-box {
  background-color: rgba(36, 134, 200, 0.05);
  border: 1px solid rgba(36, 134, 200, 0.2);
  border-radius: var(--radius-md);
  padding: 28px;
  margin-top: 24px;
}

.action-box h4 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  color: #8bc5ee;
  margin-bottom: 12px;
}

.action-box p {
  font-size: 14px;
  margin-bottom: 16px;
}

.action-box ol {
  margin-bottom: 16px;
}

.action-box li {
  font-size: 14px;
}

.warning-text {
  color: #dc2626 !important;
}

/* Contact Card */
.contact-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

.contact-info-row {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 15px;
}

.contact-icon {
  width: 20px;
  height: 20px;
  color: var(--accent-purple);
  flex-shrink: 0;
}

.contact-info-row a {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 500;
  margin-left: 6px;
}

.contact-info-row a:hover {
  text-decoration: underline;
}

/* -----------------------------------------
   Footer
   ----------------------------------------- */
.footer {
  margin-top: auto;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 40px 0;
}

.footer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.footer p {
  color: var(--text-muted);
  font-size: 14px;
}

.footer-subtext {
  max-width: 600px;
  font-size: 12px !important;
}

/* -----------------------------------------
   Responsive Layout & Media Queries
   ----------------------------------------- */
@media (max-width: 1024px) {
  .main-content {
    gap: 32px;
  }
  .sidebar {
    width: 220px;
  }
}

@media (max-width: 768px) {
  .main-content {
    flex-direction: column;
    padding-top: 40px;
    padding-bottom: 60px;
  }
  .sidebar {
    position: relative;
    top: 0;
    width: 100%;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
  }
  .toc-nav ul {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
  }
  .toc-link {
    border-left: none;
    border-bottom: 2px solid var(--border-color);
    padding-left: 0;
    padding-bottom: 6px;
  }
  .toc-link:hover, .toc-link.active {
    padding-left: 0;
    border-left-color: transparent;
    border-bottom-color: var(--accent-purple);
  }
  .hero {
    padding: 60px 0 40px 0;
  }
  .hero h1 {
    font-size: 36px;
  }
  .card-grid {
    grid-template-columns: 1fr;
  }
  .meta-grid {
    gap: 16px;
  }
}

/* Print Styles */
@media print {
  body {
    background-color: #fff;
    color: #000;
  }
  .header, .sidebar, .footer, #print-btn, #copy-email-btn {
    display: none !important;
  }
  .main-content {
    padding-top: 0;
  }
  .doc-section {
    page-break-inside: avoid;
    border-bottom: 1px solid #ccc;
  }
  .card {
    background-color: #fff;
    border: 1px solid #ccc;
    color: #000;
  }
}
