/* ============================================================
   Free Tools Convert — Design System
   ============================================================ */
:root {
  --brand: #5b5bf7;
  --brand-dark: #4338ca;
  --brand-grad: linear-gradient(135deg, #5b5bf7 0%, #8b5cf6 55%, #d946ef 100%);
  --ink: #111827;
  --ink-soft: #4b5563;
  --ink-faint: #9ca3af;
  --bg: #f6f7fb;
  --card: #ffffff;
  --line: #e5e7eb;
  --ok: #10b981;
  --warn: #f59e0b;
  --err: #ef4444;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(17, 24, 39, .06), 0 8px 24px rgba(17, 24, 39, .07);
  --shadow-lg: 0 4px 6px rgba(17, 24, 39, .05), 0 16px 40px rgba(17, 24, 39, .14);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: Consolas, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
.container { max-width: 1140px; margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .container {
  display: flex; align-items: center; gap: 24px; height: 64px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.15rem; color: var(--ink);
  white-space: nowrap;
}
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--brand-grad);
  display: grid; place-items: center;
  color: #fff; font-size: 1.05rem;
}
.logo span b { color: var(--brand); }
.main-nav { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.main-nav a {
  color: var(--ink-soft); font-weight: 600; font-size: .93rem;
  padding: 8px 12px; border-radius: 8px;
}
.main-nav a:hover { background: #eef0ff; color: var(--brand-dark); text-decoration: none; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 8px; font-size: 1.3rem; padding: 2px 10px; cursor: pointer; }

/* ---------- Hero ---------- */
.hero {
  background: var(--brand-grad);
  color: #fff;
  padding: 64px 0 84px;
  text-align: center;
}
.hero h1 { font-size: clamp(1.8rem, 4.5vw, 3rem); font-weight: 800; margin-bottom: .35em; }
.hero p { font-size: clamp(1rem, 2vw, 1.2rem); opacity: .92; max-width: 640px; margin: 0 auto 28px; }
.hero-search {
  max-width: 560px; margin: 0 auto; position: relative;
}
.hero-search input {
  width: 100%; padding: 16px 22px; font-size: 1.05rem;
  border: none; border-radius: 999px; outline: none;
  box-shadow: var(--shadow-lg);
}
.hero-stats { display: flex; gap: 32px; justify-content: center; margin-top: 34px; flex-wrap: wrap; }
.hero-stats div { font-size: .9rem; opacity: .9; }
.hero-stats b { display: block; font-size: 1.4rem; }

/* ---------- Category chips ---------- */
.chips { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: -26px auto 8px; position: relative; }
.chip {
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 18px; font-weight: 600; font-size: .9rem; cursor: pointer;
  color: var(--ink-soft); box-shadow: var(--shadow); transition: .15s;
}
.chip:hover, .chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- Tool grid ---------- */
.section { padding: 40px 0; }
.section-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 4px; }
.section-sub { color: var(--ink-soft); margin: 0 0 24px; }
.tool-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.tool-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
  display: flex; flex-direction: column; gap: 8px;
  color: var(--ink); transition: transform .15s, box-shadow .15s;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); text-decoration: none; border-color: #c7c9f8; }
.tool-card .icon {
  width: 46px; height: 46px; border-radius: 12px; font-size: 1.4rem;
  display: grid; place-items: center; background: #eef0ff;
}
.tool-card h3 { font-size: 1.02rem; margin: 4px 0 0; }
.tool-card p { margin: 0; font-size: .87rem; color: var(--ink-soft); }
.tool-card .go { margin-top: auto; font-size: .85rem; font-weight: 700; color: var(--brand); }

/* ---------- Ad slots ---------- */
.ad-slot {
  margin: 26px auto; text-align: center;
  border: 2px dashed #d3d6e4; border-radius: 10px;
  color: var(--ink-faint); font-size: .8rem;
  padding: 8px; min-height: 90px;
  display: flex; align-items: center; justify-content: center;
  background: #fbfbfe;
}
.ad-slot ins { display: block; width: 100%; }

/* ---------- Tool page ---------- */
.breadcrumb { font-size: .85rem; color: var(--ink-faint); margin: 18px 0 6px; }
.breadcrumb a { color: var(--ink-soft); }
.tool-head { margin: 6px 0 22px; }
.tool-head h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.tool-head p { color: var(--ink-soft); max-width: 720px; margin: 0; }
.tool-panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px; margin-bottom: 28px;
}
.tool-layout { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }
.tool-side .ad-slot { min-height: 250px; margin: 0 0 20px; }

