/* ============================================
   CrowGenBot — Documentation Page Styles
   Interactive command docs + terminal simulator
   ============================================ */

/* ── Page Hero ── */
.docs-page-hero {
  padding: 140px 0 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
  background: #000;
}

.docs-page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(88, 101, 242, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 101, 242, 0.12) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none;
  z-index: 0;
}

.docs-page-hero .container {
  position: relative;
  z-index: var(--z-content);
}

.docs-page-hero .back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  text-decoration: none;
  margin-bottom: 40px;
  transition: color 0.2s;
  font-family: var(--font-mono);
}

.docs-page-hero .back-link:hover {
  color: var(--cyan);
}

.docs-page-hero .page-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 16px;
  line-height: 1.1;
  letter-spacing: 2px;
}

.docs-page-hero .page-subtitle {
  font-size: clamp(0.95rem, 1.8vw, 1.15rem);
  color: var(--text-secondary);
  max-width: 650px;
  margin: 0 auto 12px;
  line-height: 1.7;
}

/* ── Terminal Section ── */
.docs-terminal-section {
  padding: 48px 0 32px;
}

.docs-terminal-intro {
  text-align: center;
  margin-bottom: 32px;
}

.docs-section-title {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 12px;
  letter-spacing: 2px;
}

.docs-section-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 600px;
  margin: 0 auto;
}

.docs-section-desc kbd {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: rgba(88, 101, 242, 0.12);
  border: 1px solid rgba(88, 101, 242, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--blurple-light);
}

/* ── Terminal Simulator ── */
.terminal-container {
  background: #000;
  border: 1px solid rgba(88, 101, 242, 0.25);
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.8),
    0 0 80px rgba(88, 101, 242, 0.08),
    inset 0 1px 0 rgba(88, 101, 242, 0.08);
  display: flex;
  flex-direction: column;
  max-width: 800px;
  margin: 0 auto;
}

.terminal-titlebar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: #000;
  border-bottom: 1px solid rgba(88, 101, 242, 0.15);
}

.terminal-dots {
  display: flex;
  gap: 8px;
}

.terminal-dots .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transition: opacity 0.2s;
}

.terminal-dots .dot-red { background: #ff5f57; }
.terminal-dots .dot-yellow { background: #febc2e; }
.terminal-dots .dot-green { background: #28c840; }

.terminal-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
  letter-spacing: 0.5px;
}

.terminal-body {
  padding: 20px;
  min-height: 220px;
  max-height: 400px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(88, 101, 242, 0.3) transparent;
}

.terminal-body::-webkit-scrollbar {
  width: 6px;
}

.terminal-body::-webkit-scrollbar-thumb {
  background: rgba(88, 101, 242, 0.3);
  border-radius: 3px;
}

.terminal-output {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.terminal-line {
  margin-bottom: 4px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.terminal-line.system {
  color: var(--text-muted);
  font-style: italic;
}

.terminal-line.bot-name {
  color: var(--blurple-light);
  font-weight: 600;
  margin-top: 8px;
}

.terminal-line.success {
  color: var(--blurple-light);
}

.terminal-line.error {
  color: var(--blurple-light);
  opacity: 0.7;
}

.terminal-line.warning {
  color: var(--blurple-light);
  opacity: 0.85;
}

.terminal-line.embed-border {
  border-left: 3px solid var(--blurple);
  padding-left: 12px;
  margin: 8px 0;
  background: rgba(88, 101, 242, 0.03);
  border-radius: 0 8px 8px 0;
  padding: 10px 14px 10px 14px;
}

.terminal-line.embed-title {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.terminal-line.embed-field {
  color: var(--text-secondary);
  padding-left: 4px;
  margin-bottom: 2px;
}

.terminal-line.embed-footer {
  color: var(--text-muted);
  font-size: 0.73rem;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(88, 101, 242, 0.08);
}

.terminal-prompt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid rgba(88, 101, 242, 0.15);
  background: #000;
}

.terminal-prompt-symbol {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--blurple-light);
  white-space: nowrap;
  user-select: none;
  font-weight: 700;
}

.terminal-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  outline: none;
  caret-color: var(--blurple-light);
  padding: 0;
}

.terminal-input::placeholder {
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* Terminal typing animation */
.terminal-typing {
  display: inline-flex;
  gap: 4px;
  padding: 6px 0;
}

.terminal-typing span {
  width: 7px;
  height: 7px;
  background: var(--blurple-light);
  border-radius: 50%;
  animation: terminal-bounce 1.4s ease-in-out infinite;
}

.terminal-typing span:nth-child(2) { animation-delay: 0.2s; }
.terminal-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes terminal-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-8px); opacity: 1; }
}

