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

:root {
  --bg: #1a1225;
  --fg: #f0edf5;
  --card: #251a36;
  --border: #3a2952;
  --primary: #8b5cf6;
  --primary-fg: #faf5ff;
  --glow: #a78bfa;
  --muted: #7c6f8a;
  --accent: #2f2044;
  --code-bg: #150e20;
  --success: #34d399;
  --warning: #fbbf24;
  --info: #60a5fa;
  --destructive: #ef4444;
  --radius: 12px;
  --font-sans: "Roboto", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: none;
}

/* Scrollbar */
::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* =========================================================
   Header
   GitHub-style responsive layout
   ========================================================= */

.header {
  position: sticky;
  top: 0;
  z-index: 100;

  border-bottom: 1px solid var(--border);

  background: rgba(26, 18, 37, 0.88);

  backdrop-filter: blur(20px);
}

.header-inner {
  max-width: 1200px;

  margin: 0 auto;

  padding: 12px 16px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 16px;
}

/* Left section */
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;

  min-width: 0;
  flex: 0 1 auto;
}

.header-center {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Logo wrapper */
.logo-box {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 40px;
  height: 40px;

  flex-shrink: 0;

  border-radius: 10px;

  overflow: hidden;

  background: var(--card);

  border: 1px solid var(--border);
}

/* Logo image */
.logo-img {
  width: 100%;
  height: 100%;

  object-fit: cover;

  display: block;
}

/* Brand wrapper */
.brand {
  min-width: 0;
}

/* Title */
.brand-text {
  font-size: 14px;
  font-weight: 700;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Subtitle */
.brand-sub {
  font-size: 11px;

  color: var(--muted);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Search container */
.search-wrap {
  position: relative;
 width: 100%;
    max-width: 500px;
  display: flex;
  align-items: center;
}

/* Search icon */
.search-wrap i {
  position: absolute;
  left: 12px;

  font-size: 12px;

  color: var(--muted);

  pointer-events: none;
}

/* Search input */
.search-input {
  width: 100%;
    box-sizing: border-box;

  padding: 9px 14px 9px 34px;

  border-radius: 10px;

  border: 1px solid var(--border);

  background: var(--card);

  color: var(--fg);

  font-family: var(--font-mono);
  font-size: 13px;

  outline: none;

  transition:
    border-color 0.2s,
    background 0.2s;
}

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

.search-input:focus {
  border-color: var(--primary);

  background: var(--accent);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 12px;
}

.header-nav .nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
  font-size: 13px;
  transition:
    background 0.2s,
    border-color 0.2s,
    color 0.2s;
}

.header-nav .nav-link:hover,
.header-nav .nav-link.active {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.36);
}

.nav-toggle-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
}

.nav-toggle-btn i {
  font-size: 16px;
}

.nav-toggle-btn .fa-xmark {
  display: none;
}

.nav-toggle-input:checked + .nav-toggle-btn .fa-bars {
  display: none;
}

.nav-toggle-input:checked + .nav-toggle-btn .fa-xmark {
  display: inline-block;
}

/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 768px) {
  .header-inner {
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }

  .header-left {
    flex: 1 1 auto;
    min-width: 0;
  }

  .header-right {
    flex: 0 0 auto;
    order: 1;
  }

.header-center {
    order: 2;
    width: 100%;
    margin-top: 12px;
}

.search-wrap {
    width: 100%;
    max-width: 100%;
}

.search-input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

  .brand-text,
  .brand-sub {
    white-space: normal;
  }

  .nav-toggle-btn {
    display: inline-flex;
    align-items: center;
  }

  .header-nav {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition:
      max-height 0.28s ease,
      opacity 0.28s ease;
    opacity: 0;
    margin-top: 12px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 14px;
    background: rgba(26, 18, 37, 0.96);
  }

  .nav-toggle-input:checked + .nav-toggle-btn + .header-nav {
    max-height: 260px;
    opacity: 1;
    border-color: var(--border);
    padding: 12px;
  }

  .header-nav .nav-link {
    width: 100%;
    justify-content: center;
  }
}

/* =========================================================
   HERO SECTION
   ========================================================= */

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);

  background:
    radial-gradient(
      circle at top left,
      rgba(139, 92, 246, 0.18),
      transparent 35%
    ),
    radial-gradient(
      circle at bottom right,
      rgba(167, 139, 250, 0.12),
      transparent 30%
    ),
    linear-gradient(180deg, rgba(37, 26, 54, 0.85), rgba(26, 18, 37, 1));
}

/* Layout */
.hero-inner {
  max-width: 1200px;
  margin: 0 auto;

  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;

  align-items: center;

  padding: 72px 16px;
}

/* Left Side */
.hero-content {
  min-width: 0;
}

/* Badge */
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  padding: 6px 14px;

  border-radius: 999px;
  border: 1px solid var(--border);

  background: rgba(47, 32, 68, 0.75);

  color: var(--muted);

  font-size: 12px;
  font-weight: 500;

  backdrop-filter: blur(12px);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--primary);

  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.45;
    transform: scale(1.2);
  }
}

