/* ============================================
   DevToolKit — Main Stylesheet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Outfit:wght@300;400;500;600;700&display=swap');

/* ---- CSS Variables ---- */
:root {
  --bg: #f7f6f2;
  --bg2: #eeecea;
  --surface: #ffffff;
  --surface2: #f0ede8;
  --border: #e0dbd4;
  --text: #1a1714;
  --text2: #5a5450;
  --text3: #9a9490;
  --accent: #e8500a;
  --accent2: #ff7a3d;
  --accent-bg: #fff3ee;
  --green: #1a9e6e;
  --green-bg: #edfaf4;
  --red: #d63c3c;
  --red-bg: #fdf0f0;
  --blue: #2563eb;
  --blue-bg: #eff4ff;
  --mono: 'Space Mono', monospace;
  --sans: 'Outfit', sans-serif;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.09);
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg: #111010;
  --bg2: #191716;
  --surface: #1f1e1c;
  --surface2: #282624;
  --border: #333130;
  --text: #f0ede8;
  --text2: #a8a09a;
  --text3: #5a5450;
  --accent: #ff6b2b;
  --accent2: #ff8f5a;
  --accent-bg: #2a1a10;
  --green-bg: #0d2920;
  --red-bg: #2a0f0f;
  --blue-bg: #0f1e3a;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  transition: background var(--transition), color var(--transition);
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent2); }
h1,h2,h3,h4 { font-weight: 700; line-height: 1.25; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
h3 { font-size: 1.1rem; }

/* Ad Placeholders */
.ad-placeholder {
  background: var(--surface2);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--text3);
  font-size: 0.78rem;
  font-family: var(--mono);
  letter-spacing: 0.05em;
}
.ad-header { width: 100%; height: 90px; margin-bottom: 24px; }
.ad-mid { width: 100%; height: 250px; margin: 32px 0; }
.ad-sidebar { width: 100%; height: 600px; position: sticky; top: 90px; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.page-wrap { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }

/* Navbar */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.navbar-inner {
  display: flex; align-items: center;
  height: 62px; gap: 32px;
}
.logo {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--mono); font-size: 1rem; font-weight: 700;
  color: var(--text); white-space: nowrap;
}
.logo img {
  height: 38px;
  max-height: 40px;
  width: auto;
  display: block;
}
.logo-icon {
  display: none;
}
.logo-full {
  display: block;
}
@media (max-width: 600px) {
  .logo-full {
    display: none;
  }
  .logo-icon {
    display: block;
  }
}

.nav-links {
  display: flex; align-items: center; gap: 4px;
  list-style: none; flex: 1;
}
.nav-links a {
  color: var(--text2); font-weight: 500; font-size: 0.9rem;
  padding: 6px 12px; border-radius: 6px; transition: all var(--transition);
}
.nav-links a:hover { background: var(--bg2); color: var(--text); }
.nav-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.dropdown { position: relative; }
.dropdown-toggle { cursor: pointer; display: flex; align-items: center; gap: 4px; }
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); left: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  min-width: 200px; padding: 6px;
  opacity: 0; visibility: hidden;
  transform: translateY(-6px); transition: all var(--transition); z-index: 200;
}
.dropdown:hover .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-menu a {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 6px;
  color: var(--text2); font-size: 0.875rem;
}
.dropdown-menu a:hover { background: var(--bg2); color: var(--text); }

.theme-toggle {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--bg2); border: 1px solid var(--border);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 1rem; transition: all var(--transition); color: var(--text);
}
.theme-toggle:hover { background: var(--border); }

.hamburger { display: none; flex-direction: column; gap: 4px; cursor: pointer; padding: 8px; background: none; border: none; }
.hamburger span { width: 20px; height: 2px; background: var(--text); border-radius: 2px; transition: all var(--transition); }

.mobile-nav { display: none; background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 20px 20px; }
.mobile-nav.open { display: block; }
.mobile-nav a { display: block; padding: 10px 0; color: var(--text2); font-weight: 500; border-bottom: 1px solid var(--border); }
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav .theme-toggle { margin-top: 12px; width: 100%; }

/* Hero */
.hero { padding: 60px 0 40px; text-align: center; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-bg); color: var(--accent);
  border: 1px solid var(--accent); border-radius: 100px;
  padding: 4px 14px; font-size: 0.8rem; font-weight: 600;
  margin-bottom: 20px; font-family: var(--mono);
}
.hero h1 { margin-bottom: 16px; }
.hero h1 span { color: var(--accent); }
.hero p { color: var(--text2); font-size: 1.05rem; max-width: 540px; margin: 0 auto 32px; }

