/* ============================================================
   BrentList modern design system — v2 (site-wide theme)
   Layers:
     1. Tokens (CSS variables, light + dark)
     2. Base (reset, body, type, links)
     3. Chrome (.site-header / .site-footer) — shared by every page
     4. Bootstrap bridge — restyles Bootstrap components (base.html pages)
     5. Bespoke components — the redesigned converter, scoped to .bl-modern
   Dark mode: chrome + bespoke use these vars via prefers-color-scheme;
   Bootstrap components use Bootstrap 5.3's own data-bs-theme="dark".
   ============================================================ */

/* ---------- 1. Tokens ---------- */
:root {
  --bg: #ffffff;
  --bg-subtle: #f6f8fa;
  --bg-elevated: #ffffff;
  --text: #1a1d21;
  --text-muted: #5b6470;
  --text-faint: #8a929c;
  --border: rgba(18, 22, 28, 0.10);
  --border-strong: rgba(18, 22, 28, 0.18);
  --brand: #185fa5;
  --brand-strong: #0c447c;
  --brand-contrast: #ffffff;
  --brand-tint: #e6f1fb;
  --brand-tint-text: #0c447c;
  --success: #1d9e75;
  --success-tint: #e1f5ee;
  --danger: #c0392b;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --maxw: 760px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #212529;
    --bg-subtle: #212529;
    --bg-elevated: #2b3035;
    --text: #dee2e6;
    --text-muted: #adb5bd;
    --text-faint: #79828c;
    --border: rgba(255, 255, 255, 0.13);
    --border-strong: rgba(255, 255, 255, 0.22);
    --brand: #4f9be8;
    --brand-strong: #6fb0ee;
    --brand-contrast: #042036;
    --brand-tint: rgba(79, 155, 232, 0.16);
    --brand-tint-text: #9fc8f0;
    --success: #4ec79f;
    --success-tint: rgba(78, 199, 159, 0.15);
    --danger: #e26b5e;
  }
}

/* ---------- 2. Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg-subtle);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- 3. Chrome (shared) ---------- */
.site-header {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1030;
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 60px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 18px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { height: 30px; width: auto; display: block; }
.nav-links { display: flex; align-items: center; gap: 22px; font-size: 14px; }
.nav-links a { color: var(--text-muted); }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links .nav-cta {
  color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 6px 13px;
}
.nav-links .nav-cta:hover { border-color: var(--brand); color: var(--brand); }
@media (max-width: 600px) { .nav-links a:not(.nav-cta) { display: none; } }

.site-footer { border-top: 1px solid var(--border); background: var(--bg-elevated); margin-top: 40px; padding: 32px 0; }
.footer-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 20px; }
.footer-tools a {
  font-size: 13px; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 6px 14px;
}
.footer-tools a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.footer-meta { text-align: center; font-size: 13px; color: var(--text-faint); }
.footer-meta a { color: var(--text-muted); }

/* ---------- 4. Bootstrap bridge ---------- */
/* surfaces */
body.bg-light, .bg-light { background-color: var(--bg-subtle) !important; }
.bg-white { background-color: var(--bg-elevated) !important; }
.card {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.shadow-sm { box-shadow: 0 1px 2px rgba(18,22,28,0.04) !important; }
.shadow, .shadow-lg { box-shadow: 0 2px 10px rgba(18,22,28,0.06) !important; }

/* headings + text helpers */
h1, h2, h3, h4, h5, h6 { font-weight: 600; letter-spacing: -0.01em; }
.lead { color: var(--text-muted); font-weight: 400; }
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--brand) !important; }

/* buttons (brand colors adapt per mode via vars) */
.btn { border-radius: var(--radius); font-weight: 500; }
.btn-primary { background-color: var(--brand); border-color: var(--brand); color: var(--brand-contrast); }
.btn-primary:hover, .btn-primary:focus { background-color: var(--brand-strong); border-color: var(--brand-strong); color: var(--brand-contrast); }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover { background-color: var(--brand); border-color: var(--brand); color: var(--brand-contrast); }
.btn-success { background-color: var(--success); border-color: var(--success); }
.btn-success:hover { background-color: var(--success); border-color: var(--success); filter: brightness(0.94); }
a.btn:hover { text-decoration: none; }

