/* ================================================================
   KoTool — Design System & Main Stylesheet
   Version: 1.0.0
   ================================================================ */

/* ────────────────────────────────────────
   1. CSS Custom Properties (Design Tokens)
   ──────────────────────────────────────── */
:root {
  /* Brand Colors */
  --primary: #4F6EF7;
  --primary-dark: #3A56D4;
  --primary-light: #EEF1FE;
  --primary-rgb: 79, 110, 247;

  /* Semantic Colors */
  --success: #10B981;
  --success-light: #D1FAE5;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --info: #06B6D4;
  --info-light: #CFFAFE;

  /* Backgrounds */
  --bg: #F8F9FC;
  --bg-2: #F1F3FA;
  --surface: #FFFFFF;
  --surface-2: #F7F8FB;
  --surface-3: #EDEEF5;

  /* Text */
  --text: #0D0F1A;
  --text-secondary: #374151;
  --text-muted: #6B7280;
  --text-subtle: #9CA3AF;

  /* Borders */
  --border: #E5E7EB;
  --border-light: #F3F4F6;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.07), 0 2px 8px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.10), 0 4px 16px rgba(0,0,0,.06);
  --shadow-xl: 0 24px 64px rgba(0,0,0,.12), 0 8px 24px rgba(0,0,0,.08);
  --shadow-primary: 0 8px 24px rgba(79, 110, 247, .30);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* Border Radius */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Font Sizes */
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-md: 16px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 30px;
  --text-4xl: 36px;
  --text-5xl: 48px;
  --text-6xl: 60px;

  /* Font Weights */
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;

  /* Line Heights */
  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;

  /* Transitions */
  --transition: 150ms ease;
  --transition-md: 250ms ease;
  --transition-lg: 400ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Navbar height */
  --nav-h: 64px;

  /* Z-index layers */
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;
}

/* Dark Mode */
[data-theme="dark"] {
  --bg: #0F1117;
  --bg-2: #131620;
  --surface: #1A1D27;
  --surface-2: #1F2334;
  --surface-3: #252A3D;
  --text: #E8EAEF;
  --text-secondary: #C9CCd5;
  --text-muted: #9CA3AF;
  --text-subtle: #6B7280;
  --border: #2D3148;
  --border-light: #242744;
  --primary-light: #1E2340;
  --shadow-md: 0 4px 16px rgba(0,0,0,.25);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.35);
  --shadow-xl: 0 24px 64px rgba(0,0,0,.45);
  --shadow-primary: 0 8px 24px rgba(79, 110, 247, .20);
}

/* ────────────────────────────────────────
   2. Reset & Base
   ──────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--transition-md), color var(--transition-md);
}

img, video, svg { display: block; max-width: 100%; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
button { cursor: pointer; font-family: var(--font-sans); }
input, textarea, select { font-family: var(--font-sans); }
ul, ol { list-style: none; }
h1,h2,h3,h4,h5,h6 { line-height: var(--leading-tight); color: var(--text); font-weight: var(--weight-bold); }

/* ────────────────────────────────────────
   3. Typography
   ──────────────────────────────────────── */
.text-xs    { font-size: var(--text-xs); }
.text-sm    { font-size: var(--text-sm); }
.text-base  { font-size: var(--text-base); }
.text-md    { font-size: var(--text-md); }
.text-lg    { font-size: var(--text-lg); }
.text-xl    { font-size: var(--text-xl); }
.text-2xl   { font-size: var(--text-2xl); }
.text-3xl   { font-size: var(--text-3xl); }
.text-4xl   { font-size: var(--text-4xl); }
.text-5xl   { font-size: var(--text-5xl); }
.text-6xl   { font-size: var(--text-6xl); }

.font-normal    { font-weight: var(--weight-normal); }
.font-medium    { font-weight: var(--weight-medium); }
.font-semibold  { font-weight: var(--weight-semibold); }
.font-bold      { font-weight: var(--weight-bold); }
.font-extrabold { font-weight: var(--weight-extrabold); }