/* Search */
.search-wrap { max-width: 560px; margin: 0 auto; position: relative; }
.search-wrap input {
  width: 100%; padding: 14px 50px 14px 18px;
  border: 2px solid var(--border); border-radius: 50px;
  background: var(--surface); color: var(--text);
  font-family: var(--sans); font-size: 0.95rem; outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-wrap input::placeholder { color: var(--text3); }
.search-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(232,80,10,0.1); }
.search-icon { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 1rem; pointer-events: none; }

/* Category Tabs */
.cat-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 40px 0 24px; }
.cat-tab {
  padding: 7px 16px; border-radius: 50px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text2); font-size: 0.85rem; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
}
.cat-tab:hover { border-color: var(--accent); color: var(--accent); }
.cat-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Tools Grid */
.tools-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px; padding-bottom: 60px;
}
.tool-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  cursor: pointer; transition: all var(--transition);
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: 12px;
}
.tool-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-2px); color: inherit; }
.tool-card-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; background: var(--accent-bg); flex-shrink: 0;
}
.tool-card-icon.green { background: var(--green-bg); }
.tool-card-icon.blue { background: var(--blue-bg); }
.tool-card h3 { font-size: 1rem; margin: 0; }
.tool-card p { color: var(--text2); font-size: 0.85rem; line-height: 1.5; flex: 1; }
.tool-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.tool-badge { font-size: 0.72rem; font-family: var(--mono); padding: 3px 8px; border-radius: 4px; background: var(--bg2); color: var(--text3); }
.tool-arrow { color: var(--accent); font-size: 1rem; transition: transform var(--transition); }
.tool-card:hover .tool-arrow { transform: translateX(4px); }
.no-results { grid-column: 1/-1; text-align: center; padding: 60px 20px; color: var(--text3); }
.no-results .icon { font-size: 3rem; margin-bottom: 12px; }

/* Tool Page */
.tool-page { padding: 32px 0 60px; }
.tool-page-header { margin-bottom: 28px; }
.breadcrumb {
  font-size: 0.8rem; color: var(--text3); margin-bottom: 12px;
  display: flex; align-items: center; gap: 6px; font-family: var(--mono);
}
.breadcrumb a { color: var(--text3); }
.breadcrumb a:hover { color: var(--accent); }
.tool-page-header h1 { margin-bottom: 8px; }
.tool-page-header .subtitle { color: var(--text2); font-size: 1rem; }

.tool-layout {
  display: grid; grid-template-columns: 1fr 300px;
  gap: 28px; align-items: start;
}
@media (max-width: 900px) {
  .tool-layout { grid-template-columns: 1fr; }
  .ad-sidebar { display: none; }
}

/* Tool Box */
.tool-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.tool-box-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface2);
}
.tool-box-title {
  font-size: 0.85rem; font-family: var(--mono); color: var(--text2);
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
}
.tool-box-body { padding: 20px; }

/* Form Controls */
textarea, input[type="text"], input[type="number"], select {
  width: 100%; background: var(--bg);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; font-family: var(--mono);
  font-size: 0.85rem; color: var(--text); outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  resize: vertical;
}
textarea:focus, input[type="text"]:focus, input[type="number"]:focus, select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232,80,10,0.08);
}
textarea { min-height: 180px; line-height: 1.6; }
select { resize: none; cursor: pointer; }

.form-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.form-group { flex: 1; min-width: 140px; }
.form-group label {
  display: block; font-size: 0.8rem; font-weight: 600; color: var(--text2);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 600;
  font-family: var(--sans); cursor: pointer; border: none;
  transition: all var(--transition); white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); transform: translateY(-1px); }
.btn-secondary { background: var(--bg2); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text2); }
.btn-ghost:hover { background: var(--bg2); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-success { background: var(--green); color: #fff; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* Output */
.output-area { margin-top: 20px; position: relative; }
.output-label {
  font-size: 0.8rem; font-weight: 600; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px;
  display: flex; align-items: center; justify-content: space-between;
}
.output-box {
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  font-family: var(--mono); font-size: 0.82rem; color: var(--text);
  min-height: 120px; word-break: break-all; white-space: pre-wrap;
  line-height: 1.7; overflow-x: auto;
}
.output-box.success { border-color: var(--green); background: var(--green-bg); }
.output-box.error { border-color: var(--red); background: var(--red-bg); color: var(--red); }

/* Stats */
.stats-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
.stat-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 12px; font-size: 0.8rem; color: var(--text2);
}
.stat-chip strong { color: var(--text); font-weight: 700; }

/* Options */
.options-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 12px 0; }
.option-check {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; background: var(--bg2);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  cursor: pointer; font-size: 0.85rem; transition: all var(--transition);
}
.option-check:hover { border-color: var(--accent); }
.option-check input { accent-color: var(--accent); }

