/* ═══════════════════════════════════════════
   TOOLBOX — Design System
   Font: DM Sans | Accent: Indigo
   ═══════════════════════════════════════════ */

:root {
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --bg: #f8f9fc;
  --surface: #ffffff;
  --surface-hover: #f1f3f9;
  --border: #e2e6ef;
  --border-light: #eef1f6;

  --text: #1a1d2e;
  --text-muted: #6b7194;
  --text-light: #9da3c0;

  --accent: #6366f1;
  --accent-hover: #5457e5;
  --accent-light: #eef0ff;
  --accent-glow: rgba(99, 102, 241, 0.15);

  --success: #10b981;
  --success-bg: #ecfdf5;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --warning: #f59e0b;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.08);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);

  --container: 1200px;
  --header-h: 64px;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

/* ─── Container ─── */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 1.25rem; }

/* ─── Header ─── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(248,249,252,0.85);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border-light);
  height: var(--header-h);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h);
}
.logo {
  display: flex; align-items: center; gap: 0.6rem;
  font-weight: 700; font-size: 1.15rem; color: var(--text);
}
.logo-icon { display: flex; }
.main-nav { display: flex; align-items: center; gap: 0.25rem; }
.nav-link {
  padding: 0.5rem 0.85rem; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 500; color: var(--text-muted);
  transition: var(--transition); background: none; border: none;
  display: flex; align-items: center; gap: 0.3rem;
}
.nav-link:hover, .nav-link.active { color: var(--text); background: var(--surface-hover); }
.nav-dropdown { position: relative; }
.nav-dropdown-menu {
  position: absolute; top: calc(100% + 4px); left: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  min-width: 200px; padding: 0.4rem;
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: var(--transition);
}
.nav-dropdown:hover .nav-dropdown-menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.dropdown-item {
  display: block; padding: 0.55rem 0.85rem; border-radius: var(--radius-sm);
  font-size: 0.875rem; color: var(--text-muted); transition: var(--transition);
}
.dropdown-item:hover { background: var(--surface-hover); color: var(--text); }

/* Mobile Nav */
.mobile-menu-btn {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; padding: 8px;
}
.mobile-menu-btn span {
  display: block; width: 22px; height: 2px; background: var(--text);
  transition: var(--transition); border-radius: 2px;
}
.mobile-menu-btn.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.mobile-menu-btn.open span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }
.mobile-nav {
  display: none; flex-direction: column;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0.5rem 1rem;
}
.mobile-nav.open { display: flex; }
.mobile-nav-link {
  padding: 0.7rem 0.5rem; font-size: 0.95rem; color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
}
.mobile-nav-link:hover { color: var(--accent); }

@media (max-width: 768px) {
  .main-nav { display: none; }
  .mobile-menu-btn { display: flex; }
}

/* ─── Hero ─── */
.hero {
  position: relative; padding: 4.5rem 0 3.5rem; overflow: hidden;
  text-align: center;
}
.hero-bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(236,72,153,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 0%, rgba(99,102,241,0.05) 0%, transparent 50%);
}
.hero-badge {
  display: inline-block; padding: 0.35rem 1rem; border-radius: 100px;
  background: var(--accent-light); color: var(--accent);
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em;
  margin-bottom: 1.25rem;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700; line-height: 1.15; letter-spacing: -0.025em;
  margin-bottom: 1rem;
}
.gradient-text {
  background: linear-gradient(135deg, var(--accent), #ec4899);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 1.1rem; color: var(--text-muted); max-width: 520px;
  margin: 0 auto 2rem; line-height: 1.6;
}
.hero-search {
  max-width: 520px; margin: 0 auto; position: relative;
}
.hero-search i {
  position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
  color: var(--text-light); width: 20px; height: 20px;
}
.hero-search input {
  width: 100%; padding: 0.9rem 1rem 0.9rem 2.75rem;
  border: 2px solid var(--border); border-radius: 100px;
  background: var(--surface); font-size: 0.95rem;
  box-shadow: var(--shadow-sm); transition: var(--transition);
  outline: none; font-family: var(--font);
}
.hero-search input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow);
}

/* ─── Sections ─── */
.section { padding: 3rem 0; }
.section-header { margin-bottom: 2rem; }
.section-header h2 {
  font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 0.3rem;
}
.section-header p { color: var(--text-muted); font-size: 0.95rem; }