.text-primary  { color: var(--primary); }
.text-muted    { color: var(--text-muted); }
.text-subtle   { color: var(--text-subtle); }
.text-success  { color: var(--success); }
.text-warning  { color: var(--warning); }
.text-danger   { color: var(--danger); }
.text-center   { text-align: center; }
.text-left     { text-align: left; }
.text-right    { text-align: right; }

.leading-tight  { line-height: var(--leading-tight); }
.leading-normal { line-height: var(--leading-normal); }
.leading-relaxed{ line-height: var(--leading-relaxed); }

/* ────────────────────────────────────────
   4. Layout Utilities
   ──────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}
.container-sm { max-width: 720px; }
.container-md { max-width: 960px; }
.container-lg { max-width: 1400px; }

.section { padding: var(--space-20) 0; }
.section-sm { padding: var(--space-12) 0; }
.section-lg { padding: var(--space-24) 0; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.gap-10 { gap: var(--space-10); }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

.w-full { width: 100%; }
.h-full { height: 100%; }
.relative { position: relative; }
.absolute { position: absolute; }
.sticky-top { position: sticky; top: 0; z-index: var(--z-sticky); }

.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }
.inline-flex { display: inline-flex; }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mx-auto { margin-left: auto; margin-right: auto; }

.p-2 { padding: var(--space-2); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }

.rounded { border-radius: var(--radius); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.overflow-hidden { overflow: hidden; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ────────────────────────────────────────
   5. Buttons
   ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 20px;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  transition: all var(--transition);
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
  text-decoration: none;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn-sm {
  padding: 7px 14px;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 28px;
  font-size: var(--text-md);
  border-radius: var(--radius-md);
}

.btn-xl {
  padding: 16px 36px;
  font-size: var(--text-lg);
  border-radius: var(--radius-md);
  font-weight: var(--weight-bold);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
  box-shadow: 0 12px 32px rgba(79,110,247,.35);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-surface {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-surface:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow-md);
}

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #059669; border-color: #059669; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #DC2626; border-color: #DC2626; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover { background: #D97706; border-color: #D97706; color: #fff; }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius);
}
.btn-icon-sm { width: 30px; height: 30px; border-radius: var(--radius-sm); }
.btn-icon-lg { width: 44px; height: 44px; border-radius: var(--radius-md); }

/* ────────────────────────────────────────
   6. Cards
   ──────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-md), transform var(--transition-md), border-color var(--transition-md);
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: rgba(var(--primary-rgb), .2);
}

.card-body { padding: var(--space-6); }
.card-header { padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--border); }
.card-footer { padding: var(--space-4) var(--space-6); border-top: 1px solid var(--border); background: var(--surface-2); }

/* Tool Card */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-md);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

.tool-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(var(--primary-rgb), .03) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition-md);
}

.tool-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: rgba(var(--primary-rgb), .25);
  color: inherit;
}

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

.tool-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.tool-card-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text);
  margin: 0;
  line-height: var(--leading-snug);
}

.tool-card-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-normal);
  margin: 0;
  flex: 1;
}

.tool-card-arrow {
  color: var(--text-subtle);
  transition: color var(--transition), transform var(--transition);
  opacity: 0;
  margin-left: auto;
}

.tool-card:hover .tool-card-arrow {
  color: var(--primary);
  transform: translateX(3px);
  opacity: 1;
}

/* Category Card */
.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-md);
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}

.category-card-accent {
  position: absolute;
  top: 0; right: 0;
  width: 120px; height: 120px;
  border-radius: 50%;
  transform: translate(40px, -40px);
  opacity: .06;
}

.category-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  color: inherit;
}

.category-icon {
  width: 56px; height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  position: relative;
  z-index: 1;
}

.category-card h3 {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  position: relative; z-index: 1;
}

.category-card p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  position: relative; z-index: 1;
}

.category-count {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-subtle);
  position: relative; z-index: 1;
}