/* Toast */
#toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--text); color: var(--bg);
  padding: 12px 18px; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500; box-shadow: var(--shadow-md);
  animation: slideIn 0.25s ease, fadeOut 0.3s ease 2.5s forwards;
  pointer-events: auto; max-width: 300px;
}
.toast.success { background: var(--green); color: #fff; }
.toast.error { background: var(--red); color: #fff; }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; transform: translateY(8px); } }

/* SEO Section */
.seo-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px; margin-top: 32px;
}
.seo-section h2 { margin-bottom: 16px; font-size: 1.25rem; }
.seo-section h3 { margin: 20px 0 8px; color: var(--text); font-size: 1rem; }
.seo-section p { color: var(--text2); margin-bottom: 14px; line-height: 1.75; }
.seo-section ul { color: var(--text2); padding-left: 20px; margin-bottom: 14px; }
.seo-section ul li { margin-bottom: 6px; }

/* Related Tools */
.related-section { margin-top: 32px; }
.related-section h2 { margin-bottom: 16px; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.related-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: inherit; transition: all var(--transition);
}
.related-card:hover { border-color: var(--accent); box-shadow: var(--shadow); color: inherit; }
.related-card-icon { font-size: 1.5rem; flex-shrink: 0; }
.related-card-info h4 { font-size: 0.9rem; margin-bottom: 2px; }
.related-card-info p { font-size: 0.78rem; color: var(--text3); }

/* Range Slider */
input[type="range"] {
  -webkit-appearance: none; height: 4px; background: var(--border);
  border-radius: 2px; outline: none; padding: 0; border: none; min-height: unset;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px;
  background: var(--accent); border-radius: 50%; cursor: pointer;
}

/* Diff */
.diff-line { display: block; font-family: var(--mono); font-size: 0.82rem; padding: 2px 8px; border-radius: 4px; line-height: 1.7; }
.diff-add { background: rgba(26,158,110,0.12); color: var(--green); }
.diff-remove { background: rgba(214,60,60,0.12); color: var(--red); }
.diff-eq { color: var(--text2); }

/* Password Strength */
.strength-bar { height: 4px; background: var(--border); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.strength-bar-fill { height: 100%; border-radius: 2px; transition: width 0.3s ease, background 0.3s ease; }
.strength-label { font-size: 0.8rem; margin-top: 6px; font-weight: 600; }

/* Footer */
.footer { background: var(--surface); border-top: 1px solid var(--border); padding: 48px 0 28px; margin-top: auto; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.footer-brand p { color: var(--text2); font-size: 0.875rem; margin: 12px 0 0; max-width: 240px; line-height: 1.6; }
.footer-col h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text3); margin-bottom: 14px; font-family: var(--mono); }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a { color: var(--text2); font-size: 0.875rem; transition: color var(--transition); }
.footer-col ul li a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 24px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.footer-seo { font-size: 0.75rem; color: var(--text3); max-width: 700px; line-height: 1.6; }
.footer-copy { font-size: 0.8rem; color: var(--text3); white-space: nowrap; }

/* Responsive */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .hero { padding: 40px 0 30px; }
  .tools-grid { grid-template-columns: 1fr 1fr; }
  .ad-header { height: 60px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
}
@media (max-width: 500px) {
  .tools-grid { grid-template-columns: 1fr; }
  .btn-group { flex-direction: column; }
  .btn { justify-content: center; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* Animations */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeUp 0.35s ease forwards; }
.fade-up-d1 { animation-delay: 0.05s; opacity: 0; animation-fill-mode: forwards; }
.fade-up-d2 { animation-delay: 0.1s; opacity: 0; animation-fill-mode: forwards; }
.fade-up-d3 { animation-delay: 0.15s; opacity: 0; animation-fill-mode: forwards; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.text-mono { font-family: var(--mono); }
.text-muted { color: var(--text2); }
.hidden { display: none !important; }
.w-full { width: 100%; }
.divider { width: 100%; text-align: center; position: relative; margin: 20px 0; color: var(--text3); font-size: 0.8rem; }
.divider::before { content: ''; position: absolute; left: 0; top: 50%; width: 100%; height: 1px; background: var(--border); }
.divider span { position: relative; background: var(--surface); padding: 0 12px; }