/* ─── Tool Cards ─── */
.tools-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.tool-card {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1.25rem; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border-light);
  transition: var(--transition); position: relative;
}
.tool-card:hover {
  border-color: var(--accent); box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.tool-card-icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--cat-color, var(--accent)) 10%, transparent);
  color: var(--cat-color, var(--accent));
  flex-shrink: 0;
}
.tool-card-icon svg { width: 20px; height: 20px; }
.tool-card-body h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.25rem; }
.tool-card-body p {
  font-size: 0.82rem; color: var(--text-muted); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tool-card-arrow {
  position: absolute; right: 1rem; top: 50%; transform: translateY(-50%);
  opacity: 0; color: var(--accent); transition: var(--transition);
}
.tool-card:hover .tool-card-arrow { opacity: 1; }

.featured-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.featured-card { border-left: 3px solid var(--cat-color, var(--accent)); }

/* ─── Category Blocks ─── */
.category-block { margin-bottom: 2.5rem; }
.category-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.category-title-group { display: flex; align-items: center; gap: 0.5rem; }
.category-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.category-header h3 { font-size: 1.15rem; font-weight: 600; }
.category-count {
  font-size: 0.75rem; color: var(--text-light); background: var(--surface-hover);
  padding: 0.15rem 0.55rem; border-radius: 100px;
}
.category-viewall {
  font-size: 0.85rem; color: var(--accent); font-weight: 500;
  display: flex; align-items: center; gap: 0.2rem;
}

/* ─── Breadcrumbs ─── */
.breadcrumbs {
  font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.5rem; padding-top: 1.5rem;
}
.breadcrumbs a { color: var(--accent); }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs .sep { margin: 0 0.4rem; color: var(--text-light); }
.breadcrumbs .current { color: var(--text); font-weight: 500; }

/* ─── Tool Page ─── */
.tool-page { padding-bottom: 3rem; }
.tool-hero { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 2rem; }
.tool-hero-icon {
  width: 56px; height: 56px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--cat-color, var(--accent)) 12%, transparent);
  color: var(--cat-color, var(--accent)); flex-shrink: 0;
}
.tool-hero-icon svg { width: 26px; height: 26px; }
.tool-hero h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.tool-hero-desc { color: var(--text-muted); font-size: 0.95rem; margin-top: 0.2rem; }

/* ─── Upload Zone ─── */
.tool-workspace { max-width: 720px; }
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg); padding: 3rem 2rem;
  text-align: center; transition: var(--transition); cursor: pointer;
  background: var(--surface);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent); background: var(--accent-light);
}
.upload-icon { color: var(--accent); margin-bottom: 0.75rem; }
.upload-icon svg { width: 48px; height: 48px; }
.upload-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.3rem; }
.upload-sub { color: var(--text-muted); font-size: 0.9rem; }
.upload-browse { color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; }
.upload-hint { color: var(--text-light); font-size: 0.8rem; margin-top: 0.75rem; }

/* ─── File List ─── */
.file-list {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); overflow: hidden; margin-top: 1rem;
}
.file-list-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--border-light);
}
.file-list-header h3 { font-size: 0.9rem; font-weight: 600; }
.file-list-items { max-height: 300px; overflow-y: auto; }
.file-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 1.25rem; border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
}
.file-item:last-child { border-bottom: none; }
.file-item-icon { color: var(--accent); flex-shrink: 0; width: 18px; height: 18px; }
.file-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item-size { color: var(--text-light); font-size: 0.8rem; }
.file-item-remove {
  background: none; border: none; color: var(--text-light);
  padding: 4px; border-radius: 4px; transition: var(--transition);
}
.file-item-remove:hover { color: var(--danger); background: var(--danger-bg); }

/* ─── Tool Options ─── */
.tool-options {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 1.25rem; margin-top: 1rem;
}
.option-group { margin-bottom: 0.75rem; }
.option-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.35rem; }
.option-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.radio-group { display: flex; gap: 1rem; }
.radio-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; cursor: pointer; }

.input {
  padding: 0.6rem 0.85rem; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 0.9rem;
  background: var(--surface); color: var(--text);
  transition: var(--transition); outline: none;
  font-family: var(--font); width: 100%;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.range-input {
  -webkit-appearance: none; width: 100%; height: 6px;
  background: var(--border); border-radius: 3px; outline: none;
  margin: 0.5rem 0;
}
.range-input::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px;
  border-radius: 50%; background: var(--accent); cursor: pointer;
  box-shadow: 0 1px 4px rgba(99,102,241,0.3);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.25rem; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 600; border: none;
  transition: var(--transition); text-align: center; justify-content: center;
  font-family: var(--font);
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 12px var(--accent-glow); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-lg { padding: 0.75rem 1.75rem; font-size: 0.95rem; border-radius: var(--radius); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-bg); }