/* ────────────────────────────────────────
   7. Badges
   ──────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  line-height: 1;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: #047857; }
.badge-warning { background: var(--warning-light); color: #92400E; }
.badge-danger  { background: var(--danger-light); color: #991B1B; }
.badge-info    { background: var(--info-light); color: #0E7490; }
.badge-muted   { background: var(--surface-3); color: var(--text-muted); }

.badge-popular { background: linear-gradient(135deg, #FF6B6B, #FF8E53); color: #fff; }
.badge-new     { background: linear-gradient(135deg, #4F6EF7, #7B5EA7); color: #fff; }
.badge-free    { background: var(--success-light); color: #047857; }

/* ────────────────────────────────────────
   8. Forms & Inputs
   ──────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }
.form-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: var(--text-sm);
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  outline: none;
  line-height: var(--leading-normal);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .12);
}

.form-control:hover:not(:focus) { border-color: var(--text-subtle); }

.form-control-lg {
  padding: 13px 18px;
  font-size: var(--text-md);
  border-radius: var(--radius-md);
}

textarea.form-control {
  resize: vertical;
  min-height: 120px;
  line-height: var(--leading-relaxed);
  font-family: var(--font-sans);
}

.form-control[data-mono="true"],
.mono { font-family: var(--font-mono); font-size: var(--text-sm); }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236B7280' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 20px;
  padding-right: 36px;
  cursor: pointer;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--danger);
}

/* Input group */
.input-group {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-group:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .12);
}

.input-group .form-control {
  border: none;
  border-radius: 0;
  box-shadow: none;
  flex: 1;
}

.input-group .form-control:focus { box-shadow: none; }

.input-addon {
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: var(--surface-2);
  border-left: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--text-sm);
  white-space: nowrap;
}

.input-addon:first-child { border-left: none; border-right: 1px solid var(--border); }

/* Checkbox & Radio */
.checkbox-group, .radio-group {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  user-select: none;
}

.checkbox-group input[type="checkbox"],
.radio-group input[type="radio"] {
  width: 18px; height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* Range */
input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ────────────────────────────────────────
   9. Drag & Drop Upload Zone
   ──────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-12) var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  background: var(--surface);
  transition: all var(--transition-md);
  cursor: pointer;
  text-align: center;
  position: relative;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.01);
}

.upload-zone.drag-over { box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .12); }

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-icon {
  width: 64px; height: 64px;
  background: var(--primary-light);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  transition: transform var(--transition-md);
}

.upload-zone:hover .upload-icon { transform: scale(1.08); }

.upload-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text);
}

.upload-sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.upload-formats {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: center;
}

.format-tag {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ────────────────────────────────────────
   10. Progress & States
   ──────────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.progress-fill-success { background: var(--success); }
.progress-fill-striped {
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(255,255,255,.2) 10px,
    rgba(255,255,255,.2) 20px
  );
  animation: progress-stripe 0.6s linear infinite;
}

@keyframes progress-stripe {
  from { background-position: 0 0; }
  to { background-position: 40px 0; }
}

/* Loading Spinner */
.spinner {
  width: 24px; height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 40px; height: 40px; border-width: 3px; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Alert boxes */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.alert-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-light); border-color: #6EE7B7; color: #065F46; }
.alert-warning { background: var(--warning-light); border-color: #FCD34D; color: #78350F; }
.alert-danger  { background: var(--danger-light);  border-color: #FCA5A5; color: #7F1D1D; }
.alert-info    { background: var(--info-light);    border-color: #67E8F9; color: #164E63; }

/* ────────────────────────────────────────
   11. Navbar
   ──────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: var(--nav-h);
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: all var(--transition-md);
}

[data-theme="dark"] .navbar {
  background: rgba(26, 29, 39, .9);
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo-icon {
  width: 34px; height: 34px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.nav-logo-text {
  font-size: var(--text-xl);
  font-weight: var(--weight-extrabold);
  color: var(--text);
  letter-spacing: -0.5px;
}

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

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

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
}

.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.active { color: var(--primary); background: var(--primary-light); }

/* Dropdown */
.nav-dropdown { position: relative; }

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2);
  min-width: 200px;
  z-index: var(--z-dropdown);
}

.nav-dropdown:hover .nav-dropdown-menu { display: block; animation: fadeInDown .15s ease; }

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text);
  text-decoration: none;
  transition: background var(--transition);
}

