* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --secondary: #64748b;
  --accent: #10b981;
  --bg: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-code: #1e293b;
  --text: #0f172a;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  color-scheme: dark;
}

/* Dark Theme */
:root[data-theme="dark"] {
  --primary: #60a5fa;
  --primary-dark: #1e40af;
  --secondary: #94a3b8;
  --accent: #22d3ee;
  --bg: #0f172a;
  --bg-secondary: #1e293b;
  --bg-code: #1e293b;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --border: #334155;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.5);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3);
  color-scheme: dark;
}

/* Fixes tab button text color in dark theme */
:root[data-theme="dark"] .tab-btn {
  color: var(--text-secondary);
}
:root[data-theme="dark"] .tab-btn.active,
:root[data-theme="dark"] .tab-btn:hover {
  color: white;
}

/* Theme toggle styles */
#theme-toggle {
  font-size: 1.2rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: background-color 0.2s;
}

#theme-toggle:hover {
  background: var(--bg-secondary);
}

/* Desktop: theme toggle in nav */
@media (min-width: 769px) {
  .theme-toggle-container {
    margin-left: auto;
  }

  #theme-toggle {
    margin-left: 1rem;
    padding: 0;
  }
}

body {
  font-family: "Inter", sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Header */
.header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--primary);
}

/* Hero Section */
.hero {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  color: white;
  padding: 4rem 0;
  text-align: center;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.25rem;
  opacity: 0.9;
  margin-bottom: 2rem;
}

.badges {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.5rem 1rem;
  border-radius: 1rem;
  font-size: 0.875rem;
  backdrop-filter: blur(10px);
}

.cta-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

.btn-primary {
  background: white;
  color: var(--primary);
}

.btn-primary:hover {
  background: var(--bg-secondary);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: white;
  border: 2px solid white;
}

.btn-secondary:hover {
  background: white;
  color: var(--primary);
}

/* Features Grid */
.features {
  padding: 4rem 0;
  background: var(--bg-secondary);
}

.features-title {
  text-align: center;
  margin-bottom: 1rem;
}

.features-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
  margin-top: 2rem;
}

.feature {
  background: var(--bg);
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: var(--shadow);
  text-align: center;
  flex: 0 1 250px;
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.feature h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* Main Content */
.main {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 3rem;
  padding: 2rem 0;
  max-width: 1400px;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: 100px;
  height: fit-content;
  background: var(--bg-secondary);
  border-radius: 1rem;
  padding: 1.5rem;
}

.sidebar h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}

.sidebar ul {
  list-style: none;
}

.sidebar li {
  margin-bottom: 0.5rem;
}

.sidebar a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s;
}

.sidebar a:hover {
  color: var(--primary);
}

.content {
  max-width: none;
}

.section {
  margin-bottom: 3rem;
  scroll-margin-top: 100px;
}

.section h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}

.section h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 2rem 0 1rem 0;
  color: var(--text);
}