.tool-actions { margin-top: 1.25rem; display: flex; gap: 0.75rem; }

/* ─── Progress Bar ─── */
.progress-bar { margin-top: 1.5rem; }
.progress-track {
  width: 100%; height: 8px; background: var(--border);
  border-radius: 4px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), #818cf8);
  border-radius: 4px; width: 0%; transition: width 0.3s ease;
}
.progress-text {
  font-size: 0.85rem; color: var(--text-muted);
  margin-top: 0.5rem; text-align: center;
}

/* ─── Result Area ─── */
.result-area { margin-top: 1.5rem; }
.result-success {
  text-align: center; padding: 2.5rem 1.5rem;
  background: var(--success-bg); border-radius: var(--radius-lg);
}
.result-icon { color: var(--success); margin-bottom: 0.75rem; }
.result-icon svg { width: 48px; height: 48px; }
.result-success h3 { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.3rem; }
.result-success p { color: var(--text-muted); margin-bottom: 1.25rem; }
.result-success .btn { margin: 0 0.35rem; }

/* ─── Client-Side Tool Styles ─── */
.client-tool-layout { max-width: 720px; }
.client-tool-input { margin-bottom: 1rem; }
.client-tool-input label { display: block; font-weight: 600; margin-bottom: 0.5rem; }
.client-tool-actions { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.client-tool-output { margin-top: 0.5rem; }
.output-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem;
}
.output-header label { font-weight: 600; }

.code-textarea {
  width: 100%; padding: 1rem; border: 1.5px solid var(--border);
  border-radius: var(--radius); font-family: var(--font-mono);
  font-size: 0.85rem; background: var(--surface); color: var(--text);
  outline: none; resize: vertical; transition: var(--transition);
}
.code-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.code-output {
  padding: 1rem; background: #1e1e2e; color: #cdd6f4;
  border-radius: var(--radius); font-family: var(--font-mono);
  font-size: 0.82rem; overflow-x: auto; min-height: 120px;
  white-space: pre; line-height: 1.6;
}

.tool-status {
  font-size: 0.85rem; margin-top: 0.5rem; font-weight: 500;
}
.status-success { color: var(--success); }
.status-error { color: var(--danger); }

.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem; margin-top: 1.25rem;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 1rem; text-align: center;
}
.stat-num { font-size: 1.75rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

.char-count { font-size: 0.75rem; color: var(--text-light); }

/* Google Preview */
.google-preview {
  background: var(--surface); padding: 1.25rem; border-radius: var(--radius);
  border: 1px solid var(--border-light);
}
.gp-title { font-size: 1.1rem; color: #1a0dab; font-family: arial, sans-serif; margin-bottom: 0.2rem; }
.gp-url { font-size: 0.82rem; color: #006621; margin-bottom: 0.2rem; }
.gp-desc { font-size: 0.85rem; color: #545454; line-height: 1.5; }

/* ─── Related Section ─── */
.related-section { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border-light); }
.related-section h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 1.25rem; }

/* ─── Footer ─── */
.site-footer {
  background: var(--surface); border-top: 1px solid var(--border-light);
  padding: 3rem 0 1.5rem; margin-top: 3rem;
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem;
  margin-bottom: 2rem;
}
.footer-brand .logo { margin-bottom: 0.75rem; }
.footer-desc { color: var(--text-muted); font-size: 0.85rem; line-height: 1.6; max-width: 280px; }
.footer-links h4 { font-size: 0.85rem; font-weight: 700; margin-bottom: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.footer-links a {
  display: block; color: var(--text-muted); font-size: 0.85rem;
  padding: 0.25rem 0; transition: var(--transition);
}
.footer-links a:hover { color: var(--accent); }
.footer-bottom {
  padding-top: 1.5rem; border-top: 1px solid var(--border-light);
  text-align: center; color: var(--text-light); font-size: 0.8rem;
}

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero { padding: 3rem 0 2.5rem; }
  .tools-grid { grid-template-columns: 1fr; }
  .featured-grid { grid-template-columns: 1fr; }
  .option-row { flex-direction: column; }
}

@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .tool-hero { flex-direction: column; align-items: flex-start; }
}

/* ─── Ads ─── */
.ad-container { margin: 1.5rem 0; text-align: center; min-height: 90px; }

/* ─── Utilities ─── */
.empty-state { text-align: center; padding: 3rem; color: var(--text-muted); }
.text-muted { color: var(--text-muted); }