.nav-dropdown-item:hover { background: var(--surface-2); color: var(--primary); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.theme-toggle {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all var(--transition);
  color: var(--text-muted);
}

.theme-toggle:hover { background: var(--surface-2); color: var(--text); border-color: var(--text-subtle); }

/* Mobile nav toggle */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  cursor: pointer;
  border-radius: var(--radius);
  border: none;
  background: transparent;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition-md);
}

.nav-hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* Mobile menu */
.mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--space-4);
  z-index: calc(var(--z-sticky) - 1);
  box-shadow: var(--shadow-lg);
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}

.mobile-menu.open { display: block; animation: slideDown .2s ease; }

.mobile-menu-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}

.mobile-menu-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text);
  text-decoration: none;
  transition: background var(--transition);
}

.mobile-menu-link:hover,
.mobile-menu-link.active { background: var(--primary-light); color: var(--primary); }

/* ────────────────────────────────────────
   12. Hero Section
   ──────────────────────────────────────── */
.hero {
  padding: var(--space-20) 0 var(--space-16);
  background: linear-gradient(160deg, var(--bg) 0%, rgba(var(--primary-rgb), .04) 50%, var(--bg) 100%);
  position: relative;
  overflow: hidden;
  text-align: center;
}

.hero::before {
  content: '';
  position: absolute;
  top: -200px; left: 50%;
  transform: translateX(-50%);
  width: 800px; height: 600px;
  background: radial-gradient(ellipse at center, rgba(var(--primary-rgb), .08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(var(--primary-rgb), .2);
  border-radius: var(--radius-full);
  padding: 6px 16px;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-6);
}

.hero h1 {
  font-size: clamp(var(--text-4xl), 5vw, var(--text-6xl));
  font-weight: var(--weight-extrabold);
  line-height: var(--leading-tight);
  letter-spacing: -1.5px;
  color: var(--text);
  margin-bottom: var(--space-5);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.hero h1 .gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, #7B5EA7 50%, #06B6D4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: var(--text-xl);
  color: var(--text-muted);
  font-weight: var(--weight-normal);
  line-height: var(--leading-relaxed);
  max-width: 580px;
  margin: 0 auto var(--space-10);
}

/* Hero Search */
.hero-search {
  max-width: 640px;
  margin: 0 auto var(--space-8);
  position: relative;
}

.hero-search-box {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transition: all var(--transition-md);
  padding: var(--space-2);
  gap: var(--space-2);
}

.hero-search-box:focus-within {
  border-color: var(--primary);
  box-shadow: var(--shadow-xl), 0 0 0 4px rgba(var(--primary-rgb), .1);
}

.hero-search-icon {
  padding: var(--space-2) var(--space-4);
  color: var(--text-muted);
  font-size: 20px;
  flex-shrink: 0;
}

.hero-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: var(--text-lg);
  color: var(--text);
  background: transparent;
  padding: var(--space-2) 0;
}

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

.hero-search-btn {
  flex-shrink: 0;
  border-radius: var(--radius-lg);
}

/* Hero Tags */
.hero-tags {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: center;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: var(--weight-medium);
  text-decoration: none;
  transition: all var(--transition);
  box-shadow: var(--shadow-xs);
}

.hero-tag:hover {
  background: var(--primary-light);
  border-color: rgba(var(--primary-rgb), .3);
  color: var(--primary);
  transform: translateY(-1px);
}

/* ────────────────────────────────────────
   13. Section Headers
   ──────────────────────────────────────── */
.section-header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--primary);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--space-3);
}

.section-header h2 {
  font-size: clamp(var(--text-3xl), 3vw, var(--text-4xl));
  font-weight: var(--weight-extrabold);
  letter-spacing: -0.5px;
  margin-bottom: var(--space-4);
}

.section-header p {
  font-size: var(--text-lg);
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
  line-height: var(--leading-relaxed);
}

