/* ============================================
   Documentation Pages
   Premium Audio Spectrum Theme
   ============================================ */

/* Layout */
.doc-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  width: 100%;
  background:
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(107, 63, 255, 0.08), transparent),
    radial-gradient(ellipse 50% 30% at 10% 90%, rgba(255, 77, 138, 0.06), transparent),
    #050312;
  color: var(--color-text);
  position: relative;
}

/* Decorative blob */
.doc-page::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  top: -150px;
  right: -150px;
  background: radial-gradient(circle, rgba(107, 63, 255, 0.1), transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

.doc-main {
  display: flex;
  flex: 1;
  justify-content: center;
  width: 100%;
  padding: var(--space-8) var(--space-4);
  position: relative;
  z-index: 1;
}

.doc-container {
  display: flex;
  width: 100%;
  max-width: var(--container-max);
  gap: var(--space-8);
}

/* Sidebar */
.doc-sidebar {
  display: none;
  flex-direction: column;
  flex-shrink: 0;
  width: 256px;
  gap: var(--space-4);
  padding-right: var(--space-4);
  border-right: 1px solid var(--color-border);
  position: sticky;
  top: calc(var(--header-height) + var(--space-4));
  max-height: calc(100vh - var(--header-height) - var(--space-8));
  overflow-y: auto;
}

.doc-sidebar__label {
  margin-bottom: var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--color-accent);
  text-shadow: 0 0 15px rgba(255, 126, 182, 0.4);
}

.doc-sidebar__nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--space-6);
  font-size: var(--text-sm);
}

.doc-sidebar__section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.doc-sidebar__section-title {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-faint);
}

.doc-sidebar__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.doc-sidebar__link {
  display: block;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  transition: background var(--transition-normal), color var(--transition-normal);
}

.doc-sidebar__link:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

.doc-sidebar__link.active {
  background: linear-gradient(135deg, rgba(107, 63, 255, 0.15), rgba(255, 77, 138, 0.1));
  color: var(--color-text);
  border-left: 2px solid var(--color-accent);
}

/* Content area */
.doc-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  gap: var(--space-6);
}

/* Breadcrumbs */
.doc-breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.doc-breadcrumbs__link {
  color: var(--color-text-muted);
  transition: color var(--transition-normal);
}

.doc-breadcrumbs__link:hover {
  color: var(--color-accent);
}

.doc-breadcrumbs__separator {
  color: var(--color-text-faint);
}

.doc-breadcrumbs__current {
  color: var(--color-text);
}

/* Header with title and search */
.doc-content__header {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-2);
}

.doc-content__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--color-text);
}

/* Search */
.doc-search {
  position: relative;
  width: 100%;
  max-width: 256px;
}

.doc-search__input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: rgba(10, 6, 24, 0.88);
  color: var(--color-text);
  font-size: var(--text-sm);
  outline: none;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.doc-search__input::placeholder {
  color: var(--color-text-faintest);
}

.doc-search__input:focus {
  border-color: rgba(107, 63, 255, 0.5);
  box-shadow: 0 0 0 2px rgba(107, 63, 255, 0.2), 0 0 20px rgba(107, 63, 255, 0.1);
}

.doc-search__results {
  position: absolute;
  z-index: 10;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: var(--space-1);
  max-height: 320px;
  overflow-y: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: rgba(10, 6, 24, 0.97);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(107, 63, 255, 0.1);
}

.doc-search__results-empty {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-subtle);
}

.doc-search__results-list {
  padding: var(--space-1) 0;
  font-size: var(--text-sm);
}

.doc-search__result {
  display: block;
  padding: var(--space-2) var(--space-3);
  transition: background var(--transition-normal);
}

.doc-search__result:hover {
  background: var(--color-surface);
}

.doc-search__result-title {
  font-weight: var(--font-medium);
  color: var(--color-text);
}

.doc-search__result-desc {
  font-size: var(--text-xs);
  color: var(--color-text-subtle);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Article content */
.doc-article {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* Article header */
.doc-article__header {
  margin-bottom: var(--space-8);
  opacity: 0;
  transform: translateY(20px);
  animation: docFadeIn 0.5s ease-out forwards;
}

@keyframes docFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.doc-article__label {
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--color-accent);
  text-shadow: 0 0 15px rgba(255, 126, 182, 0.4);
}

.doc-article__title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--color-text);
  margin-bottom: var(--space-4);
  letter-spacing: var(--tracking-tight);
}

@media (min-width: 640px) {
  .doc-article__title {
    font-size: var(--text-4xl);
  }
}

.doc-article__intro {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 42rem;
  line-height: var(--leading-relaxed);
}

.doc-article__intro + .doc-article__intro {
  margin-top: var(--space-3);
}

/* Card component with reveal animation */
.doc-card {
  padding: var(--space-6);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--color-border);
  background: rgba(10, 6, 24, 0.82);
  opacity: 0;
  transform: translateY(20px);
  animation: cardReveal 0.4s ease-out forwards;
}

/* Staggered animation delays for cards */
.doc-card:nth-of-type(1) { animation-delay: 0.1s; }
.doc-card:nth-of-type(2) { animation-delay: 0.15s; }
.doc-card:nth-of-type(3) { animation-delay: 0.2s; }
.doc-card:nth-of-type(4) { animation-delay: 0.25s; }
.doc-card:nth-of-type(5) { animation-delay: 0.3s; }
.doc-card:nth-of-type(6) { animation-delay: 0.35s; }

