/* ========== CALCLY.IN DESIGN SYSTEM ========== */

/* --- CSS Variables --- */
:root {
  /* Colors - Light Mode */
  --bg-primary: #f8f9fc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0f2f8;
  --bg-card: #ffffff;
  --bg-input: #f4f6fb;
  --bg-hover: #edf0f7;
  --text-primary: #1a1d2e;
  --text-secondary: #5a5f7a;
  --text-tertiary: #8b90a5;
  --text-inverse: #ffffff;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #eef0ff;
  --accent-muted: #a5b4fc;
  --success: #22c55e;
  --success-bg: #dcfce7;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --error: #ef4444;
  --error-bg: #fef2f2;
  --border: #e2e5f0;
  --border-focus: #6366f1;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 48px rgba(0,0,0,0.12);

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.25rem;
  --fs-2xl: 1.5rem;
  --fs-3xl: 2rem;
  --fs-4xl: 2.5rem;
  --fs-5xl: 3rem;
  --lh-tight: 1.25;
  --lh-normal: 1.5;
  --lh-relaxed: 1.75;

  /* Spacing */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-20: 5rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --container-max: 1280px;
  --header-height: 64px;
  --sidebar-width: 280px;
}

/* --- Dark Mode --- */
[data-theme="dark"] {
  --bg-primary: #0f1117;
  --bg-secondary: #181b27;
  --bg-tertiary: #1e2235;
  --bg-card: #1e2235;
  --bg-input: #252a3e;
  --bg-hover: #2a3050;
  --text-primary: #e8eaf0;
  --text-secondary: #a0a5bd;
  --text-tertiary: #6b7194;
  --text-inverse: #0f1117;
  --accent: #818cf8;
  --accent-hover: #6366f1;
  --accent-light: #1e1f3d;
  --accent-muted: #4338ca;
  --success: #4ade80;
  --success-bg: #14532d;
  --warning: #fbbf24;
  --warning-bg: #78350f;
  --error: #f87171;
  --error-bg: #7f1d1d;
  --border: #2d3348;
  --border-focus: #818cf8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
  --shadow-xl: 0 20px 48px rgba(0,0,0,0.6);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; font-size: 16px; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition), color var(--transition);
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }
h1,h2,h3,h4,h5,h6 { line-height: var(--lh-tight); color: var(--text-primary); font-weight: 700; }
h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
ul, ol { list-style: none; }

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

/* --- Header --- */
.header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-secondary); border-bottom: 1px solid var(--border);
  height: var(--header-height);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 100%; max-width: var(--container-max); margin: 0 auto; padding: 0 var(--sp-4);
}
.logo { display: flex; align-items: center; gap: var(--sp-2); font-weight: 800; font-size: var(--fs-xl); color: var(--text-primary); }
.logo svg { width: 32px; height: 32px; }
.logo span { background: linear-gradient(135deg, var(--accent), #a855f7); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

.nav { display: flex; align-items: center; gap: var(--sp-6); }
.nav a { color: var(--text-secondary); font-weight: 500; font-size: var(--fs-sm); transition: color var(--transition); position: relative; }
.nav a:hover, .nav a.active { color: var(--accent); }
.nav a::after { content: ''; position: absolute; bottom: -4px; left: 0; width: 0; height: 2px; background: var(--accent); border-radius: var(--radius-full); transition: width var(--transition); }
.nav a:hover::after, .nav a.active::after { width: 100%; }

/* Mobile Nav Toggle */
.nav-toggle { display: none; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: var(--radius-md); color: var(--text-primary); }
.nav-toggle svg { width: 24px; height: 24px; }

/* Theme Toggle */
.theme-toggle {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full); color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--accent); }
.theme-toggle svg { width: 20px; height: 20px; }