/* ────────────────────────────────────────
   14. Stats Bar
   ──────────────────────────────────────── */
.stats-bar {
  background: var(--primary);
  padding: var(--space-5) 0;
  overflow: hidden;
}

.stats-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-12);
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: rgba(255,255,255,.9);
}

.stat-num {
  font-size: var(--text-2xl);
  font-weight: var(--weight-extrabold);
  color: #fff;
  line-height: 1;
}

.stat-label {
  font-size: var(--text-sm);
  color: rgba(255,255,255,.75);
  font-weight: var(--weight-medium);
}

.stat-divider {
  width: 1px;
  height: 36px;
  background: rgba(255,255,255,.2);
}

/* ────────────────────────────────────────
   15. Feature Grid
   ──────────────────────────────────────── */
.feature-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-md);
}

.feature-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.feature-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.feature-card h3 { font-size: var(--text-lg); font-weight: var(--weight-bold); margin-bottom: var(--space-2); }
.feature-card p { font-size: var(--text-sm); color: var(--text-muted); line-height: var(--leading-relaxed); }

/* ────────────────────────────────────────
   16. FAQ Accordion
   ──────────────────────────────────────── */
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow var(--transition-md);
}

.faq-item.open { box-shadow: var(--shadow-md); border-color: rgba(var(--primary-rgb), .2); }

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  background: var(--surface);
  cursor: pointer;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text);
  user-select: none;
  gap: var(--space-4);
  transition: background var(--transition);
}

.faq-question:hover { background: var(--surface-2); }
.faq-item.open .faq-question { color: var(--primary); background: var(--primary-light); }

.faq-chevron {
  width: 24px; height: 24px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--transition-md), background var(--transition-md), border-color var(--transition-md);
  font-size: 14px;
  color: var(--text-muted);
}

.faq-item.open .faq-chevron {
  transform: rotate(180deg);
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.faq-answer {
  display: none;
  padding: var(--space-5) var(--space-6);
  background: var(--surface);
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
  border-top: 1px solid var(--border);
}

.faq-item.open .faq-answer { display: block; animation: fadeIn .2s ease; }

/* ────────────────────────────────────────
   17. Tool Page Layout
   ──────────────────────────────────────── */
.tool-page {
  min-height: calc(100vh - var(--nav-h));
}

.tool-hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--space-10) 0 var(--space-8);
}

.tool-hero-inner {
  max-width: 800px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.breadcrumb a { color: var(--text-muted); transition: color var(--transition); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--text-subtle); font-size: var(--text-xs); }
.breadcrumb-current { color: var(--text); font-weight: var(--weight-medium); }

.tool-hero h1 {
  font-size: clamp(var(--text-3xl), 3vw, var(--text-4xl));
  font-weight: var(--weight-extrabold);
  letter-spacing: -0.5px;
  margin-bottom: var(--space-3);
}

.tool-hero-desc {
  font-size: var(--text-lg);
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-5);
}

.tool-badges {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.tool-workspace {
  padding: var(--space-10) 0 var(--space-16);
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--space-8);
  align-items: start;
}

.tool-main { min-width: 0; }
.tool-sidebar { min-width: 0; }

.tool-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: var(--space-6);
}

.tool-panel-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tool-panel-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

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

/* Result area */
.result-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: var(--space-6);
}

.result-preview {
  padding: var(--space-6);
  min-height: 120px;
  font-size: var(--text-sm);
  color: var(--text);
  line-height: var(--leading-relaxed);
}

.result-actions {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: center;
}

/* Steps guide */
.steps-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.step-item {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}

.step-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-content h4 { font-size: var(--text-base); font-weight: var(--weight-semibold); margin-bottom: var(--space-1); }
.step-content p { font-size: var(--text-sm); color: var(--text-muted); }

/* Related tools */
.related-tools {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

.related-tool-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  transition: all var(--transition);
}

.related-tool-link:hover {
  background: var(--primary-light);
  border-color: rgba(var(--primary-rgb), .2);
  color: var(--primary);
  transform: translateX(3px);
}

/* ────────────────────────────────────────
   18. Search Results
   ──────────────────────────────────────── */