/* forms */
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 0.2rem var(--brand-tint);
}
.form-range { accent-color: var(--brand); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

/* accordion brand accents (Bootstrap handles dark via data-bs-theme) */
.accordion-button:not(.collapsed) { background-color: var(--brand-tint); color: var(--brand-tint-text); box-shadow: none; }
.accordion-button:focus { border-color: var(--brand); box-shadow: 0 0 0 0.2rem var(--brand-tint); }

/* nav pills (home category nav) */
.nav-pills .nav-link { color: var(--text-muted); }
.nav-pills .nav-link.active, .nav-pills .show > .nav-link { background-color: var(--brand); color: var(--brand-contrast); }

/* alerts keep Bootstrap semantics; just round them */
.alert { border-radius: var(--radius); }

/* ---------- Home catalog ---------- */
.home-hero { text-align: center; padding: 28px 0 4px; }
.home-hero h1 { font-size: 34px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 10px; }
.home-sub { font-size: 17px; color: var(--text-muted); max-width: 600px; margin: 0 auto; }
.catalog-search { position: relative; max-width: 520px; margin: 24px auto 0; }
.catalog-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: 19px; }
.catalog-search input {
  width: 100%; height: 50px; padding: 0 16px 0 42px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--bg-elevated); color: var(--text); font-size: 15px; font-family: var(--font);
}
.catalog-search input::placeholder { color: var(--text-faint); }
.catalog-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }

.cat-filter { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 24px 0 32px; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font); font-size: 13.5px; font-weight: 500; color: var(--text-muted);
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 7px 15px; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.cat-chip i { font-size: 16px; }
.cat-chip:hover { border-color: var(--border-strong); color: var(--text); }
.cat-chip.active { background: var(--brand); border-color: var(--brand); color: var(--brand-contrast); }

.cat-section { margin-bottom: 34px; scroll-margin-top: 76px; }
.cat-title { display: flex; align-items: center; gap: 9px; font-size: 18px; font-weight: 600; margin: 0 0 14px; }
.cat-title i { color: var(--brand); font-size: 20px; }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.tool-tile {
  display: flex; flex-direction: column; gap: 5px; padding: 16px;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg);
  text-decoration: none; transition: border-color .15s, transform .06s;
}
.tool-tile:hover { border-color: var(--brand); transform: translateY(-2px); text-decoration: none; }
.tool-tile__icon {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 9px; background: var(--brand-tint); color: var(--brand-tint-text); margin-bottom: 4px;
}
.tool-tile__icon i { font-size: 20px; }
.tool-tile__name { font-size: 15px; font-weight: 600; color: var(--text); }
.tool-tile__desc { font-size: 13px; color: var(--text-muted); line-height: 1.45; }

.no-results { text-align: center; color: var(--text-muted); padding: 30px 0; }

.request-cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px;
  margin-top: 24px; padding: 24px; text-align: center;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.request-cta span { color: var(--text-muted); }