/* --- Hero --- */
.hero {
  text-align: center; padding: var(--sp-16) var(--sp-4) var(--sp-12);
  background: linear-gradient(180deg, var(--accent-light) 0%, var(--bg-primary) 100%);
}
.hero h1 { font-size: var(--fs-5xl); margin-bottom: var(--sp-4); letter-spacing: -0.02em; }
.hero h1 span { background: linear-gradient(135deg, var(--accent), #a855f7); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero p { color: var(--text-secondary); font-size: var(--fs-lg); max-width: 600px; margin: 0 auto var(--sp-8); }

/* --- Search Bar --- */
.search-wrapper { max-width: 560px; margin: 0 auto; position: relative; }
.search-input {
  width: 100%; padding: var(--sp-4) var(--sp-4) var(--sp-4) var(--sp-12);
  background: var(--bg-secondary); border: 2px solid var(--border); border-radius: var(--radius-xl);
  font-size: var(--fs-lg); color: var(--text-primary); outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-md);
}
.search-input:focus { border-color: var(--accent); box-shadow: var(--shadow-lg), 0 0 0 4px var(--accent-light); }
.search-input::placeholder { color: var(--text-tertiary); }
.search-icon { position: absolute; left: var(--sp-4); top: 50%; transform: translateY(-50%); color: var(--text-tertiary); width: 20px; height: 20px; }
.search-results {
  position: absolute; top: calc(100% + var(--sp-2)); left: 0; right: 0; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  max-height: 400px; overflow-y: auto; z-index: 50; display: none;
}
.search-results.active { display: block; }
.search-result-item {
  padding: var(--sp-3) var(--sp-4); display: flex; align-items: center; gap: var(--sp-3);
  cursor: pointer; transition: background var(--transition); border-bottom: 1px solid var(--border);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-hover); }
.search-result-item .tool-name { font-weight: 600; font-size: var(--fs-sm); }
.search-result-item .tool-category { font-size: var(--fs-xs); color: var(--text-tertiary); }

/* --- Category Filters --- */
.category-filters {
  display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: center;
  padding: var(--sp-6) var(--sp-4); max-width: var(--container-max); margin: 0 auto;
}
.cat-filter-btn {
  padding: var(--sp-2) var(--sp-4); font-size: var(--fs-sm); font-weight: 500;
  border-radius: var(--radius-full); border: 1px solid var(--border);
  color: var(--text-secondary); background: var(--bg-secondary);
  transition: all var(--transition); white-space: nowrap;
}
.cat-filter-btn:hover, .cat-filter-btn.active {
  background: var(--accent); color: var(--text-inverse); border-color: var(--accent);
}

/* --- Section Headers --- */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-6); padding: 0 var(--sp-2);
}
.section-title { font-size: var(--fs-2xl); font-weight: 700; display: flex; align-items: center; gap: var(--sp-3); }
.section-title svg { width: 28px; height: 28px; color: var(--accent); }

/* --- Tool Card Grid --- */
.tools-section { padding: var(--sp-8) 0; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-4); }
.tool-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--sp-5); transition: all var(--transition); position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.tool-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), #a855f7); opacity: 0;
  transition: opacity var(--transition);
}
.tool-card:hover { border-color: var(--accent-muted); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.tool-card:hover::before { opacity: 1; }
.tool-card-header { display: flex; align-items: center; justify-content: space-between; }
.tool-card-icon {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  background: var(--accent-light); border-radius: var(--radius-md); color: var(--accent);
  flex-shrink: 0;
}
.tool-card-icon svg { width: 22px; height: 22px; }
.tool-card-fav { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-full); color: var(--text-tertiary); transition: all var(--transition); }
.tool-card-fav:hover, .tool-card-fav.active { color: var(--warning); }
.tool-card-fav svg { width: 18px; height: 18px; }
.tool-card h3 { font-size: var(--fs-base); font-weight: 600; margin-top: var(--sp-1); }
.tool-card h3 a { color: var(--text-primary); }
.tool-card h3 a:hover { color: var(--accent); }
.tool-card p { font-size: var(--fs-sm); color: var(--text-secondary); line-height: var(--lh-relaxed); flex-grow: 1; }

/* --- Tool Page Layout --- */
.tool-page { padding: var(--sp-8) 0 var(--sp-16); }
.tool-page-header { margin-bottom: var(--sp-8); }
.tool-page-header h1 { margin-bottom: var(--sp-2); }
.tool-page-desc { color: var(--text-secondary); font-size: var(--fs-lg); max-width: 70ch; }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-4); font-size: var(--fs-sm); }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { color: var(--text-tertiary); }
.breadcrumb .current { color: var(--text-primary); font-weight: 500; }

/* Tool Actions Bar */
.tool-actions { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-6); flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-sm); font-weight: 600; border-radius: var(--radius-md);
  transition: all var(--transition); min-height: 44px;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--accent-muted); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--error); color: white; }