.search-results-overlay {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
  overflow: hidden;
  max-height: 400px;
  overflow-y: auto;
}

.search-results-overlay.open { display: block; animation: fadeInDown .15s ease; }

.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border-light);
  text-decoration: none;
  color: inherit;
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--surface-2); }

.search-result-icon { font-size: 20px; width: 32px; text-align: center; flex-shrink: 0; }
.search-result-name { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text); }
.search-result-cat  { font-size: var(--text-xs); color: var(--text-muted); }

.search-no-results {
  padding: var(--space-8);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* ────────────────────────────────────────
   19. Category Filter Tabs
   ──────────────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-8);
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.filter-tab:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.filter-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.filter-tab .tab-count { font-size: var(--text-xs); opacity: .75; }

/* ────────────────────────────────────────
   20. Footer
   ──────────────────────────────────────── */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: var(--space-16) 0 var(--space-8);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(4, 1fr);
  gap: var(--space-10);
  margin-bottom: var(--space-12);
}

.footer-brand p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
  margin-top: var(--space-4);
  max-width: 280px;
}

.footer-trust {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-5);
  flex-wrap: wrap;
}

.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
}

.footer-col h4 {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text);
  margin-bottom: var(--space-5);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-links a {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.footer-links a:hover { color: var(--primary); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.footer-legal {
  display: flex;
  gap: var(--space-5);
  flex-wrap: wrap;
}

.footer-legal a {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-legal a:hover { color: var(--primary); }
.footer-copy { font-size: var(--text-sm); color: var(--text-muted); }

/* ────────────────────────────────────────
   21. Animations
   ──────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

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

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

.animate-fadeInUp { animation: fadeInUp .5s ease both; }
.animate-fadeIn   { animation: fadeIn .4s ease both; }

/* ────────────────────────────────────────
   22. Toast Notifications
   ──────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: var(--space-4) var(--space-5);
  pointer-events: auto;
  animation: fadeInUp .3s ease both;
  min-width: 280px;
  max-width: 360px;
}

.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-error   { border-left: 4px solid var(--danger); }
.toast.toast-info    { border-left: 4px solid var(--info); }
.toast.toast-warning { border-left: 4px solid var(--warning); }

.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-message { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text); flex: 1; }
.toast-close { color: var(--text-muted); cursor: pointer; font-size: 18px; flex-shrink: 0; transition: color var(--transition); }
.toast-close:hover { color: var(--text); }

/* ────────────────────────────────────────
   23. Code Preview
   ──────────────────────────────────────── */
.code-preview {
  background: #0F1117;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid #2D3148;
}

.code-preview-header {
  background: #1A1D27;
  padding: var(--space-3) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #2D3148;
}

.code-preview-dots { display: flex; gap: 6px; }
.code-dot { width: 12px; height: 12px; border-radius: 50%; }
.code-dot-red   { background: #FF5F57; }
.code-dot-yellow{ background: #FFBD2E; }
.code-dot-green { background: #28C840; }

.code-preview-lang {
  font-size: var(--text-xs);
  color: #9CA3AF;
  font-family: var(--font-mono);
}

.code-preview pre {
  padding: var(--space-5);
  overflow-x: auto;
  margin: 0;
}

.code-preview code {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: #E8EAEF;
  line-height: var(--leading-relaxed);
}

/* ────────────────────────────────────────
   24. "How it Works" Steps
   ──────────────────────────────────────── */
.how-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-8);
  position: relative;
}

.how-steps::before {
  content: '';
  position: absolute;
  top: 28px;
  left: calc(16.66% + 28px);
  right: calc(16.66% + 28px);
  height: 2px;
  background: linear-gradient(90deg, var(--primary), rgba(var(--primary-rgb), .2));
}

.how-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-4);
}

.how-step-num {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: var(--text-xl);
  font-weight: var(--weight-extrabold);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-primary);
}

.how-step h3 { font-size: var(--text-lg); font-weight: var(--weight-bold); }
.how-step p  { font-size: var(--text-sm); color: var(--text-muted); line-height: var(--leading-relaxed); }

/* ────────────────────────────────────────
   25. Responsive
   ──────────────────────────────────────── */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr 1fr; }
  .footer-brand { grid-column: 1/-1; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-6 { grid-template-columns: repeat(3, 1fr); }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-sidebar { order: -1; }
  .how-steps { grid-template-columns: 1fr; }
  .how-steps::before { display: none; }
}