/* ── Search Section ── */
.docs-search-section {
  padding: 0 0 40px;
}

.docs-search-bar {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

.docs-search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.2s;
}

.docs-search-bar:focus-within .docs-search-icon {
  color: var(--blurple-light);
}

.docs-search-input {
  width: 100%;
  padding: 14px 20px 14px 52px;
  background: #000;
  border: 1px solid rgba(88, 101, 242, 0.2);
  border-radius: 14px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.docs-search-input:focus {
  border-color: var(--blurple);
  box-shadow: 0 0 24px rgba(88, 101, 242, 0.1);
}

.docs-search-input::placeholder {
  color: var(--text-muted);
}

/* ── Grid Layout ── */
.docs-layout {
  padding-bottom: 100px;
}

.docs-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 32px;
  align-items: start;
}

/* ── Sidebar Navigation ── */
.docs-sidebar {
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  background: #000;
  border: 1px solid rgba(88, 101, 242, 0.2);
  border-radius: 16px;
  padding: 16px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(88, 101, 242, 0.3) transparent;
}

.docs-sidebar::-webkit-scrollbar {
  width: 4px;
}

.docs-sidebar::-webkit-scrollbar-thumb {
  background: rgba(88, 101, 242, 0.3);
  border-radius: 4px;
}

.sidebar-category {
  padding: 0 12px;
  margin-bottom: 4px;
}

.sidebar-cat-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--blurple-light);
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s;
  user-select: none;
}

.sidebar-cat-title:hover {
  background: rgba(88, 101, 242, 0.08);
}

.sidebar-cat-title .cat-count {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  background: rgba(88, 101, 242, 0.15);
  color: var(--blurple-light);
  padding: 1px 5px;
  border-radius: 6px;
  margin-left: auto;
}

.sidebar-cat-title .cat-arrow {
  transition: transform 0.25s;
  font-size: 0.55rem;
  opacity: 0.5;
}

.sidebar-category.collapsed .cat-arrow {
  transform: rotate(-90deg);
}

.sidebar-category.collapsed .sidebar-cmd-list {
  display: none;
}

.sidebar-cmd-list {
  list-style: none;
  padding: 0;
  margin: 2px 0 0;
}

.sidebar-cmd-item {
  display: block;
  padding: 5px 10px 5px 24px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-decoration: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  border-left: 2px solid transparent;
}

.sidebar-cmd-item:hover {
  color: var(--text-primary);
  background: rgba(88, 101, 242, 0.06);
}

.sidebar-cmd-item.active {
  color: var(--blurple-light);
  background: rgba(88, 101, 242, 0.1);
  border-left-color: var(--blurple);
}

/* ── Main Content Area ── */
.docs-main {
  min-width: 0;
}

/* ── Command Detail Card ── */
.cmd-detail {
  background: #000;
  border: 1px solid rgba(88, 101, 242, 0.18);
  border-top: 2px solid rgba(88, 101, 242, 0.25);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 24px;
  transition: border-color 0.3s, box-shadow 0.3s;
  scroll-margin-top: 100px;
}

.cmd-detail:hover {
  border-color: rgba(88, 101, 242, 0.15);
}

