/* ==========================================================================
   BP Tools — bimalapokhrel.com.np
   Mobile-first responsive stylesheet with dark mode
   ========================================================================== */

:root {
  --bg: #f7f8fc;
  --bg-card: #ffffff;
  --bg-soft: #eef1f8;
  --text: #1c2333;
  --text-soft: #5b6478;
  --border: #e3e7f0;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef0ff;
  --accent: #0ea5a6;
  --accent-soft: #e6f7f7;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --warn: #b45309;
  --warn-soft: #fef3e2;
  --ok: #15803d;
  --ok-soft: #e8f7ee;
  --shadow: 0 1px 3px rgba(23, 32, 60, .06), 0 8px 24px rgba(23, 32, 60, .07);
  --shadow-sm: 0 1px 2px rgba(23, 32, 60, .07);
  --radius: 14px;
  --radius-sm: 9px;
  --header-h: 62px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0f1420;
  --bg-card: #171e2e;
  --bg-soft: #1d2537;
  --text: #e6eaf3;
  --text-soft: #9aa4ba;
  --border: #2a3348;
  --primary: #7c74ff;
  --primary-dark: #948dff;
  --primary-soft: #232048;
  --accent: #2dd4bf;
  --accent-soft: #10312f;
  --danger: #f87171;
  --danger-soft: #3a1d1d;
  --warn: #fbbf24;
  --warn-soft: #382a12;
  --ok: #4ade80;
  --ok-soft: #143024;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -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);
  transition: background .25s, color .25s;
}
img, svg, canvas { max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; color: var(--text); margin: 0 0 .5em; }
h1 { font-size: 1.75rem; letter-spacing: -.02em; }
h2 { font-size: 1.35rem; margin-top: 1.6em; }
h3 { font-size: 1.12rem; margin-top: 1.4em; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--primary); color: #fff; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 18px; }
.container-narrow { max-width: 820px; }

/* --------------------------------------------------------------------------
   Header / navigation
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg-card) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-wrap { display: flex; align-items: center; gap: 10px; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.14rem; color: var(--text); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; flex: 0 0 34px; }
.brand small { font-weight: 600; color: var(--text-soft); font-size: .68rem; display: block; line-height: 1; margin-top: 2px; letter-spacing: .04em; }
.main-nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.main-nav a {
  color: var(--text-soft); font-weight: 600; font-size: .93rem;
  padding: 8px 12px; border-radius: 8px; text-decoration: none;
}
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }
.theme-toggle, .nav-burger {
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1rem;
}
.theme-toggle:hover, .nav-burger:hover { border-color: var(--primary); color: var(--primary); }
.nav-burger { display: none; }
@media (max-width: 760px) {
  .nav-burger { display: inline-flex; }
  .main-nav {
    display: none; position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg-card); border-bottom: 1px solid var(--border);
    padding: 8px 14px 14px; box-shadow: var(--shadow);
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 12px 10px; font-size: 1rem; }
}

/* --------------------------------------------------------------------------
   Hero + search
   -------------------------------------------------------------------------- */
