/* ============================================================
   DevForge — Design System & Styles
   A premium, open-source developer toolkit
   ============================================================ */

/* ---------- Google Fonts loaded via index.html ---------- */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}
button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
}
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
img,
svg {
  display: block;
  max-width: 100%;
}
ul,
ol {
  list-style: none;
}
code,
pre,
kbd {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* =================== DESIGN TOKENS ===================== */
:root {
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
  --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.15);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Layout */
  --header-height: 64px;
  --sidebar-width: 240px;

  /* Gradient */
  --gradient-primary: linear-gradient(135deg, #8b5cf6 0%, #6366f1 50%, #06b6d4 100%);
  --gradient-accent: linear-gradient(135deg, #a855f7, #06b6d4);
  --gradient-subtle: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(6, 182, 212, 0.1));
}

/* ==================== DARK THEME ======================= */
[data-theme='dark'] {
  --bg-primary: #07070e;
  --bg-secondary: #0e0e1a;
  --bg-tertiary: #151525;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --bg-input: rgba(255, 255, 255, 0.04);
  --bg-input-focus: rgba(255, 255, 255, 0.07);

  --border-primary: rgba(255, 255, 255, 0.06);
  --border-secondary: rgba(255, 255, 255, 0.1);
  --border-accent: rgba(139, 92, 246, 0.3);

  --text-primary: #f0f0f8;
  --text-secondary: #8888a8;
  --text-tertiary: #555570;
  --text-accent: #a78bfa;

  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-info: #3b82f6;

  --scrollbar-thumb: rgba(255, 255, 255, 0.1);
  --scrollbar-track: transparent;

  color-scheme: dark;
}

/* ==================== LIGHT THEME ====================== */
[data-theme='light'] {
  --bg-primary: #f4f4f8;
  --bg-secondary: #ffffff;
  --bg-tertiary: #eeeef3;
  --bg-card: rgba(255, 255, 255, 0.7);
  --bg-card-hover: rgba(255, 255, 255, 0.9);
  --bg-input: rgba(0, 0, 0, 0.03);
  --bg-input-focus: rgba(0, 0, 0, 0.05);

  --border-primary: rgba(0, 0, 0, 0.06);
  --border-secondary: rgba(0, 0, 0, 0.1);
  --border-accent: rgba(139, 92, 246, 0.25);

  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --text-accent: #7c3aed;

  --color-success: #16a34a;
  --color-warning: #d97706;
  --color-error: #dc2626;
  --color-info: #2563eb;

  --scrollbar-thumb: rgba(0, 0, 0, 0.12);
  --scrollbar-track: transparent;

  color-scheme: light;
}

/* =================== BASE STYLES ======================= */
body {
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* Animated background gradient mesh */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 10% 20%, rgba(139, 92, 246, 0.07) 0%, transparent 70%),
    radial-gradient(ellipse 500px 300px at 80% 60%, rgba(6, 182, 212, 0.05) 0%, transparent 70%),
    radial-gradient(ellipse 400px 300px at 50% 90%, rgba(99, 102, 241, 0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

::selection {
  background: rgba(139, 92, 246, 0.3);
  color: var(--text-primary);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.3);
}

/* ===================== HEADER ========================== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: 0 var(--space-xl);
  background: rgba(7, 7, 14, 0.8);
  backdrop-filter: blur(20px) saturate(1.2);
  border-bottom: 1px solid var(--border-primary);
  z-index: 100;
}

[data-theme='light'] .header {
  background: rgba(255, 255, 255, 0.85);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.25rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.header-logo svg {
  width: 28px;
  height: 28px;
}

.header-logo .logo-text {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Search */
.header-search {
  position: relative;
  flex: 1;
  max-width: 480px;
}

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

.header-search input {
  width: 100%;
  height: 40px;
  padding: 0 80px 0 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: all var(--transition-base);
}

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

.header-search input:focus {
  background: var(--bg-input-focus);
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.header-search kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  font-size: 0.7rem;
  color: var(--text-tertiary);
  pointer-events: none;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

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

.header-btn svg {
  width: 20px;
  height: 20px;
}

.github-link {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.github-link:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-secondary);
  color: var(--text-primary);
}

.github-link svg {
  width: 18px;
  height: 18px;
}

/* =================== APP LAYOUT ======================== */
.app-layout {
  display: flex;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
  position: relative;
  z-index: 1;
}

/* ==================== SIDEBAR ========================== */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  padding: var(--space-lg) var(--space-md);
  border-right: 1px solid var(--border-primary);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: 0 var(--space-sm);
  margin-bottom: var(--space-sm);
}

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

.category-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 450;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  text-align: left;
}

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