.btn-danger:hover { opacity: 0.9; }
.btn-icon { width: 44px; padding: 0; justify-content: center; }
.btn-fav.active { color: var(--warning); background: var(--warning-bg); }
.btn-sm { min-height: 36px; padding: var(--sp-1) var(--sp-3); font-size: var(--fs-xs); }
.btn-lg { min-height: 52px; padding: var(--sp-3) var(--sp-6); font-size: var(--fs-base); }

/* --- Tool Interface Container --- */
.tool-interface {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--sp-6); margin-bottom: var(--sp-8);
}
.tool-interface-split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }

/* --- Form Elements --- */
.form-group { margin-bottom: var(--sp-4); }
.form-label { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--text-primary); margin-bottom: var(--sp-2); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: var(--sp-3); background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-md); color: var(--text-primary); outline: none;
  transition: border-color var(--transition), box-shadow var(--transition); min-height: 44px;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light);
}
.form-textarea { min-height: 160px; resize: vertical; font-family: var(--font-mono); font-size: var(--fs-sm); line-height: var(--lh-relaxed); }
.form-select { cursor: pointer; appearance: auto; }
.form-row { display: flex; gap: var(--sp-4); flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 150px; }
.form-hint { font-size: var(--fs-xs); color: var(--text-tertiary); margin-top: var(--sp-1); }

/* Checkbox / Radio */
.form-check { display: flex; align-items: center; gap: var(--sp-2); cursor: pointer; font-size: var(--fs-sm); min-height: 44px; }
.form-check input[type="checkbox"], .form-check input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

/* Range Slider */
.form-range { width: 100%; height: 6px; -webkit-appearance: none; background: var(--border); border-radius: var(--radius-full); outline: none; }
.form-range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; background: var(--accent); border-radius: 50%; cursor: pointer; }

/* --- Output Area --- */
.output-area {
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--sp-4); min-height: 100px; font-family: var(--font-mono); font-size: var(--fs-sm);
  line-height: var(--lh-relaxed); white-space: pre-wrap; word-break: break-word;
  position: relative;
}
.output-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-3); }
.output-label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); }
.copy-btn {
  display: inline-flex; align-items: center; gap: var(--sp-1); padding: var(--sp-1) var(--sp-3);
  font-size: var(--fs-xs); font-weight: 500; border-radius: var(--radius-sm);
  background: var(--accent-light); color: var(--accent); transition: all var(--transition);
}
.copy-btn:hover { background: var(--accent); color: white; }
.copy-btn svg { width: 14px; height: 14px; }

/* --- Stats Row --- */
.stats-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4); text-align: center; flex: 1; min-width: 100px;
}
.stat-value { font-size: var(--fs-2xl); font-weight: 800; color: var(--accent); }
.stat-label { font-size: var(--fs-xs); color: var(--text-secondary); margin-top: var(--sp-1); text-transform: uppercase; letter-spacing: 0.05em; }

/* --- Quick Buttons --- */
.quick-btns { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.quick-btn {
  padding: var(--sp-2) var(--sp-3); background: var(--accent-light); color: var(--accent);
  border-radius: var(--radius-md); font-size: var(--fs-sm); font-weight: 500;
  transition: all var(--transition); min-height: 44px; border: 1px solid transparent;
}
.quick-btn:hover, .quick-btn.active { background: var(--accent); color: white; }

/* --- How To Use Section --- */
.how-to-use { margin-bottom: var(--sp-8); }
.how-to-use h2 { margin-bottom: var(--sp-6); display: flex; align-items: center; gap: var(--sp-2); }
.how-to-use h2 svg { color: var(--accent); width: 28px; height: 28px; }
.steps-list { display: grid; gap: var(--sp-4); margin-bottom: var(--sp-6); }
.step-item {
  display: flex; gap: var(--sp-4); padding: var(--sp-4); background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.step-number {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: white; border-radius: var(--radius-full);
  font-weight: 700; font-size: var(--fs-sm); flex-shrink: 0;
}
.step-text { font-size: var(--fs-sm); color: var(--text-secondary); line-height: var(--lh-relaxed); padding-top: var(--sp-1); }
.features-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-6); }
.feature-item {
  display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-3);
  background: var(--bg-tertiary); border-radius: var(--radius-md);
}
.feature-icon { color: var(--success); flex-shrink: 0; margin-top: 2px; }
.feature-icon svg { width: 18px; height: 18px; }
.feature-text { font-size: var(--fs-sm); color: var(--text-secondary); }
.tips-list { display: grid; gap: var(--sp-2); }
.tip-item {
  display: flex; align-items: flex-start; gap: var(--sp-2); font-size: var(--fs-sm);
  color: var(--text-secondary); padding: var(--sp-2) 0;
}
.tip-icon { color: var(--warning); flex-shrink: 0; margin-top: 2px; }
.tip-icon svg { width: 16px; height: 16px; }