.hero { text-align: center; padding: 46px 0 30px; }
.hero h1 { font-size: clamp(1.8rem, 4.6vw, 2.7rem); margin-bottom: .35em; }
.hero h1 .grad { background: linear-gradient(90deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { max-width: 640px; margin: 0 auto 1.2em; color: var(--text-soft); font-size: 1.06rem; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.badge {
  font-size: .8rem; font-weight: 600; color: var(--text-soft);
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 5px 12px; border-radius: 999px;
}
.tool-search { max-width: 560px; margin: 20px auto 0; position: relative; }
.tool-search input {
  width: 100%; padding: 14px 18px 14px 46px; font-size: 1rem;
  border: 2px solid var(--border); border-radius: 999px;
  background: var(--bg-card); color: var(--text); box-shadow: var(--shadow-sm);
}
.tool-search input:focus { border-color: var(--primary); outline: none; }
.tool-search .search-ico { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); color: var(--text-soft); pointer-events: none; }

/* --------------------------------------------------------------------------
   Tool cards grid
   -------------------------------------------------------------------------- */
.section-title { display: flex; align-items: center; gap: 10px; margin: 34px 0 16px; }
.section-title h2 { margin: 0; font-size: 1.3rem; }
.section-title .count { font-size: .8rem; color: var(--text-soft); background: var(--bg-soft); padding: 2px 10px; border-radius: 999px; font-weight: 600; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 14px; }
.tool-card {
  display: flex; gap: 13px; align-items: flex-start;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; text-decoration: none; color: var(--text);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--primary); text-decoration: none; }
.tool-card .t-ico {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
}
.tool-card .t-ico svg { width: 22px; height: 22px; }
.tool-card h3 { margin: 0 0 3px; font-size: .99rem; }
.tool-card p { margin: 0; font-size: .82rem; color: var(--text-soft); line-height: 1.45; }
.ico-text { background: var(--primary-soft); color: var(--primary); }
.ico-pdf { background: var(--danger-soft); color: var(--danger); }
.ico-img { background: var(--ok-soft); color: var(--ok); }
.ico-gen { background: var(--accent-soft); color: var(--accent); }
.ico-calc { background: var(--warn-soft); color: var(--warn); }

/* --------------------------------------------------------------------------
   Tool page layout
   -------------------------------------------------------------------------- */
.breadcrumbs { font-size: .84rem; color: var(--text-soft); margin: 18px 0 6px; }
.breadcrumbs a { color: var(--text-soft); }
.breadcrumbs a:hover { color: var(--primary); }
.tool-head { margin: 4px 0 18px; }
.tool-head h1 { margin-bottom: .25em; }
.tool-head .lead { color: var(--text-soft); max-width: 760px; margin: 0; font-size: 1.02rem; }
.tool-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 22px; margin-bottom: 26px;
}
@media (max-width: 560px) { .tool-panel { padding: 16px 14px; } }