@media (max-width: 560px) {
  .home-hero h1 { font-size: 27px; }
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ---------- Manual ad unit (defined slot, not Auto Ads) ---------- */
.ad-unit {
  max-width: 728px;
  margin: 28px auto;
  padding: 0;
  text-align: center;
  min-height: 100px;
}
.ad-unit__label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.ad-unit ins { display: block; }

/* ---------- 5. Bespoke components (converter) — scoped to .bl-modern ---------- */
.bl-modern { background: var(--bg-subtle); }
.bl-modern .container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

.bl-modern h1, .bl-modern h2, .bl-modern h3 { font-weight: 600; line-height: 1.25; color: var(--text); margin: 0 0 0.5em; }
.bl-modern h1 { font-size: 30px; letter-spacing: -0.02em; }
.bl-modern h2 { font-size: 22px; letter-spacing: -0.01em; }
.bl-modern h3 { font-size: 17px; }
.bl-modern p { margin: 0 0 1em; }

.bl-modern .hero { text-align: center; padding: 44px 0 8px; }
.bl-modern .eyebrow {
  display: inline-block; font-size: 12.5px; font-weight: 500;
  color: var(--brand-tint-text); background: var(--brand-tint);
  border-radius: var(--radius-pill); padding: 5px 14px;
}
.bl-modern .hero h1 { margin: 18px 0 10px; }
.bl-modern .hero .lead { font-size: 17px; color: var(--text-muted); max-width: 540px; margin: 0 auto; }

.bl-modern .tool-card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px; margin: 26px 0 16px;
}
.bl-modern .input-row { display: flex; gap: 10px; margin-bottom: 16px; }
.bl-modern .url-field {
  flex: 1; display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--bg); padding: 0 14px; height: 48px;
  transition: border-color .15s, box-shadow .15s;
}
.bl-modern .url-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.bl-modern .url-field i { font-size: 19px; color: var(--text-faint); }
.bl-modern .url-field input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-family: var(--font); font-size: 15px; color: var(--text); height: 100%;
}
.bl-modern .url-field input::placeholder { color: var(--text-faint); }
.bl-modern .url-field.is-invalid { border-color: var(--danger); }

.bl-modern .btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--brand); color: var(--brand-contrast);
  border: 0; border-radius: var(--radius); cursor: pointer;
  font-family: var(--font); font-size: 15px; font-weight: 600;
  padding: 0 22px; height: 48px; white-space: nowrap;
  transition: background .15s, transform .05s;
}
.bl-modern .btn-primary:hover { background: var(--brand-strong); text-decoration: none; color: var(--brand-contrast); }
.bl-modern .btn-primary:active { transform: scale(0.99); }
.bl-modern .btn-primary:disabled { opacity: 0.6; cursor: default; }
.bl-modern .btn-primary i { font-size: 18px; }

.bl-modern .format-toggle { display: flex; gap: 8px; }
.bl-modern .format-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.bl-modern .format-toggle label {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px; font-size: 13.5px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.bl-modern .format-toggle label i { font-size: 16px; }
.bl-modern .format-toggle label:hover { border-color: var(--border-strong); }
.bl-modern .format-toggle input:checked + label {
  border-color: var(--brand); background: var(--brand-tint); color: var(--brand-tint-text);
}
.bl-modern .format-toggle input:focus-visible + label { box-shadow: 0 0 0 3px var(--brand-tint); }

.bl-modern .options-row { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 16px; }
.bl-modern .opt { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-muted); cursor: pointer; }
.bl-modern .opt input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }

.bl-modern .spinner {
  display: none; width: 22px; height: 22px; margin: 18px auto 0;
  border: 2.5px solid var(--border); border-top-color: var(--brand);
  border-radius: 50%; animation: bl-spin .7s linear infinite;
}
@keyframes bl-spin { to { transform: rotate(360deg); } }
.bl-modern .result {
  display: none; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 16px; padding: 14px 16px;
  background: var(--success-tint); border-radius: var(--radius);
}
.bl-modern .result .ok { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--text); }
.bl-modern .result .ok i { font-size: 20px; color: var(--success); }
.bl-modern .btn-download {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--success); color: #fff; border-radius: var(--radius);
  padding: 9px 16px; font-size: 14px; font-weight: 600;
}
.bl-modern .btn-download:hover { text-decoration: none; color: #fff; filter: brightness(0.95); }
.bl-modern .preview {
  display: none; margin-top: 14px; padding: 14px;
  background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13.5px; color: var(--text-muted); max-height: 200px; overflow-y: auto;
  white-space: pre-wrap; line-height: 1.55;
}

.bl-modern .chips-label { font-size: 12.5px; color: var(--text-faint); margin: 4px 0 9px; }
.bl-modern .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.bl-modern .chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 6px 13px; transition: border-color .15s, color .15s;
}
.bl-modern .chip:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.bl-modern .chip i { font-size: 15px; }

