/* ============================================
   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); }

/* 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); }
.category-title { font-size: 1.0625rem; font-weight: 700; color: var(--surface-700); margin-bottom: 1rem; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 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); text-decoration: none; }
.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-disabled { opacity: .7; }
.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; }
.home-hero { padding: 3.5rem 0 2.5rem; text-align: center; }
.home-hero h1 { font-size: clamp(2rem,4vw,3.2rem); line-height: 1.1; margin-bottom: .75rem; color: var(--surface-800); }
.home-hero p { max-width: 760px; margin: 0 auto; color: var(--surface-500); font-size: 1.05rem; line-height: 1.7; }
.hero-pill { display: inline-flex; align-items: center; gap: .5rem; padding: .5rem .875rem; border-radius: 999px; background: var(--brand-50); color: var(--brand-700); font-size: .8125rem; font-weight: 700; margin-bottom: 1rem; border: 1px solid var(--brand-100); }
.hero-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }
.hero-link-btn { text-decoration: none; background: var(--surface-100); padding: .75rem 1rem; border-radius: .625rem; }
.home-section { margin: 1.5rem 0 2.25rem; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.section-note { font-size: .8125rem; color: var(--surface-500); }
.section-subtitle { font-size: .9375rem; color: var(--surface-500); max-width: 720px; margin-top: -.25rem; }
.tool-card-featured { background: linear-gradient(180deg,var(--surface-50),#fff); border-color: var(--brand-200); box-shadow: 0 8px 30px rgba(37,99,235,.08); }
.tool-card-primary { padding: 1.25rem; }
.tool-card-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.tool-card-footer { margin-top: .75rem; font-size: .8125rem; color: var(--brand-600); font-weight: 700; }
.tool-card-points { margin-top: .75rem; padding-left: 1rem; color: var(--surface-600); font-size: .8125rem; }
.tool-card-points li { margin-bottom: .35rem; }
.tool-badge-inline { padding: .25rem .5rem; border-radius: 999px; background: var(--brand-50); color: var(--brand-700); border: 1px solid var(--brand-100); font-size: .6875rem; font-weight: 700; }
.value-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1rem; }
.value-card { background: var(--surface-100); border: 1px solid var(--surface-200); border-radius: .75rem; padding: 1.25rem; }
.value-card h3 { font-size: 1rem; color: var(--surface-800); margin: .5rem 0; }
.value-card p { font-size: .875rem; color: var(--surface-500); line-height: 1.65; }
.value-icon { font-size: 1.5rem; }
.hero-mini-stats { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; margin-top: 1.5rem; }
.hero-mini-stat { min-width: 120px; padding: .75rem 1rem; background: var(--surface-100); border: 1px solid var(--surface-200); border-radius: .75rem; }
.hero-mini-stat strong { display: block; color: var(--brand-600); font-size: 1.125rem; }
.hero-mini-stat span { display: block; font-size: .75rem; color: var(--surface-500); margin-top: .125rem; }
.homepage-faq { margin-top: 1rem; }

/* 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); }
.divider { border: none; border-top: 1px solid var(--surface-200); margin: 1rem 0; }

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