@keyframes cardReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.doc-card--info {
  border-color: rgba(107, 63, 255, 0.3);
  background: linear-gradient(135deg, rgba(107, 63, 255, 0.08), transparent);
}

.doc-card--warning {
  border-color: rgba(255, 180, 100, 0.3);
  background: linear-gradient(135deg, rgba(255, 180, 100, 0.08), transparent);
}

.doc-card__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-4);
}

.doc-card__text {
  color: var(--color-text-muted);
  line-height: var(--leading-relaxed);
}

/* Doc figures (screenshots, illustrations) */
.doc-figure {
  margin-top: var(--space-5);
}

.doc-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.doc-figure__caption {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Step cards (numbered) with reveal */
.doc-step {
  padding: var(--space-6);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--color-border);
  background: rgba(10, 6, 24, 0.82);
  opacity: 0;
  transform: translateY(20px);
  animation: cardReveal 0.4s ease-out forwards;
}

.doc-step:nth-of-type(1) { animation-delay: 0.1s; }
.doc-step:nth-of-type(2) { animation-delay: 0.2s; }
.doc-step:nth-of-type(3) { animation-delay: 0.3s; }
.doc-step:nth-of-type(4) { animation-delay: 0.4s; }
.doc-step:nth-of-type(5) { animation-delay: 0.5s; }

.doc-step__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.doc-step__number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  color: var(--color-text);
  box-shadow: 0 0 15px rgba(107, 63, 255, 0.4);
}

.doc-step__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-text);
}

/* Lists */
.doc-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.doc-list--indent {
  margin-left: 44px;
}

.doc-list__item {
  display: flex;
  gap: var(--space-3);
  color: var(--color-text-muted);
  line-height: var(--leading-relaxed);
}

.doc-list__bullet {
  color: var(--color-accent);
  font-weight: var(--font-semibold);
  flex-shrink: 0;
}

.doc-list__text strong {
  color: var(--color-text);
}

/* Blockquote */
.doc-blockquote {
  padding-left: var(--space-4);
  border-left: 2px solid var(--gradient-primary);
  border-image: var(--gradient-primary) 1;
}

.doc-blockquote__item {
  color: var(--color-text-muted);
  font-style: italic;
  margin-bottom: var(--space-2);
}

/* Grid for languages */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.doc-grid__item {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: rgba(10, 6, 24, 0.82);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.doc-grid__flags {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.doc-grid__flag {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  display: block;
  flex-shrink: 0;
}

.doc-grid__flag-separator {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1;
}

/* Warning card with icon */
.doc-warning {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.doc-warning__icon {
  font-size: var(--text-2xl);
  flex-shrink: 0;
}

.doc-warning__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-text);
}

/* Footer note */
.doc-footer-note {
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

/* Links in doc */
.doc-link {
  color: var(--color-accent);
  font-weight: var(--font-semibold);
  transition: all var(--transition-normal);
}

.doc-link:hover {
  color: var(--color-text);
  text-shadow: 0 0 15px rgba(255, 126, 182, 0.5);
}

/* Table of Contents (right sidebar on large screens) */
.doc-toc {
  display: none;
  position: sticky;
  top: calc(var(--header-height) + var(--space-4));
  max-height: calc(100vh - var(--header-height) - var(--space-8));
  overflow-y: auto;
  width: 200px;
  padding-left: var(--space-4);
  border-left: 1px solid var(--color-border-subtle);
}

.doc-toc__title {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-faint);
  margin-bottom: var(--space-3);
}

.doc-toc__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.doc-toc__link {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  transition: color var(--transition-normal);
}

.doc-toc__link:hover {
  color: var(--color-accent);
}

.doc-toc__link.active {
  color: var(--color-accent);
}

/* Responsive */
@media (min-width: 640px) {
  .doc-sidebar {
    display: flex;
  }

  .doc-content__header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .doc-search {
    display: block;
  }

  .doc-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1200px) {
  .doc-toc {
    display: block;
  }

  .doc-container {
    gap: var(--space-6);
  }
}

/* Mobile sidebar toggle */
.doc-mobile-nav {
  display: block;
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  background: rgba(10, 6, 24, 0.82);
}

@media (min-width: 640px) {
  .doc-mobile-nav {
    display: none;
  }
}

.doc-mobile-nav__title {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.doc-mobile-nav__title::before {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
}

.doc-mobile-nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.doc-mobile-nav__link {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  transition: all var(--transition-normal);
}

.doc-mobile-nav__link:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
  border-color: var(--color-border);
}

.doc-mobile-nav__link.active {
  background: linear-gradient(135deg, rgba(107, 63, 255, 0.2), rgba(255, 77, 138, 0.15));
  border-color: rgba(107, 63, 255, 0.4);
  color: var(--color-text);
}

/* Accordion for mobile nav sections */
.doc-mobile-nav__section {
  margin-bottom: var(--space-3);
}

.doc-mobile-nav__section-title {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-faint);
  margin-bottom: var(--space-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.doc-mobile-nav__section-title::after {
  content: '+';
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  transition: transform var(--transition-normal);
}

.doc-mobile-nav__section.expanded .doc-mobile-nav__section-title::after {
  content: '-';
}

.doc-mobile-nav__section-content {
  display: none;
}

.doc-mobile-nav__section.expanded .doc-mobile-nav__section-content {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .doc-article__header,
  .doc-card,
  .doc-step {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .doc-page::before {
    display: none;
  }
}