/* --- FAQ Accordion --- */
.faq-section { margin-bottom: var(--sp-8); }
.faq-section h2 { margin-bottom: var(--sp-6); }
.faq-list { display: grid; gap: var(--sp-3); }
.faq-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.faq-question {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-5); font-size: var(--fs-base); font-weight: 600;
  color: var(--text-primary); text-align: left; cursor: pointer; gap: var(--sp-3);
  transition: background var(--transition); min-height: 44px;
}
.faq-question:hover { background: var(--bg-hover); }
.faq-question svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--text-tertiary); transition: transform var(--transition); }
.faq-item.open .faq-question svg { transform: rotate(180deg); }
.faq-answer {
  padding: 0 var(--sp-5); max-height: 0; overflow: hidden; transition: max-height var(--transition-slow), padding var(--transition-slow);
}
.faq-item.open .faq-answer { max-height: 500px; padding: 0 var(--sp-5) var(--sp-4); }
.faq-answer p { font-size: var(--fs-sm); color: var(--text-secondary); line-height: var(--lh-relaxed); }

/* --- Related Tools --- */
.related-tools { margin-bottom: var(--sp-8); }
.related-tools h2 { margin-bottom: var(--sp-6); }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--sp-4); }

/* --- Category Page --- */
.category-page { padding: var(--sp-8) 0 var(--sp-16); }
.category-header { margin-bottom: var(--sp-8); text-align: center; }
.category-header h1 { margin-bottom: var(--sp-3); }
.category-header p { color: var(--text-secondary); font-size: var(--fs-lg); max-width: 65ch; margin: 0 auto; }
.category-icon-large {
  width: 72px; height: 72px; margin: 0 auto var(--sp-4); display: flex; align-items: center; justify-content: center;
  background: var(--accent-light); border-radius: var(--radius-xl); color: var(--accent);
}
.category-icon-large svg { width: 36px; height: 36px; }

/* --- Footer --- */
.footer {
  background: var(--bg-secondary); border-top: 1px solid var(--border);
  padding: var(--sp-12) 0 var(--sp-6);
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-8); margin-bottom: var(--sp-8); }
.footer-section h4 { font-size: var(--fs-sm); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-primary); margin-bottom: var(--sp-4); }
.footer-links { display: flex; flex-direction: column; gap: var(--sp-2); }
.footer-links a { font-size: var(--fs-sm); color: var(--text-secondary); transition: color var(--transition); }
.footer-links a:hover { color: var(--accent); }
.footer-bottom { text-align: center; padding-top: var(--sp-6); border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-tertiary); }

/* --- Toast Notification --- */
.toast {
  position: fixed; bottom: var(--sp-6); right: var(--sp-6); padding: var(--sp-3) var(--sp-5);
  background: var(--accent); color: white; border-radius: var(--radius-md);
  font-size: var(--fs-sm); font-weight: 500; z-index: 1000;
  box-shadow: var(--shadow-lg); transform: translateY(100px); opacity: 0;
  transition: all var(--transition-slow);
}
.toast.show { transform: translateY(0); opacity: 1; }

/* --- Table --- */
.table-wrapper { overflow-x: auto; margin-bottom: var(--sp-4); border-radius: var(--radius-md); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
thead { background: var(--bg-tertiary); }
th, td { padding: var(--sp-3) var(--sp-4); text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text-primary); white-space: nowrap; }
td { color: var(--text-secondary); }
tbody tr:hover { background: var(--bg-hover); }

/* --- Color Preview Box --- */
.color-preview { width: 100%; height: 100px; border-radius: var(--radius-md); border: 1px solid var(--border); margin-bottom: var(--sp-3); }