/* Title */
.hero h1 {
  margin-top: 18px;

  font-size: clamp(2rem, 3vw, 4.4rem);
  line-height: 1.05;
  letter-spacing: -0.04em;

  font-weight: 900;

  max-width: 700px;
}

.gradient {
  background: linear-gradient(90deg, var(--primary), var(--glow));

  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Description */
.hero-description {
  margin-top: 20px;

  max-width: 620px;

  color: var(--muted);

  font-size: 14px;
  line-height: 1.5;
}

/* Buttons */
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;

  margin-top: 28px;
}

.hero-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 12px 18px;

  border-radius: 10px;

  font-size: 14px;
  font-weight: 600;

  text-decoration: none;

  transition:
    transform 0.2s,
    border-color 0.2s,
    background 0.2s;
}

.hero-btn:hover {
  transform: translateY(-2px);
  text-decoration: none;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), var(--glow));

  color: var(--bg);
}

.secondary-btn {
  border: 1px solid var(--border);
  background: var(--card);

  color: var(--fg);
}

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

/* Stats */
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;

  margin-top: 34px;
}

.stat-card {
  min-width: 130px;

  padding: 14px;

  border-radius: 12px;
  border: 1px solid var(--border);

  background: rgba(47, 32, 68, 0.55);

  backdrop-filter: blur(10px);
}

.stat-card strong {
  display: block;

  font-size: 18px;
  font-weight: 800;

  color: var(--fg);
}

.stat-card span {
  font-size: 12px;
  color: var(--muted);
}

/* =========================================================
   RIGHT SIDE PREVIEW
   ========================================================= */

.hero-preview {
  position: relative;
}

/* Fake terminal window */
.preview-window {
  position: relative;

  border-radius: 18px;
  overflow: hidden;

  border: 1px solid rgba(139, 92, 246, 0.25);

  background: rgba(21, 14, 32, 0.95);

  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(139, 92, 246, 0.15);

  transform: perspective(1200px) rotateY(-6deg) rotateX(2deg);
}

/* Topbar */
.preview-topbar {
  display: flex;
  gap: 8px;

  padding: 14px;

  border-bottom: 1px solid var(--border);

  background: rgba(47, 32, 68, 0.9);
}

.preview-topbar span {
  width: 10px;
  height: 10px;
  border-radius: 999px;

  background: var(--muted);
}

/* Code area */
.preview-body {
  padding: 14px;
}

.preview-body pre {
  overflow-x: auto;
}

.preview-body code {
  font-family: var(--font-mono);

  font-size: 12px;
  line-height: 1.5;

  color: #c4b5fd;
}

/* Floating cards */
.floating-card {
  position: absolute;

  display: flex;
  align-items: center;
  gap: 8px;

  padding: 10px 14px;

  border-radius: 999px;

  border: 1px solid var(--border);

  background: rgba(37, 26, 54, 0.92);

  backdrop-filter: blur(12px);

  color: var(--fg);

  font-size: 12px;
  font-weight: 600;

  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.floating-card i {
  color: var(--primary);
}

.floating-1 {
  top: -18px;
  right: 10px;
}

.floating-2 {
  bottom: -18px;
  left: -10px;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 960px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .hero-preview {
    width: 100%;
  }

  .preview-window {
    transform: none;
  }
}

@media (max-width: 640px) {
  .hero-inner {
    padding: 56px 16px;
    flex-direction: column;
    display: flex;
  }

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

  .hero-description {
    font-size: 14px;
  }

  .hero-actions {
    flex-direction: inline-flex;
    align-items: center;
  }

  .hero-btn {
    width: auto;
  }

  .hero-stats {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .stat-card {
    width: 100%;
    padding: 6px 8px;
  }

  .floating-card {
    display: none;
  }
}
/* Layout */
.main-layout {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  gap: 24px;
  padding: 32px 16px;
  overflow-x: hidden;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 768px) {
  .main-layout {
    grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  }
}

/* Nav */
.sidebar-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex-direction: column;
  overflow-wrap: anywhere;
  min-width: 0;
}
@media (min-width: 768px) {
  .sidebar-nav {
    flex-direction: column;
    position: sticky;
    top: 65px;
    align-self: start;
  }
}
.cat-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--muted);
  border: 1px solid transparent;
  transition: all 0.2s;
  text-decoration: none;
}
.cat-link:hover {
  background: var(--card);
  color: var(--fg);
  text-decoration: none;
}
.cat-link.active {
  border-color: var(--border);
  background: var(--card);
  color: var(--fg);
}
.cat-link i {
  width: 16px;
  text-align: center;
  font-size: 12px;
}
.cat-link span {
  white-space: nowrap;
}

/* Sections */
.category-section {
  margin-bottom: 48px;
  scroll-margin-top: 96px;
}
.category-section h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.category-section h2 i {
  color: var(--primary);
  font-size: 20px;
}
.cat-desc {
  font-size: 14px;
  color: var(--muted);
  margin: 4px 0 20px;
}

/* Cards grid */
.cards-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

