/* SecAITech Tools — one stylesheet, mobile-first (360px and up). */

@font-face {
  font-family: "Noto Nastaliq Urdu";
  src: url("../fonts/noto-nastaliq-urdu-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #16202c;
  --muted: #5a6878;
  --border: #d8e0ea;
  --brand: #0f4c81;
  --brand-hover: #0b3a63;
  --brand-soft: #e3eef8;
  --accent: #0e8a6a;
  --ok-bg: #e5f5ef;
  --ok-text: #0b6b52;
  --err-bg: #fdecec;
  --err-text: #a12828;
  --warn-bg: #fff6e0;
  --warn-text: #8a5a00;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 2px 8px rgba(16, 32, 48, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-urdu: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Urdu Typesetting", serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f151c;
    --surface: #17202a;
    --surface-2: #1f2a36;
    --text: #e6edf4;
    --muted: #9aa8b7;
    --border: #2c3a48;
    --brand: #5aa7e6;
    --brand-hover: #7bbbf0;
    --brand-soft: #1b3248;
    --accent: #3cc49c;
    --ok-bg: #12352b;
    --ok-text: #7fe0bf;
    --err-bg: #3d1a1a;
    --err-text: #ff9c9c;
    --warn-bg: #3a2e12;
    --warn-text: #f3c76b;
    --shadow: none;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
}
img, canvas, svg { max-width: 100%; height: auto; }
a { color: var(--brand); }
a:hover { color: var(--brand-hover); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* Header / footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px;
  background: #0f4c81; color: #fff; font-size: .95rem;
}
.brand-sub { color: var(--accent); font-weight: 600; }
.site-nav { display: flex; gap: 14px; font-size: .95rem; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--brand); }

.site-footer { margin-top: 48px; background: var(--surface); border-top: 1px solid var(--border); padding: 28px 0; font-size: .92rem; color: var(--muted); }
.footer-inner { display: grid; gap: 16px; }
.footer-inner strong { color: var(--text); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.built-by { margin: 0; }

/* Home */
.home-hero, .tool-hero { padding: 28px 0 8px; }
.lead { font-size: 1.05rem; color: var(--muted); max-width: 640px; }
.search input {
  width: 100%; max-width: 520px; padding: 12px 14px; font: inherit;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}
.category { margin-top: 28px; }
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 860px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.card {
  display: flex; flex-direction: column; gap: 4px; padding: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); text-decoration: none; color: var(--text);
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--brand); transform: translateY(-1px); color: var(--text); }
.card-cat { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); font-weight: 600; }
.card-name { font-weight: 700; font-size: 1.05rem; }
.card-summary { color: var(--muted); font-size: .93rem; }
.empty-search { color: var(--muted); margin-top: 20px; }