.category-btn.active {
  background: var(--gradient-subtle);
  color: var(--text-accent);
  font-weight: 550;
}

.category-btn .cat-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.category-btn .cat-count {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  background: var(--bg-input);
  padding: 1px 7px;
  border-radius: var(--radius-full);
  font-weight: 500;
}

.sidebar-footer {
  margin-top: auto;
  padding: var(--space-md) var(--space-sm);
  border-top: 1px solid var(--border-primary);
}

.sidebar-footer p {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
}

.sidebar-footer a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.8rem;
  color: var(--text-accent);
  font-weight: 500;
  transition: opacity var(--transition-fast);
}

.sidebar-footer a:hover {
  opacity: 0.8;
}

/* ================== MAIN CONTENT ======================= */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: var(--space-xl) var(--space-2xl);
  min-height: calc(100vh - var(--header-height));
}

/* ================ CATALOG VIEW ========================= */
.catalog-header {
  margin-bottom: var(--space-xl);
}

.catalog-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.catalog-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.catalog-header .highlight {
  color: var(--text-accent);
  font-weight: 600;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
}

/* ================== TOOL CARD ========================== */
.tool-card {
  position: relative;
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--gradient-accent);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.tool-card:hover {
  transform: translateY(-4px);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-glow);
}

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

.tool-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--gradient-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
  font-size: 1.2rem;
  color: var(--text-accent);
}

.tool-card-icon svg {
  width: 24px;
  height: 24px;
}

.tool-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.tool-card p {
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.tool-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-md);
}

.tool-tag {
  padding: 2px 10px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* ================ TOOL VIEW ============================ */
.tool-view {
  animation: fadeSlideUp 0.35s ease;
}

.tool-view-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.back-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-secondary);
}

.back-btn svg {
  width: 18px;
  height: 18px;
}

.tool-view-title h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.tool-view-title p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.tool-body {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

/* ============= TOOL UI COMPONENTS ====================== */

/* Split layout (input | output) */
.tool-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

.tool-full {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* Input / Output groups */
.tool-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.tool-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Textarea */
.tool-textarea {
  width: 100%;
  min-height: 220px;
  padding: var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: all var(--transition-base);
}

.tool-textarea::placeholder {
  color: var(--text-tertiary);
}

.tool-textarea:focus {
  background: var(--bg-input-focus);
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.08);
}

/* Input */
.tool-input {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: all var(--transition-base);
}

.tool-input:focus {
  background: var(--bg-input-focus);
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.08);
}

/* Result / Output display */
.tool-result {
  width: 100%;
  min-height: 220px;
  padding: var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-primary);
}

.tool-result.success {
  border-color: rgba(34, 197, 94, 0.3);
}
.tool-result.error {
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--color-error);
}

/* Actions row */
.tool-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

/* Buttons */
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 550;
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.tool-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-secondary);
}

.tool-btn:active {
  transform: scale(0.97);
}

.tool-btn svg {
  width: 16px;
  height: 16px;
}

.tool-btn-primary {
  background: var(--gradient-primary);
  border: none;
  color: #fff;
}

.tool-btn-primary:hover {
  opacity: 0.9;
  box-shadow: var(--shadow-glow);
}

.tool-btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

/* Options row */
.tool-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.tool-option {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.tool-option select {
  padding: 6px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
}

.tool-option select:focus {
  border-color: var(--border-accent);
}

.tool-option input[type='number'] {
  width: 70px;
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  text-align: center;
}

/* Checkbox / toggle */
.tool-checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.tool-checkbox input[type='checkbox'] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-secondary);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.tool-checkbox input[type='checkbox']:checked {
  background: var(--gradient-primary);
  border-color: transparent;
}