.cmd-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.cmd-detail-name {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--blurple-light);
  background: rgba(88, 101, 242, 0.08);
  padding: 6px 16px;
  border-radius: 8px;
  border: 1px solid rgba(88, 101, 242, 0.15);
}

.cmd-detail-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cmd-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.cmd-badge-cat {
  background: rgba(88, 101, 242, 0.12);
  color: var(--blurple-light);
  border: 1px solid rgba(88, 101, 242, 0.2);
}

.cmd-badge-perm {
  background: rgba(88, 101, 242, 0.12);
  color: var(--blurple-light);
  border: 1px solid rgba(88, 101, 242, 0.2);
}

.cmd-badge-hidden {
  background: rgba(88, 101, 242, 0.10);
  color: var(--blurple-light);
  border: 1px solid rgba(88, 101, 242, 0.2);
}

/* Description */
.cmd-detail-desc {
  font-size: 1.02rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
}

/* Extended explanation */
.cmd-detail-explanation {
  margin-bottom: 24px;
}

.cmd-detail-explanation h4 {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.cmd-detail-explanation p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.cmd-detail-explanation ul {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}

.cmd-detail-explanation li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 6px;
  font-size: 0.93rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.cmd-detail-explanation li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--blurple-light);
}

/* Parameters Table */
.cmd-params-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
}

.cmd-params-table th {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--blurple-light);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-align: left;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-glow);
}

.cmd-params-table td {
  padding: 10px 16px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

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

.cmd-params-table .param-name-cell {
  font-family: var(--font-mono);
  color: var(--cyan-bright);
  font-weight: 500;
}

.cmd-params-table .param-required {
  color: var(--blurple-light);
  font-size: 0.73rem;
}

.cmd-params-table .param-optional {
  color: var(--text-muted);
  font-size: 0.73rem;
}

/* Usage Example */
.cmd-usage {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 24px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-primary);
  position: relative;
  overflow: visible;
  word-break: break-all;
}

.cmd-usage::before {
  content: 'USAGE';
  position: absolute;
  top: -9px;
  left: 16px;
  font-family: var(--font-display);
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--blurple-light);
  background: var(--bg-secondary);
  padding: 0 8px;
  letter-spacing: 2px;
}

.cmd-usage .prefix {
  color: var(--blurple-light);
}

/* Related commands */
.cmd-related {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.cmd-related-title {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  width: 100%;
  margin-bottom: 4px;
}

.cmd-related-link {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--blurple-light);
  background: rgba(88, 101, 242, 0.08);
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid rgba(88, 101, 242, 0.12);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.cmd-related-link:hover {
  background: rgba(88, 101, 242, 0.18);
  border-color: rgba(88, 101, 242, 0.3);
  color: var(--text-primary);
}

/* ── Category Section Headers ── */
.docs-category-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 48px 0 24px;
  scroll-margin-top: 100px;
}

.docs-category-header:first-child {
  margin-top: 0;
}

.docs-cat-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(88, 101, 242, 0.1);
  border: 1px solid rgba(88, 101, 242, 0.15);
  border-radius: 10px;
  font-size: 1.15rem;
}

.docs-cat-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.docs-cat-count {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--blurple-light);
  background: rgba(88, 101, 242, 0.12);
  padding: 2px 8px;
  border-radius: 8px;
}

.docs-cat-line {
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* ── No Results ── */
.docs-no-results {
  text-align: center;
  padding: 60px 20px;
  display: none;
}

.docs-no-results.visible {
  display: block;
}

.docs-no-results p {
  color: var(--text-muted);
  font-size: 1rem;
}

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

  .docs-sidebar {
    position: static;
    max-height: none;
    margin-bottom: 24px;
  }
}

@media (max-width: 600px) {
  .cmd-detail {
    padding: 20px;
  }

  .cmd-detail-name {
    font-size: 1.1rem;
  }

  .terminal-body {
    min-height: 180px;
    max-height: 300px;
  }

  .terminal-container {
    border-radius: 12px;
  }

  .docs-search-bar {
    max-width: 100%;
  }
}