/* Tool page */
.crumbs { padding-top: 16px; font-size: .88rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.badge-private {
  display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: .85rem;
  background: var(--ok-bg); color: var(--ok-text); margin: 0;
}
.urdu-intro { margin: 4px 0 14px; }
.urdu, [lang="ur"] .urdu { font-family: var(--font-urdu); line-height: 2.1; }
h2.urdu { font-size: 1.3rem; margin-bottom: .2em; }
.tool-panel {
  margin-top: 18px; padding: 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.tool-panel > * + * { margin-top: 16px; }
.how-to { margin-top: 28px; }
.how-to ol, .how-to ul { padding-left: 1.3em; }
.faq details { border-top: 1px solid var(--border); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 8px 0 0; color: var(--muted); }

/* Dropzone + file list */
.dropzone {
  display: grid; place-items: center; text-align: center; gap: 6px;
  padding: 28px 16px; border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone-title { font-weight: 700; }
.dropzone-hint { font-size: .88rem; color: var(--muted); }

.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.file-list li {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.icon-btn {
  min-width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer;
}
.icon-btn:hover { border-color: var(--brand); }
.icon-btn:disabled { opacity: .4; cursor: default; }

/* Forms + buttons */
.field { display: grid; gap: 6px; }
.field label, .field legend, .label { font-weight: 600; font-size: .95rem; }
.field-hint { font-size: .85rem; color: var(--muted); }
.row { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .row { grid-template-columns: repeat(2, 1fr); } .row-3 { grid-template-columns: repeat(3, 1fr); } }
input[type="text"], input[type="tel"], input[type="number"], select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
textarea { min-height: 140px; resize: vertical; }
input[type="range"] { width: 100%; accent-color: var(--brand); }
fieldset { border: 0; padding: 0; margin: 0; }
.choices { display: grid; gap: 8px; }
.choice {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: var(--surface);
}
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice input { margin-top: 4px; accent-color: var(--brand); }
.choice small { display: block; color: var(--muted); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px; border: 1px solid var(--brand); border-radius: 10px;
  background: var(--brand); color: #fff; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
@media (prefers-color-scheme: dark) { .btn { color: #0f151c; } }
.btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
@media (prefers-color-scheme: dark) { .btn:hover { color: #0f151c; } }
.btn:disabled { opacity: .5; cursor: default; }
.btn-ghost { background: transparent; color: var(--brand); }
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand); }
@media (prefers-color-scheme: dark) { .btn-ghost, .btn-ghost:hover { color: var(--brand); } }
.btn-small { min-height: 36px; padding: 6px 14px; font-size: .92rem; }

/* Status messages */
.status { padding: 10px 14px; border-radius: 10px; font-size: .95rem; }
.status:empty { display: none; }
.status-info { background: var(--brand-soft); color: var(--text); }
.status-ok { background: var(--ok-bg); color: var(--ok-text); }
.status-error { background: var(--err-bg); color: var(--err-text); }
.status-warn { background: var(--warn-bg); color: var(--warn-text); }
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* Results */
.table-wrap { overflow-x: auto; }
table.results { width: 100%; border-collapse: collapse; font-size: .92rem; }
.results th, .results td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.results th { color: var(--muted); font-weight: 600; }
.saved { color: var(--ok-text); font-weight: 600; }
.bigger { color: var(--warn-text); font-weight: 600; }
.output-urdu {
  direction: rtl; font-family: var(--font-urdu); font-size: 1.2rem; line-height: 2.2; min-height: 180px;
}
.result-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface-2); }
.result-card h3 { margin-top: 0; }
.spec-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.spec-list li { display: grid; gap: 2px; }
@media (min-width: 560px) { .spec-list li { grid-template-columns: 110px 1fr; gap: 10px; } }
.result-card ul:not(.spec-list) { padding-left: 1.2em; margin: 0; }
.result-card li + li { margin-top: 6px; }
.spec-list b { color: var(--muted); font-weight: 600; }
.qr-box { display: grid; place-items: center; padding: 16px; background: #fff; border-radius: var(--radius); border: 1px solid var(--border); }
.qr-box canvas { width: 220px; height: 220px; image-rendering: pixelated; }
.link-out { word-break: break-all; font-family: ui-monospace, Consolas, monospace; font-size: .9rem; }

/* CTA, related, prose */
.cta {
  margin-top: 32px; padding: 18px; display: grid; gap: 12px; align-items: center;
  border-radius: var(--radius); background: var(--brand-soft); border: 1px solid var(--border);
}
.cta p { margin: 4px 0 0; color: var(--muted); }
@media (min-width: 700px) { .cta { grid-template-columns: 1fr auto; } }
.related { margin-top: 32px; }
.prose { max-width: 700px; padding-top: 24px; }

/* Ads (only printed when ads are switched on). Fixed height so pages don't jump. */
.ad-slot { margin: 20px 0; min-height: 100px; background: var(--surface-2); border-radius: 8px; }
@media (min-width: 728px) { .ad-slot { min-height: 90px; } }

/* Cookie notice */
.consent {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 20; max-width: 560px; margin: 0 auto;
  padding: 14px; display: grid; gap: 10px; font-size: .9rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
}
.consent p { margin: 0; }
.consent-actions { display: flex; gap: 8px; }

[hidden] { display: none !important; }