.tool-checkbox input[type='checkbox']:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Inline result (e.g., UUID, hash) */
.tool-inline-result {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  word-break: break-all;
}

.tool-inline-result .copy-icon {
  flex-shrink: 0;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: color var(--transition-fast);
  padding: 4px;
}

.tool-inline-result .copy-icon:hover {
  color: var(--text-accent);
}

/* Color swatch */
.color-swatch {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-primary);
  flex-shrink: 0;
}

/* Strength meter (for password) */
.strength-meter {
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  overflow: hidden;
  margin-top: var(--space-sm);
}

.strength-meter-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
}

/* =================== TOAST ============================= */
.toast-container {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  z-index: 200;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  transform: translateX(120%);
  opacity: 0;
  transition: all var(--transition-base);
  pointer-events: auto;
}

.toast-visible {
  transform: translateX(0);
  opacity: 1;
}

.toast-success {
  border-left: 3px solid var(--color-success);
}
.toast-error {
  border-left: 3px solid var(--color-error);
}
.toast-info {
  border-left: 3px solid var(--color-info);
}

/* ================= EMPTY STATE ========================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl) var(--space-xl);
  text-align: center;
  color: var(--text-tertiary);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-lg);
  opacity: 0.4;
}

.empty-state p {
  font-size: 1rem;
  font-weight: 500;
}

.empty-state span {
  font-size: 0.85rem;
  margin-top: var(--space-xs);
}

/* ================= ANIMATIONS ========================== */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.animate-fade-in {
  animation: fadeIn 0.4s ease;
}

.tools-grid .tool-card {
  animation: fadeSlideUp 0.4s ease both;
}

.tools-grid .tool-card:nth-child(1) {
  animation-delay: 0s;
}
.tools-grid .tool-card:nth-child(2) {
  animation-delay: 0.04s;
}
.tools-grid .tool-card:nth-child(3) {
  animation-delay: 0.08s;
}
.tools-grid .tool-card:nth-child(4) {
  animation-delay: 0.12s;
}
.tools-grid .tool-card:nth-child(5) {
  animation-delay: 0.16s;
}
.tools-grid .tool-card:nth-child(6) {
  animation-delay: 0.2s;
}
.tools-grid .tool-card:nth-child(7) {
  animation-delay: 0.24s;
}
.tools-grid .tool-card:nth-child(8) {
  animation-delay: 0.28s;
}
.tools-grid .tool-card:nth-child(9) {
  animation-delay: 0.32s;
}
.tools-grid .tool-card:nth-child(10) {
  animation-delay: 0.36s;
}

/* ================ RESPONSIVE =========================== */
@media (max-width: 1024px) {
  .sidebar {
    width: 200px;
  }
  .main-content {
    margin-left: 200px;
    padding: var(--space-lg);
  }
  --sidebar-width: 200px;
}

@media (max-width: 768px) {
  .header {
    padding: 0 var(--space-md);
    gap: var(--space-sm);
  }

  .header-search kbd {
    display: none;
  }

  .github-link span {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: auto;
    width: 100%;
    flex-direction: row;
    padding: var(--space-sm) var(--space-md);
    border-right: none;
    border-bottom: 1px solid var(--border-primary);
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--bg-primary);
    z-index: 90;
  }

  .sidebar-title {
    display: none;
  }

  .categories {
    flex-direction: row;
    gap: var(--space-xs);
    flex-wrap: nowrap;
  }

  .category-btn {
    white-space: nowrap;
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  .category-btn .cat-count {
    display: none;
  }

  .sidebar-footer {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding: var(--space-md);
    margin-top: 52px;
  }

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

  .tool-split {
    grid-template-columns: 1fr;
  }

  .tool-body {
    padding: var(--space-md);
  }
}

@media (max-width: 480px) {
  .header-logo .logo-text {
    display: none;
  }

  .catalog-header h1 {
    font-size: 1.35rem;
  }
}