/* Inputs */
textarea, input[type="text"], input[type="number"], input[type="password"], input[type="date"], input[type="url"], input[type="email"], select {
  width: 100%; padding: 11px 13px; font-size: .97rem; font-family: inherit;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text);
}
textarea { min-height: 220px; resize: vertical; line-height: 1.6; }
textarea:focus, input:focus, select:focus { border-color: var(--primary); outline: none; }
label { font-weight: 600; font-size: .9rem; display: block; margin: 0 0 6px; }
.field { margin-bottom: 14px; }
.field-row { display: flex; flex-wrap: wrap; gap: 12px; }
.field-row .field { flex: 1 1 180px; margin-bottom: 0; }
.hint { font-size: .8rem; color: var(--text-soft); margin-top: 5px; }
.checkbox-line { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: .92rem; }
.checkbox-line input { width: auto; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--primary); color: #fff; border: none; cursor: pointer;
  font-size: .98rem; font-weight: 700; font-family: inherit;
  padding: 12px 22px; border-radius: var(--radius-sm);
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-secondary { background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-sm { padding: 7px 14px; font-size: .86rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; align-items: center; }

/* Dropzone */
.dropzone {
  border: 2.5px dashed var(--border); border-radius: var(--radius);
  background: var(--bg); text-align: center; padding: 42px 18px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .dz-ico { font-size: 2rem; color: var(--primary); margin-bottom: 6px; }
.dropzone strong { display: block; font-size: 1.05rem; }
.dropzone span { color: var(--text-soft); font-size: .87rem; }
.file-list { list-style: none; margin: 14px 0 0; padding: 0; }
.file-list li {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 12px; margin-bottom: 8px; font-size: .9rem;
}
.file-list .f-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.file-list .f-size { color: var(--text-soft); font-size: .8rem; white-space: nowrap; }
.file-list button { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 1.05rem; padding: 2px 6px; }
.file-list .f-move { color: var(--text-soft); font-size: .95rem; }

/* Results / stats */
.result-box { margin-top: 18px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 13px 14px; text-align: center;
}
.stat b { display: block; font-size: 1.45rem; color: var(--primary); line-height: 1.2; }
.stat span { font-size: .78rem; color: var(--text-soft); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.score-wrap { text-align: center; padding: 10px 0; }
.score-ring { width: 150px; height: 150px; margin: 0 auto 10px; position: relative; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .score-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-ring .score-num b { font-size: 2rem; line-height: 1; }
.score-ring .score-num span { font-size: .72rem; color: var(--text-soft); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.notice { border-radius: var(--radius-sm); padding: 12px 15px; font-size: .9rem; margin: 14px 0; border: 1px solid; }
.notice-info { background: var(--primary-soft); border-color: var(--primary); color: var(--text); }
.notice-warn { background: var(--warn-soft); border-color: var(--warn); color: var(--text); }
.notice-ok { background: var(--ok-soft); border-color: var(--ok); color: var(--text); }
.notice-danger { background: var(--danger-soft); border-color: var(--danger); color: var(--text); }
mark.hl-match { background: #ffd7d7; color: #7f1d1d; border-radius: 3px; padding: 0 2px; }
[data-theme="dark"] mark.hl-match { background: #5b2020; color: #ffc9c9; }
mark.hl-ai { background: #ffe9c7; color: #7c3d00; border-radius: 3px; padding: 0 2px; }
[data-theme="dark"] mark.hl-ai { background: #4a3312; color: #ffd899; }
.compare-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .compare-cols { grid-template-columns: 1fr; } }
.doc-view {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px; font-size: .92rem; max-height: 420px; overflow: auto; white-space: pre-wrap; word-wrap: break-word;
}
.progress-wrap { margin: 16px 0 4px; display: none; }
.progress-wrap.active { display: block; }
.progress-bar { height: 9px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.progress-bar i { display: block; height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .2s; }
.progress-label { font-size: .82rem; color: var(--text-soft); margin-top: 6px; }
table.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th, .data-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--text-soft); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }

/* Diff view */
.diff-view ins { background: var(--ok-soft); color: var(--ok); text-decoration: none; }
.diff-view del { background: var(--danger-soft); color: var(--danger); }

/* Page thumbnails (PDF organize) */
.page-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; margin-top: 16px; }
.page-thumb { border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 6px; text-align: center; background: var(--bg); cursor: pointer; position: relative; }
.page-thumb.selected { border-color: var(--danger); }
.page-thumb.selected::after { content: "✕"; position: absolute; top: 4px; right: 7px; color: var(--danger); font-weight: 800; }
.page-thumb canvas { border: 1px solid var(--border); background: #fff; }
.page-thumb .pt-num { font-size: .75rem; color: var(--text-soft); font-weight: 600; margin-top: 4px; }

/* --------------------------------------------------------------------------
   Article / content areas
   -------------------------------------------------------------------------- */
.tool-article { max-width: 820px; margin: 8px 0 30px; }
.tool-article h2 { font-size: 1.28rem; }
.tool-article ul, .tool-article ol { padding-left: 22px; }
.tool-article li { margin-bottom: .45em; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; background: var(--bg-card); }
.faq-item summary { cursor: pointer; font-weight: 700; padding: 13px 16px; font-size: .96rem; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.faq-item summary::after { content: "+"; font-size: 1.25rem; color: var(--primary); font-weight: 600; }
.faq-item[open] summary::after { content: "–"; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item .faq-a { padding: 0 16px 14px; color: var(--text-soft); font-size: .93rem; }
.related-tools { margin: 30px 0 10px; }
.related-tools h2 { font-size: 1.15rem; margin-bottom: 12px; }

/* Blog */
.post-list { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.post-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.post-card h2, .post-card h3 { margin: 0 0 8px; font-size: 1.08rem; }
.post-card .post-meta { font-size: .8rem; color: var(--text-soft); margin-bottom: 8px; }
.post-card p { font-size: .9rem; color: var(--text-soft); margin: 0; }
.post-body { max-width: 780px; }
.post-body img { border-radius: var(--radius); }
.post-body h2 { font-size: 1.3rem; }

/* Ad slots (populate after AdSense approval) */
.ad-slot {
  margin: 22px auto; text-align: center; min-height: 0; overflow: hidden;
}
.ad-slot:empty { display: none; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-card); margin-top: 50px; padding: 36px 0 26px; }
.footer-grid { display: grid; gap: 26px; grid-template-columns: 1.3fr 1fr 1fr 1fr; }
@media (max-width: 820px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h4 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-soft); margin: 0 0 10px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 7px; }
.site-footer a { color: var(--text); font-size: .9rem; }
.site-footer a:hover { color: var(--primary); }
.footer-about p { color: var(--text-soft); font-size: .88rem; margin-top: 10px; }
.footer-bottom { border-top: 1px solid var(--border); margin-top: 26px; padding-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; font-size: .83rem; color: var(--text-soft); }

/* Toast */
.bp-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 11px 20px; border-radius: 999px;
  font-size: .9rem; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; z-index: 200; max-width: 90vw; text-align: center;
}
.bp-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Utility */
.text-center { text-align: center; }
.muted { color: var(--text-soft); }
.mt-0 { margin-top: 0; }
.hidden { display: none !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

@media print {
  .site-header, .site-footer, .tool-panel, .breadcrumbs, .related-tools, .ad-slot { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