/* Tablet */
@media (min-width: 768px) {
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Optional: wider desktop */
@media (min-width: 1200px) {
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Card */
.command-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--card), rgba(47, 32, 68, 0.3));
  padding: 20px;
  transition: border-color 0.2s;
  min-width: 0;
  overflow: hidden;
}
.command-card:hover {
  border-color: rgba(139, 92, 246, 0.4);
}
.card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.card-header h3 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}
.danger-badge {
  flex-shrink: 0;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.15);
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--destructive);
}

/* Code block */
.code-block {
  position: relative;
  margin-bottom: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--code-bg);
}
.code-block pre {
  overflow-x: auto;
  padding: 12px 60px 12px 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--primary);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.copy-btn {
  position: absolute;
  right: 8px;
  top: 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--accent);
  padding: 4px 10px;
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}
.copy-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.copy-btn.copied {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--bg);
}

.description {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(240, 237, 245, 0.85);
  margin-bottom: 8px;
}

.how-to-use {
  margin-bottom: 8px;
  border-radius: 10px;
  background: rgba(96, 165, 250, 0.08);
  border: 1px solid rgba(96, 165, 250, 0.2);
  padding: 12px;
}
.how-to-use .label {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--info);
  margin-bottom: 4px;
}
.how-to-use p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.when-to-use {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.when-to-use .label {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(139, 92, 246, 0.85);
  margin-bottom: 4px;
}
.when-to-use p {
  font-size: 13.5px;
  color: var(--muted);
}

.tip-box {
  margin-top: 8px;
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.2);
  padding: 8px 12px;
}
.tip-box p {
  font-size: 13px;
  color: var(--warning);
}

/* Stats */
.stats-box {
  margin-top: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  padding: 24px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}
.stats-box .highlight {
  font-weight: 700;
  color: var(--primary);
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 16px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}
.footer-inner strong {
  color: var(--fg);
}
.footer-links {
  display: flex;
  gap: 16px;
}

/* Empty state */
.empty-state {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  padding: 32px;
  text-align: center;
  color: var(--muted);
}

/* Search result count */
.result-count {
  margin-top: 16px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}
/* =========================================================
   Refactor: GitHub-style category dropdown + edit/copy UX
   ========================================================= */

/* Single-column layout — category nav is now a dropdown */
.main-layout {
  grid-template-columns: minmax(0, 1fr) !important;
}
@media (min-width: 768px) {
  .main-layout {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

/* Dropdown shell */
.category-menu {
  position: relative;
  width: 100%;
  max-width: 360px;
}

.category-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s;
}
.category-menu-trigger:hover {
  border-color: var(--primary);
}
.category-menu-trigger[aria-expanded="true"] {
  border-color: var(--primary);
  background: var(--accent);
}
.category-menu-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.category-menu-current {
  flex: 1;
  text-align: left;
  color: var(--fg);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.category-menu-caret {
  transition: transform 0.2s;
  font-size: 11px;
  color: var(--muted);
}
.category-menu-trigger[aria-expanded="true"] .category-menu-caret {
  transform: rotate(180deg);
}

/* Dropdown panel — GitHub menu style */
.category-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  z-index: 60;
  width: min(360px, calc(100vw - 32px));
  max-height: min(70vh, 480px);
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: catMenuIn 0.12s ease-out;
}
.category-menu-panel[hidden] {
  display: none;
}
@keyframes catMenuIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.category-menu-search-wrap {
  position: relative;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--accent);
}
.category-menu-search-wrap i {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
}
.category-menu-search {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--code-bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
}
.category-menu-search:focus {
  border-color: var(--primary);
}

.category-menu-panel .sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  overflow-y: auto;
  position: static !important;
}
.category-menu-panel .cat-link {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
}
.category-menu-panel .cat-link[hidden] {
  display: none;
}

/* Desktop refinement — anchor menu trigger comfortably above content */
@media (min-width: 768px) {
  .category-menu {
    max-width: 320px;
  }
  .category-menu-panel {
    width: 360px;
  }
}

/* =========================================================
   Edit + Copy actions on code blocks (CSP-compliant)
   ========================================================= */
.code-block {
  position: relative;
}

.code-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 8px;
  z-index: 2;
}

/* Override the old absolute .copy-btn (now lives in .code-actions) */
.copy-btn,
.edit-btn {
  position: static;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--accent);
  padding: 4px 10px;
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}
.copy-btn:hover,
.edit-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.copy-btn.copied {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--bg);
}
.edit-btn.active {
  border-color: var(--warning);
  color: var(--warning);
}

code[contenteditable="true"] {
  outline: 1px solid var(--primary);
  border-radius: 6px;
  display: block;
  padding: 6px 8px;
  background: rgba(139, 92, 246, 0.08);
  cursor: text;
  white-space: pre;
}

/* Long-command safety on mobile */
.code-block pre code {
  white-space: pre-wrap;
}

/* Reserve padding on the right so action buttons don't overlap text */
.code-block pre {
  padding-right: 110px;
  overflow-x: auto;
}