@media (max-width: 768px) {
  :root { --nav-h: 60px; }
  .container { padding: 0 var(--space-4); }
  .section { padding: var(--space-12) 0; }
  .hero { padding: var(--space-12) 0 var(--space-10); }
  .hero h1 { letter-spacing: -1px; }
  .hero-sub { font-size: var(--text-lg); }
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .stats-inner { gap: var(--space-6); }
  .stat-divider { display: none; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .hero-search-btn .btn-text { display: none; }
}

@media (max-width: 480px) {
  .hero-search-input { font-size: var(--text-base); }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-6 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr; }
  .filter-tabs { gap: var(--space-2); }
  .tool-grid { gap: var(--space-4); }
}

/* ────────────────────────────────────────
   26. Utility Classes
   ──────────────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.no-select { user-select: none; }
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }

.bg-surface   { background: var(--surface); }
.bg-surface-2 { background: var(--surface-2); }
.bg-primary   { background: var(--primary); color: #fff; }
.bg-success   { background: var(--success); color: #fff; }
.bg-warning   { background: var(--warning); color: #fff; }
.bg-danger    { background: var(--danger); color: #fff; }

.border { border: 1px solid var(--border); }
.border-primary { border-color: rgba(var(--primary-rgb), .4); }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

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

/* Selection */
::selection { background: rgba(var(--primary-rgb), .2); color: var(--text); }

/* ────────────────────────────────────────
   27. Category Color Themes
   ──────────────────────────────────────── */
.cat-pdf    { --cat: #EF4444; --cat-bg: #FEE2E2; }
.cat-image  { --cat: #8B5CF6; --cat-bg: #EDE9FE; }
.cat-calc   { --cat: #F59E0B; --cat-bg: #FEF3C7; }
.cat-health { --cat: #10B981; --cat-bg: #D1FAE5; }
.cat-text   { --cat: #3B82F6; --cat-bg: #DBEAFE; }
.cat-dev    { --cat: #6366F1; --cat-bg: #E0E7FF; }

[data-theme="dark"] .cat-pdf    { --cat-bg: rgba(239,68,68,.15); }
[data-theme="dark"] .cat-image  { --cat-bg: rgba(139,92,246,.15); }
[data-theme="dark"] .cat-calc   { --cat-bg: rgba(245,158,11,.15); }
[data-theme="dark"] .cat-health { --cat-bg: rgba(16,185,129,.15); }
[data-theme="dark"] .cat-text   { --cat-bg: rgba(59,130,246,.15); }
[data-theme="dark"] .cat-dev    { --cat-bg: rgba(99,102,241,.15); }

.cat-icon {
  background: var(--cat-bg);
  color: var(--cat);
}

/* CTA Section */
.cta-section {
  background: linear-gradient(135deg, var(--primary) 0%, #7B5EA7 50%, #06B6D4 100%);
  padding: var(--space-20) 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='20'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.cta-section h2 {
  color: #fff;
  font-size: clamp(var(--text-3xl), 4vw, var(--text-5xl));
  font-weight: var(--weight-extrabold);
  letter-spacing: -1px;
  margin-bottom: var(--space-4);
  position: relative;
}

.cta-section p {
  color: rgba(255,255,255,.8);
  font-size: var(--text-xl);
  margin-bottom: var(--space-8);
  position: relative;
}

.btn-white {
  background: #fff;
  color: var(--primary);
  border-color: #fff;
  font-weight: var(--weight-bold);
}

.btn-white:hover {
  background: rgba(255,255,255,.9);
  color: var(--primary-dark);
  border-color: rgba(255,255,255,.9);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0,0,0,.15);
}