/* Dropzone */
.dropzone {
  border: 2px dashed #c7c9f8; border-radius: var(--radius);
  background: #f8f8ff; padding: 44px 20px; text-align: center;
  cursor: pointer; transition: .15s;
}
.dropzone:hover, .dropzone.drag { background: #eef0ff; border-color: var(--brand); }
.dropzone .dz-icon { font-size: 2.2rem; }
.dropzone p { margin: 8px 0 0; color: var(--ink-soft); font-size: .92rem; }
.dropzone b { color: var(--brand); }
.dropzone input { display: none; }

/* Controls */
.controls { display: flex; gap: 14px; flex-wrap: wrap; align-items: end; margin: 18px 0; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 130px; }
.field label { font-size: .8rem; font-weight: 700; color: var(--ink-soft); }
select, input[type=text], input[type=number], input[type=url], input[type=datetime-local], textarea {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; color: var(--ink); outline: none;
}
select:focus, input:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91,91,247,.15); }
textarea { width: 100%; min-height: 170px; font-family: var(--mono); font-size: .88rem; resize: vertical; }
input[type=range] { accent-color: var(--brand); }
.btn {
  font: inherit; font-weight: 700; cursor: pointer;
  background: var(--brand); color: #fff; border: none;
  padding: 12px 24px; border-radius: 10px; transition: .15s;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: #eef0ff; color: var(--brand-dark); }
.btn.secondary:hover { background: #e0e3ff; }
.btn.small { padding: 8px 14px; font-size: .85rem; }

/* Results */
.file-list { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 10px; }
.file-item {
  display: flex; align-items: center; gap: 14px;
  background: #f8f9fc; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; font-size: .9rem;
}
.file-item .thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: #e5e7eb; }
.file-item .meta { flex: 1; min-width: 0; }
.file-item .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .size { color: var(--ink-faint); font-size: .8rem; }
.badge { font-size: .72rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; }
.badge.ok { background: #d1fae5; color: #047857; }
.badge.saving { background: #fef3c7; color: #b45309; }
.result-box {
  background: #f8f9fc; border: 1px solid var(--line); border-radius: 10px;
  padding: 16px; margin-top: 16px; font-size: .92rem;
}
.result-box.hidden, .hidden { display: none; }
.output-area { position: relative; }
.copy-btn { position: absolute; top: 10px; right: 10px; }
.status { margin-top: 12px; font-size: .9rem; font-weight: 600; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }

/* Stats grid (word counter etc.) */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-top: 16px; }
.stat {
  background: #f8f9fc; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; text-align: center;
}
.stat b { display: block; font-size: 1.5rem; color: var(--brand-dark); }
.stat span { font-size: .8rem; color: var(--ink-soft); font-weight: 600; }

/* Two-column text tool */
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .duo { grid-template-columns: 1fr; } }

/* Color preview */
.color-preview { width: 100%; height: 90px; border-radius: 10px; border: 1px solid var(--line); margin-top: 14px; }

/* ---------- How-to / FAQ ---------- */
.howto ol { padding-left: 20px; color: var(--ink-soft); }
.howto li { margin-bottom: 6px; }
.faq details {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 18px; margin-bottom: 10px;
}
.faq summary { font-weight: 700; cursor: pointer; }
.faq p { color: var(--ink-soft); margin: 10px 0 0; }
.related-tools { display: flex; gap: 10px; flex-wrap: wrap; }
.related-tools a {
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; font-size: .88rem; font-weight: 600; color: var(--ink-soft);
}
.related-tools a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }

/* ---------- Feature strip ---------- */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.feature { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.feature .icon { font-size: 1.6rem; }
.feature h3 { font-size: 1rem; margin: 8px 0 4px; }
.feature p { font-size: .88rem; color: var(--ink-soft); margin: 0; }

/* ---------- Footer ---------- */
.site-footer { background: #111827; color: #d1d5db; margin-top: 48px; padding: 44px 0 24px; font-size: .9rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 28px; margin-bottom: 28px; }
.site-footer h4 { color: #fff; font-size: .95rem; margin: 0 0 12px; }
.site-footer a { color: #9ca3af; display: block; padding: 3px 0; }
.site-footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #374151; padding-top: 18px; color: #6b7280; font-size: .82rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ---------- Static pages ---------- */
.prose { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 34px; margin: 24px 0; }
.prose h2 { font-size: 1.25rem; margin-top: 1.4em; }
.prose ul { color: var(--ink-soft); }
.prose p { color: var(--ink-soft); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .tool-layout { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .main-nav {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    background: #fff; border-bottom: 1px solid var(--line);
    flex-direction: column; align-items: stretch; padding: 10px 16px;
  }
  .main-nav.open { display: flex; }
  .nav-toggle { display: block; }
  .hero { padding: 44px 0 70px; }
  .tool-panel { padding: 18px; }
}