.bl-modern .trust { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 26px 0; }
.bl-modern .trust div { text-align: center; }
.bl-modern .trust i { font-size: 22px; color: var(--brand); }
.bl-modern .trust p { font-size: 13px; color: var(--text-muted); margin: 6px 0 0; line-height: 1.4; }

.bl-modern .section { padding: 30px 0; border-top: 1px solid var(--border); }
.bl-modern .steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 20px 0 4px; }
.bl-modern .step .num { font-size: 12.5px; font-weight: 600; color: var(--brand); }
.bl-modern .step p { font-size: 14px; color: var(--text-muted); margin: 4px 0 0; }

.bl-modern .accordion-item { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.bl-modern .accordion-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--bg-elevated); border: 0; cursor: pointer; text-align: left;
  font-family: var(--font); font-size: 15px; font-weight: 500; color: var(--text);
  padding: 14px 16px;
}
.bl-modern .accordion-btn:hover { background: var(--bg-subtle); }
.bl-modern .accordion-btn .chev { font-size: 18px; color: var(--text-faint); transition: transform .2s; flex-shrink: 0; }
.bl-modern .accordion-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.bl-modern .accordion-panel { display: none; padding: 0 16px 15px; font-size: 14.5px; color: var(--text-muted); line-height: 1.65; }
.bl-modern .accordion-panel.open { display: block; }

.bl-modern .related-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.bl-modern .related-card {
  display: block; text-align: center; padding: 16px 12px;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .15s, transform .05s;
}
.bl-modern .related-card:hover { border-color: var(--brand); text-decoration: none; transform: translateY(-1px); }
.bl-modern .related-card .t { font-weight: 600; font-size: 14px; color: var(--text); }
.bl-modern .related-card .d { font-size: 12.5px; color: var(--text-faint); margin-top: 2px; }
@media (max-width: 560px) { .bl-modern .related-grid { grid-template-columns: repeat(2, 1fr); } }

.bl-modern .ad-slot { margin: 24px 0; min-height: 90px; text-align: center; }

.bl-modern .crumbs { font-size: 13px; color: var(--text-faint); padding: 16px 0 0; }
.bl-modern .crumbs a { color: var(--text-muted); }
.bl-modern .crumbs span { margin: 0 6px; }
.bl-modern .eyebrow i { font-size: 14px; vertical-align: -2px; margin-right: 3px; }

.bl-modern .answer-block {
  background: var(--brand-tint); border-radius: var(--radius-lg);
  padding: 16px 20px; margin: 4px 0 8px;
}
.bl-modern .answer-block p { margin: 0; font-size: 15px; color: var(--brand-tint-text); line-height: 1.6; }

.bl-modern .howto-steps { display: flex; flex-direction: column; gap: 16px; margin-top: 14px; }
.bl-modern .howto-step { display: flex; gap: 14px; align-items: flex-start; }
.bl-modern .howto-num {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand); color: var(--brand-contrast);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
}
.bl-modern .howto-title { font-size: 15px; font-weight: 600; color: var(--text); margin: 2px 0 2px; }
.bl-modern .howto-desc { font-size: 14px; color: var(--text-muted); margin: 0; line-height: 1.55; }

@media (max-width: 560px) {
  .bl-modern h1 { font-size: 25px; }
  .bl-modern .input-row { flex-direction: column; }
  .bl-modern .trust, .bl-modern .steps { grid-template-columns: 1fr; gap: 14px; }
  .bl-modern .format-toggle { flex-wrap: wrap; }
  .bl-modern .format-toggle label { flex-basis: calc(50% - 4px); }
}
