/* root variables for colors, typography, layout, and spacing */
:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #1c2333;
  --bg-hover: #252d3f;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent: #e95420;
  --accent-dim: rgba(233, 84, 32, 0.12);
  --border: #30363d;
  --border-light: #21262d;
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
  --overlay-bg: rgba(0, 0, 0, 0.5);
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-width: 260px;
  --header-height: 60px;
  --transition: 0.2s ease;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f6f8fa;
  --bg-card: #ffffff;
  --bg-hover: #f0f2f5;
  --text-primary: #1f2328;
  --text-secondary: #656d76;
  --text-muted: #8b949e;
  --accent: #e95420;
  --accent-dim: rgba(233, 84, 32, 0.08);
  --border: #d0d7de;
  --border-light: #d8dee4;
  --shadow-lg: 0 8px 24px rgba(140, 149, 159, 0.2);
  --overlay-bg: rgba(0, 0, 0, 0.3);
}

*,
/* reset default spacing and box sizing on all elements */
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* global html settings including smooth scrolling and scrollbar style */
html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

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

/* fixed top header with branding and language toggle */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.menu-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

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

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-icon svg {
  width: 18px;
  height: 18px;
  color: #fff;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.logo-text span {
  color: var(--accent);
}

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

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font: 600 13px var(--font-sans);
  transition: all var(--transition);
}

.lang-toggle:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.lang-toggle .lang-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--transition);
}

.lang-toggle.active .lang-dot {
  background: var(--accent);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition);
}

.theme-toggle:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.layout {
  display: flex;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

/* sidebar navigation panel and responsive slide behavior */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-light);
  overflow-y: auto;
  padding: 16px 12px;
  z-index: 50;
  transition: transform 0.3s ease;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.category-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font: 500 13px var(--font-sans);
  text-align: left;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.category-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.category-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}

.category-btn .cat-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.category-btn .cat-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-divider {
  height: 1px;
  background: var(--border-light);
  margin: 8px 0;
}

/* main content area with search and commands grid */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 28px 32px;
  max-width: 100%;
}

.search-container {
  position: relative;
  margin-bottom: 28px;
  max-width: 600px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font: 14px var(--font-sans);
  transition: all var(--transition);
  outline: none;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

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

.search-clear {
  display: none;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font: 12px var(--font-sans);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.search-clear:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.search-clear.visible {
  display: block;
}

.commands-container {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.category-section {
  animation: fadeSection 0.3s ease forwards;
}

@keyframes fadeSection {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.category-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.commands-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

/* command card styling with hover state and accent border */
.command-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: all var(--transition);
  animation: cardIn 0.3s ease forwards;
  opacity: 0;
  position: relative;
  overflow: hidden;
}

.command-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
}

.command-card:hover {
  border-color: var(--border);
  background: var(--bg-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.command-card:hover::before {
  opacity: 1;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.command-name {
  font: 600 16px var(--font-mono);
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 10px;
  border-radius: 4px;
  letter-spacing: -0.3px;
}

.command-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 10px;
}

.command-example {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.example-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.example-code {
  font: 12.5px var(--font-mono);
  color: var(--text-primary);
  word-break: break-all;
}

.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.no-results p {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.no-results small {
  font-size: 13px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 45;
}

@media (max-width: 900px) {
  :root {
    --sidebar-width: 260px;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .menu-btn {
    display: block;
  }

  .main {
    margin-left: 0;
    padding: 20px 16px;
  }

  .commands-grid {
    grid-template-columns: 1fr;
  }

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

@media (min-width: 901px) and (max-width: 1200px) {
  .commands-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1600px) {
  .commands-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .main {
    padding: 32px 48px;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 0 12px;
  }

  .logo-text {
    font-size: 15px;
  }

  .lang-toggle {
    padding: 5px 10px;
    font-size: 12px;
  }

  .command-card {
    padding: 14px;
  }

  .commands-grid {
    gap: 10px;
  }
}