.section p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.section ul {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.section li {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

/* Code Playground */
.playground {
  margin: 2rem 0;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: var(--bg-code);
  width: 100%;
  max-width: 100%;
}

.playground-header {
  background: #334155;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.playground-title {
  color: white;
  font-weight: 500;
  font-size: 0.875rem;
  flex-shrink: 1;
  min-width: 0;
}

.playground-buttons {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.playground-btn {
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  border-radius: 0.25rem;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}

.playground-btn.active {
  background: var(--primary);
  color: white;
}

.playground-btn:not(.active) {
  background: #475569;
  color: #cbd5e1;
}

.playground-btn:hover {
  background: var(--primary-dark);
  color: white;
}

.editor-container {
  height: 300px;
  background: var(--bg-code);
  width: 100%;
  max-width: 100%;
  border: 0;
  overflow: hidden;
  display: block;
}

.output {
  background: #0f172a;
  color: #94a3b8;
  padding: 1rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.875rem;
  border-top: 1px solid #334155;
  min-height: 60px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  word-wrap: break-word;
}

/* Code blocks */
pre {
  background: var(--bg-code);
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.875rem;
  margin: 1rem 0;
}

code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.875rem;
}

.inline-code {
  background: var(--bg-secondary);
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

/* API Table */
.api-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: var(--bg);
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.api-table th,
.api-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

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

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

.api-table code {
  background: var(--bg-secondary);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

.api-details-box {
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: 0.75rem;
  margin-top: 1.5rem;
  text-align: center;
}
.api-details-title {
  margin-bottom: 0.5rem;
  color: var(--text);
}
.api-details-desc {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}
.api-details-link {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.2s;
  background: var(--primary);
  color: white;
}

.api-details-link:hover {
  background: var(--primary-dark);
}

/* Tab navigation - Desktop styles */
.tab-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab-btn {
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
  font-weight: 500;
}

.tab-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.tab-btn:hover {
  background: var(--primary);
  color: white;
}

.tab-content {
  margin-top: 1rem;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Mobile menu hamburger */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 101;
}

.mobile-menu-btn span {
  width: 25px;
  height: 3px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-menu-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Documentation Cards */
.documentation-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.documentation-card {
  background: var(--bg-secondary);
  padding: 2rem;
  border-radius: 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.documentation-card-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.section h3.documentation-card-title {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.documentation-card-desc {
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
  flex-grow: 1;
}

.documentation-card-link-primary {
  background: var(--primary);
  color: white;
  text-decoration: none;
  margin-top: auto;
}

.documentation-card-link-accent {
  background: var(--accent);
  color: white;
  text-decoration: none;
  margin-top: auto;
}

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

  .sidebar {
    position: static;
    order: -1;
    margin-bottom: 2rem;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  /* Prevent horizontal overflow */
  body {
    overflow-x: hidden;
  }

  .main,
  .content,
  .section {
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Mobile menu */
  .mobile-menu-btn {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--bg);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 100;
    border-right: 1px solid var(--border);
  }

  .nav-links.active {
    transform: translateX(0);
  }

  .nav-links a {
    font-size: 1.25rem;
    font-weight: 600;
  }

  /* Header mobile */
  .nav {
    flex-wrap: nowrap;
    gap: 1rem;
  }

  /* Hero mobile */
  .hero {
    padding: 2rem 0;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .badges {
    gap: 0.25rem;
  }

  .badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
  }

  .cta-buttons {
    flex-direction: column;
    align-items: center;
  }

  .btn {
    width: 100%;
    max-width: 300px;
  }

  /* Features mobile */
  .features {
    padding: 2rem 0;
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .feature {
    padding: 1.5rem;
  }

  /* Content mobile */
  .main {
    padding: 1rem 0;
  }

  .section h2 {
    font-size: 1.5rem;
  }

  .section h3 {
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem 0;
  }

  /* Sidebar mobile */
  .sidebar {
    padding: 1rem;
  }

  .sidebar h3 {
    margin-bottom: 0.75rem;
  }

  .sidebar ul {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
  }

  .sidebar a {
    padding: 0.5rem;
    background: var(--bg);
    border-radius: 0.5rem;
    display: block;
    text-align: center;
    font-size: 0.75rem;
  }

  /* Playground mobile - Extra constraints */
  .playground {
    margin: 1rem 0;
    max-width: 100%;
    overflow: hidden;
  }

  .playground-header {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.75rem;
  }

  .playground-title {
    font-size: 0.75rem;
  }

  .playground-buttons {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .playground-btn {
    padding: 0.375rem 0.5rem;
    font-size: 0.65rem;
    min-width: 60px;
  }

  .editor-container {
    height: 250px;
    max-width: 100%;
  }

  .output {
    padding: 0.75rem;
    font-size: 0.75rem;
    max-width: 100%;
    overflow-x: auto;
  }

  /* Code blocks mobile */
  pre {
    padding: 0.75rem;
    font-size: 0.75rem;
    overflow-x: auto;
    max-width: 100%;
  }

  /* Tables mobile */
  .api-table {
    font-size: 0.875rem;
  }

  .api-table th,
  .api-table td {
    padding: 0.75rem 0.5rem;
  }

  /* Tab navigation mobile */
  .install-tabs {
    overflow-x: auto;
    max-width: 100%;
  }

  .tab-buttons {
    display: flex;
    gap: 0.5rem;
    min-width: max-content;
    padding-bottom: 0.5rem;
  }

  .tab-btn {
    white-space: nowrap;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
  }

  .tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
  }

  /* Mobile theme toggle styling */
  .theme-toggle-container {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
  }

  #theme-toggle {
    font-size: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 1rem;
    width: 100%;
    text-align: center;
    transition: all 0.2s;
  }

  #theme-toggle:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
  }
}
