/* ============================================
   Toolkit.Fun - Complete Stylesheet
   All tools share this file.
   ============================================ */

/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

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

:root {
  --brand-50: #eff6ff; --brand-100: #dbeafe; --brand-500: #3b82f6; --brand-600: #2563eb; --brand-700: #1d4ed8;
  --surface-50: #f8fafc; --surface-100: #f1f5f9; --surface-200: #e2e8f0; --surface-300: #cbd5e1;
  --surface-400: #94a3b8; --surface-500: #64748b; --surface-600: #475569; --surface-700: #334155; --surface-800: #1e293b; --surface-900: #0f172a;
  --success: #22c55e; --warning: #f59e0b; --danger: #ef4444;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --radius: 0.625rem;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.04);
  --transition: 0.15s ease;
}

[data-theme="dark"] {
  --surface-50: #0f172a; --surface-100: #1e293b; --surface-200: #334155; --surface-300: #475569;
  --surface-400: #64748b; --surface-500: #94a3b8; --surface-600: #cbd5e1; --surface-700: #e2e8f0;
  --surface-800: #f1f5f9; --surface-900: #f8fafc;
  --brand-50: #172032; --brand-100: #1e3a6e;
}

body {
  font-family: var(--font); font-size: 1rem; line-height: 1.6;
  color: var(--surface-700); background: var(--surface-50); transition: var(--transition);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-600); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--brand-700); text-decoration: underline; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 1.25rem; }

/* Flex layout */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.min-h-screen { min-height: 100vh; }