/* --- Image Drop Zone --- */
.drop-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-lg); padding: var(--sp-10);
  text-align: center; cursor: pointer; transition: all var(--transition);
  color: var(--text-tertiary);
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }
.drop-zone svg { width: 48px; height: 48px; margin: 0 auto var(--sp-3); }

/* --- Progress/Strength Meter --- */
.meter-bar { width: 100%; height: 8px; background: var(--bg-tertiary); border-radius: var(--radius-full); overflow: hidden; }
.meter-fill { height: 100%; border-radius: var(--radius-full); transition: width var(--transition-slow), background var(--transition-slow); }

/* --- Calculator Grid --- */
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); }
.calc-btn {
  min-height: 52px; display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-lg); font-weight: 600; border-radius: var(--radius-md);
  background: var(--bg-tertiary); color: var(--text-primary);
  transition: all var(--transition);
}
.calc-btn:hover { background: var(--bg-hover); }
.calc-btn.operator { background: var(--accent-light); color: var(--accent); }
.calc-btn.operator:hover { background: var(--accent); color: white; }
.calc-btn.equals { background: var(--accent); color: white; grid-column: span 2; }
.calc-btn.equals:hover { background: var(--accent-hover); }
.calc-display {
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--sp-4) var(--sp-5); text-align: right; font-size: var(--fs-3xl); font-weight: 600;
  font-family: var(--font-mono); margin-bottom: var(--sp-4); min-height: 72px;
  display: flex; align-items: center; justify-content: flex-end; word-break: break-all;
  overflow: hidden;
}

/* --- Tab System --- */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 2px solid var(--border); margin-bottom: var(--sp-4); overflow-x: auto; }
.tab-btn {
  padding: var(--sp-3) var(--sp-4); font-size: var(--fs-sm); font-weight: 500;
  color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -2px;
  white-space: nowrap; transition: all var(--transition); min-height: 44px;
}
.tab-btn:hover { color: var(--accent); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* --- Responsive - Mobile First --- */
@media (max-width: 480px) {
  h1 { font-size: var(--fs-2xl); }
  h2 { font-size: var(--fs-xl); }
  .hero { padding: var(--sp-8) var(--sp-4) var(--sp-6); }
  .hero h1 { font-size: var(--fs-3xl); }
  .hero p { font-size: var(--fs-base); }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-interface-split { grid-template-columns: 1fr; }
  .container { padding: 0 var(--sp-3); }
  .tool-interface { padding: var(--sp-4); }
  .features-grid { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .form-row { flex-direction: column; }
  .form-row > * { min-width: 100%; }
  .stats-row { gap: var(--sp-2); }
  .stat-card { min-width: 80px; padding: var(--sp-2) var(--sp-3); }
  .stat-value { font-size: var(--fs-xl); }
}

@media (max-width: 768px) {
  .nav { display: none; position: fixed; top: var(--header-height); left: 0; right: 0; bottom: 0; background: var(--bg-secondary); flex-direction: column; align-items: stretch; padding: var(--sp-4); gap: var(--sp-1); z-index: 99; overflow-y: auto; }
  .nav.open { display: flex; }
  .nav a { padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-md); font-size: var(--fs-base); }
  .nav a:hover { background: var(--bg-hover); }
  .nav a::after { display: none; }
  .nav-toggle { display: flex; }
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .tool-interface-split { grid-template-columns: 1fr; }
  .category-filters { gap: var(--sp-1); }
  .cat-filter-btn { font-size: var(--fs-xs); padding: var(--sp-1) var(--sp-3); }
}

@media (min-width: 1024px) {
  .tool-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1440px) {
  .tool-grid { grid-template-columns: repeat(4, 1fr); }
  .container { padding: 0 var(--sp-6); }
}

/* --- Utilities --- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.text-center { text-align: center; }
.text-accent { color: var(--accent); }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.mb-8 { margin-bottom: var(--sp-8); }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: var(--sp-2); }
.gap-4 { gap: var(--sp-4); }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* --- Animations --- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.4s ease-out; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.pulse { animation: pulse 2s infinite; }

/* --- Print Styles --- */
@media print {
  .header, .footer, .tool-actions, .nav-toggle, .theme-toggle, .toast { display: none !important; }
  body { background: white; color: black; }
}