/* Header */
header { background: var(--surface-100); border-bottom: 1px solid var(--surface-200); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; gap: 1.5rem; padding: 0.875rem 1.25rem; max-width: 1120px; margin: 0 auto; }
.logo { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; }
.logo-icon { width: 36px; height: 36px; background: var(--brand-600); color: #fff; border-radius: 0.5rem; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 1rem; flex-shrink: 0; }
.logo-text { font-weight: 800; font-size: 1.125rem; color: var(--surface-800); }
.logo-text span { color: var(--brand-600); }
nav { display: flex; gap: 0.25rem; flex: 1; }
nav a { padding: 0.375rem 0.75rem; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 500; color: var(--surface-600); text-decoration: none; transition: var(--transition); }
nav a:hover { background: var(--surface-200); color: var(--surface-800); }
.header-actions { display: flex; gap: 0.5rem; }
.icon-btn { width: 36px; height: 36px; border: none; background: var(--surface-200); border-radius: 0.5rem; cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.icon-btn:hover { background: var(--surface-300); }

/* Breadcrumb */
.breadcrumb { padding: 0.75rem 0; font-size: 0.8125rem; color: var(--surface-400); }
.breadcrumb a { color: var(--surface-500); }
.breadcrumb a:hover { color: var(--brand-600); }
.breadcrumb-sep { margin: 0 0.375rem; color: var(--surface-300); }

/* Main content layout */
.main-layout { display: grid; grid-template-columns: 1fr 280px; gap: 2rem; padding: 1.5rem 0 3rem; align-items: start; }
@media (max-width: 768px) { .main-layout { grid-template-columns: 1fr; } }

/* Tool header card */
.tool-header { margin-bottom: 1.5rem; }
.tool-h1 { font-size: 1.75rem; font-weight: 900; color: var(--surface-900); line-height: 1.25; margin-bottom: 0.5rem; }
.tool-desc { font-size: 1rem; color: var(--surface-500); line-height: 1.7; max-width: 640px; }
.tool-badge-bar { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }
.tool-badge { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.25rem 0.625rem; background: var(--brand-50); color: var(--brand-600); border-radius: 999px; font-size: 0.75rem; font-weight: 600; border: 1px solid var(--brand-100); }
[data-theme="dark"] .tool-badge { background: var(--brand-100); border-color: var(--brand-500); }

/* Tool body */
.tool-body { background: var(--surface-100); border: 1px solid var(--surface-200); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.5rem; }
.tool-ui { padding: 1.5rem; }

/* Inputs */
.tool-input, .tool-textarea, .tool-select {
  width: 100%; padding: 0.625rem 0.875rem; border: 1px solid var(--surface-200);
  border-radius: 0.5rem; font-size: 0.9375rem; font-family: var(--font);
  background: var(--surface-50); color: var(--surface-800);
  transition: var(--transition); outline: none;
}
.tool-input:focus, .tool-textarea:focus, .tool-select:focus {
  border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.tool-textarea { resize: vertical; min-height: 160px; line-height: 1.6; }
.tool-output { width: 100%; padding: 0.75rem 0.875rem; background: var(--surface-50); border: 1px solid var(--surface-200); border-radius: 0.5rem; font-size: 0.9375rem; min-height: 56px; color: var(--brand-600); white-space: pre-wrap; overflow-x: auto; max-width: 100%; font-family: 'SF Mono', 'Fira Code', monospace; }
.tool-output::-webkit-scrollbar { height: 6px; }
.tool-output::-webkit-scrollbar-track { background: var(--surface-200); border-radius: 3px; }
.tool-output::-webkit-scrollbar-thumb { background: var(--surface-400); border-radius: 3px; }
.tool-row { display: flex; gap: 0.75rem; align-items: flex-end; margin-bottom: 0.75rem; }
.tool-row .tool-input { flex: 1; }

/* Buttons */
.tool-btn { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.625rem 1.25rem; background: var(--brand-600); color: #fff; border: none; border-radius: 0.5rem; font-size: 0.9375rem; font-weight: 600; cursor: pointer; font-family: var(--font); transition: var(--transition); white-space: nowrap; }
.tool-btn:hover { background: var(--brand-700); }
.tool-btn:active { transform: scale(0.98); }
.copy-btn { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.625rem 1rem; background: var(--surface-200); color: var(--surface-600); border: none; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 600; cursor: pointer; font-family: var(--font); transition: var(--transition); }
.copy-btn:hover { background: var(--surface-300); color: var(--surface-700); }

/* Section boxes (FAQ, How to Use, Use Cases) */
.section-box { padding: 1.25rem 1.5rem; background: var(--surface-100); border: 1px solid var(--surface-200); border-radius: var(--radius); margin-bottom: 1rem; }
.section-title { font-size: 1.0625rem; font-weight: 700; color: var(--surface-800); margin-bottom: 0.875rem; display: flex; align-items: center; gap: 0.5rem; }
.faq-item { margin-bottom: 0.875rem; }
.faq-item:last-child { margin-bottom: 0; }
.faq-q { font-weight: 600; color: var(--surface-800); font-size: 0.9375rem; margin-bottom: 0.25rem; }
.faq-a { font-size: 0.9375rem; color: var(--surface-500); line-height: 1.65; }
.steps { padding-left: 1.25rem; font-size: 0.9375rem; }
.steps li { margin-bottom: 0.5rem; color: var(--surface-600); line-height: 1.6; }
.steps li strong { color: var(--surface-800); }
.use-case-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.5rem; }
.use-case-item { padding: 0.625rem 0.875rem; background: var(--surface-50); border: 1px solid var(--surface-200); border-radius: 0.5rem; font-size: 0.875rem; color: var(--surface-600); }

/* Sidebar */
.tool-sidebar { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 5rem; }
.sidebar-box { padding: 1.125rem; background: var(--surface-100); border: 1px solid var(--surface-200); border-radius: var(--radius); }
.sidebar-title { font-size: 0.875rem; font-weight: 700; color: var(--surface-700); margin-bottom: 0.75rem; border-bottom: 1px solid var(--surface-200); padding-bottom: 0.5rem; }
.sidebar-info-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; color: var(--surface-600); padding: 0.25rem 0; }
.related-grid { display: flex; flex-direction: column; gap: 0.375rem; }
.related-tool { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.625rem; border-radius: 0.5rem; background: var(--surface-50); border: 1px solid var(--surface-200); text-decoration: none; color: var(--surface-700); font-size: 0.8125rem; font-weight: 500; transition: var(--transition); }
.related-tool:hover { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-700); text-decoration: none; }
.related-tool-icon { font-size: 0.875rem; flex-shrink: 0; }
.ad-wrapper { padding: 0; }
.ad-placeholder { width: 100%; min-height: 250px; background: var(--surface-100); border: 1px dashed var(--surface-300); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 0.75rem; color: var(--surface-400); }

/* Footer */
footer { background: var(--surface-100); border-top: 1px solid var(--surface-200); margin-top: auto; padding: 1.5rem 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; max-width: 1120px; margin: 0 auto; padding: 0 1.25rem; }
.footer-text { font-size: 0.8125rem; color: var(--surface-400); }
.footer-links { display: flex; gap: 1rem; }
.footer-links a { font-size: 0.8125rem; color: var(--surface-400); }
.footer-links a:hover { color: var(--brand-600); }

/* Index page specific */
.index-footer { text-align: center; padding: 2rem 0; font-size: 0.875rem; color: var(--surface-400); }
.index-footer a { color: var(--surface-500); }
.hero { text-align: center; padding: 3.5rem 0 2.5rem; }
.hero-badge { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.375rem 1rem; background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 999px; font-size: 0.8125rem; font-weight: 600; color: var(--brand-600); margin-bottom: 1rem; }
.hero h1 { font-size: 2.5rem; font-weight: 900; color: var(--surface-900); margin-bottom: 0.75rem; line-height: 1.15; }
.hero p { font-size: 1.0625rem; color: var(--surface-500); max-width: 560px; margin: 0 auto; line-height: 1.7; }
.stats-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; padding: 1.25rem 0; border-top: 1px solid var(--surface-200); border-bottom: 1px solid var(--surface-200); margin-bottom: 2.5rem; text-align: center; }
.stat-num { font-size: 1.5rem; font-weight: 900; color: var(--brand-600); }
.stat-label { font-size: 0.75rem; color: var(--surface-400); font-weight: 500; }
.category-section { margin-bottom: 2.5rem; }
.category-header { display: flex; align-items: center; gap: 0.625rem; margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 2px solid var(--surface-200); }
.category-icon { font-size: 1.25rem; }
.category-title { font-size: 1.125rem; font-weight: 800; color: var(--surface-800); }
.category-count { margin-left: auto; font-size: 0.75rem; color: var(--surface-400); font-weight: 500; background: var(--surface-100); padding: 0.125rem 0.5rem; border-radius: 999px; border: 1px solid var(--surface-200); }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.75rem; }
.tool-card { display: flex; align-items: flex-start; gap: 0.875rem; padding: 1rem; background: var(--surface-100); border: 1px solid var(--surface-200); border-radius: var(--radius); text-decoration: none; color: inherit; transition: var(--transition); }
.tool-card:hover { background: var(--brand-50); border-color: var(--brand-200); text-decoration: none; }
.tool-card-icon { font-size: 1.5rem; flex-shrink: 0; margin-top: 0.125rem; }
.tool-card-title { font-size: 0.9375rem; font-weight: 700; color: var(--surface-800); margin-bottom: 0.25rem; }
.tool-card-desc { font-size: 0.8125rem; color: var(--surface-500); line-height: 1.5; }

/* Mobile */
@media (max-width: 640px) {
  nav { display: none; }
  .hero h1 { font-size: 1.75rem; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .tools-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; text-align: center; }
}

/* Copied toast */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(80px);
  background: #1e293b; color: #ffffff; padding: 0.625rem 1.25rem;
  border-radius: 999px; font-size: 0.875rem; font-weight: 600;
  z-index: 9999; transition: transform 0.25s ease; pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* Section label */
.section-label { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--surface-400); margin-bottom: 0.5rem; }

/* Divider */
.divider { border: none; border-top: 1px solid var(--surface-200); margin: 1rem 0; }.lang-switcher { display:flex;align-items:center;gap:.375rem;font-size:.8125rem;color:var(--surface-500); }
.lang-switcher a { color:var(--surface-500);text-decoration:none;padding:.125rem .25rem;border-radius:.25rem; }
.lang-switcher a:hover { color:var(--brand-500); }
.lang-switcher a.active { color:var(--brand-500);font-weight:700; }

/* ====== Homepage ====== */
.page-hero { text-align:center; padding:3rem 0 2rem; }
.page-hero h1 { font-size:2.25rem; font-weight:800; color:var(--surface-800); margin-bottom:.5rem; }
.page-hero p { font-size:1.0625rem; color:var(--surface-500); }
.hero-search { }
.hero-search input { outline:none; transition:border-color .2s,box-shadow .2s; }
.hero-search input:focus { border-color:var(--brand-400); box-shadow:0 0 0 3px rgba(59,130,246,.1); }

.category-section { margin-bottom:2.5rem; }
.category-title { font-size:1.0625rem; font-weight:700; color:var(--surface-700); margin-bottom:1rem; padding-bottom:.5rem; border-bottom:2px solid var(--surface-100); }

.tools-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:1rem; }

.tool-card { display:flex; flex-direction:column; gap:.25rem; padding:1.125rem; background:var(--surface-50); border:1px solid var(--surface-200); border-radius:.75rem; text-decoration:none; transition:transform .15s,box-shadow .15s,border-color .15s; }
.tool-card:hover { transform:translateY(-2px); box-shadow:0 6px 20px rgba(0,0,0,.08); border-color:var(--brand-300); }
.tool-card-icon { font-size:1.75rem; margin-bottom:.25rem; }
.tool-card-name { font-size:.9375rem; font-weight:700; color:var(--surface-800); }
.tool-card-desc { font-size:.8125rem; color:var(--surface-500); line-height:1.5; flex:1; }
.tool-card-lang { display:flex; gap:.375rem; margin-top:.5rem; flex-wrap:wrap; }
.tool-card-lang span { font-size:.6875rem; padding:.125rem .375rem; background:var(--surface-100); color:var(--surface-500); border-radius:.25rem; }
.tool-card-disabled { opacity:.6; cursor:not-allowed; pointer-events:none; }

.stats-bar { display:grid; grid-template-columns:repeat(4,1fr); gap:1rem; margin:2rem 0; padding:1.5rem; background:var(--surface-50); border:1px solid var(--surface-200); border-radius:.75rem; }
.stat-item { text-align:center; }
.stat-num { font-size:1.75rem; font-weight:800; color:var(--brand-500); }
.stat-label { font-size:.75rem; color:var(--surface-500); margin-top:.125rem; }
