/* DigiMed Global – Certificate Verification
   Colours match the main site ("Pulse of Research" theme). */
@import url("/assets/css/fonts.css");
:root {
  --brand: #031830;          /* DigiMed navy */
  --brand-2: #c3141f;        /* ECG red */
  --brand-2-soft: #fdecee;
  --gold: #b88a2e;
  --ink: #14202e;
  --muted: #5b6878;
  --line: #dfe5ec;
  --bg: #f4f6f9;
  --card: #ffffff;
  --ok: #157f4b;   --ok-soft: #e7f5ee;
  --warn: #a15c07; --warn-soft: #fdf3e2;
  --bad: #b42318;  --bad-soft: #fdecea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,32,52,.06), 0 8px 24px rgba(16,32,52,.06);
  --sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-2); }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- header / footer ---------- */
.topbar {
  background: var(--brand);
  color: #fff;
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .06em; font-size: 15px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--brand-2); color: #fff; }
.brand-logo { height: 40px; width: auto; display: block; }
.topbar nav { display: flex; gap: 18px; align-items: center; font-size: 14px; }
.topbar nav a { color: rgba(255,255,255,.82); text-decoration: none; }
.topbar nav a:hover { color: #fff; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 760px; }

.site-foot { color: var(--muted); font-size: 13px; text-align: center; padding: 32px 16px 40px; }
.site-foot a { color: var(--muted); }

/* ---------- verify hero ---------- */
.hero {
  background:
    radial-gradient(1200px 300px at 50% -40px, rgba(11,99,180,.45), transparent 70%),
    linear-gradient(rgba(120,170,230,.10) 1px, transparent 1px) -1px -1px / 40px 40px,
    linear-gradient(90deg, rgba(120,170,230,.10) 1px, transparent 1px) -1px -1px / 40px 40px,
    var(--brand);
  color: #fff;
  padding: 44px 0 88px;
  text-align: center;
}
.hero .eyebrow { display: inline-block; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #ffb3b8; margin-bottom: 10px; font-weight: 600; }
.hero h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(28px, 5vw, 42px); line-height: 1.15; margin: 0 0 10px; }
.hero p { margin: 0 auto; max-width: 540px; color: rgba(255,255,255,.78); }

.search-card {
  margin: -56px auto 0;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  position: relative;
}
.search-card label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.search-row { display: flex; gap: 10px; }
.search-row input {
  flex: 1; min-width: 0;
  font-family: var(--mono); font-size: 18px; letter-spacing: .06em; text-transform: uppercase;
  padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 10px; background: #fbfcfd;
}
.search-row input::placeholder { color: #a7b1bd; letter-spacing: .04em; }
.search-row input:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 4px rgba(11,99,180,.14); background: #fff; }
.hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 10px; border: 1.5px solid transparent;
  background: var(--brand-2); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none;
  white-space: nowrap; vertical-align: middle; transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: #a50f19; }
.btn:focus-visible { outline: 3px solid rgba(77,156,240,.6); outline-offset: 2px; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--brand-2); color: var(--brand-2); }
.btn.dark { background: var(--brand); }
.btn.dark:hover { background: #071d34; }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 8px; min-height: 36px; line-height: 1.2; }
.btn.danger { background: transparent; color: var(--bad); border-color: #f2c4bf; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.block { width: 100%; }
.btn svg { flex: none; }

/* ---------- result states ---------- */
.result { margin: 22px 0 0; }

.cert {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  border-top: 5px solid var(--ok);
}
.cert-head { display: flex; align-items: center; gap: 12px; padding: 18px 24px; background: var(--ok-soft); color: var(--ok); font-weight: 700; }
.cert-head .seal { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--ok); color: #fff; flex: none; }
.cert-head small { display: block; font-weight: 500; color: #2c6b4b; font-size: 13px; }
.cert-body { padding: 28px 24px 8px; text-align: center; border-bottom: 1px dashed var(--line); }
.cert-body .label { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.cert-body .name { font-family: var(--serif); font-size: clamp(26px, 4.6vw, 36px); font-weight: 600; margin: 6px 0 4px; color: var(--brand); }
.cert-body .course { font-family: var(--serif); font-size: clamp(18px, 3vw, 22px); margin: 4px 0 20px; }
.cert-body .rule { width: 64px; height: 2px; background: var(--gold); margin: 0 auto 18px; border: 0; }
.cert-id { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 0 0 22px; padding: 8px 14px; border-radius: 9px; background: #f4f6f9; font-size: 13px; color: var(--muted); }
.cert-id b { font-family: var(--mono); font-size: 16px; letter-spacing: .05em; color: var(--brand); white-space: nowrap; }
.cert-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; }
.cert-grid div { padding: 16px 24px; border-right: 1px solid var(--line); }
.cert-grid div:last-child { border-right: 0; }
.cert-grid dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.cert-grid dd { margin: 4px 0 0; font-weight: 600; }
.cert-grid .mono { font-family: var(--mono); letter-spacing: .03em; }
.cert-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 24px; background: #fafbfc; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

.cert.revoked { border-top-color: var(--warn); }
.cert.revoked .cert-head { background: var(--warn-soft); color: var(--warn); }
.cert.revoked .cert-head .seal { background: var(--warn); }
.cert.revoked .cert-head small { color: #85500f; }
.cert.revoked .name, .cert.revoked .course { color: var(--muted); }

.notice { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; display: flex; gap: 14px; border-left: 5px solid var(--bad); }
.notice .icon { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--bad-soft); color: var(--bad); display: grid; place-items: center; }
.notice h2 { margin: 0 0 4px; font-size: 18px; }
.notice p { margin: 0 0 6px; color: var(--muted); }
.notice code { font-family: var(--mono); background: #f2f4f7; padding: 1px 6px; border-radius: 5px; color: var(--ink); }

.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 26px; }
.how div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; font-size: 14px; color: var(--muted); }
.how b { display: block; color: var(--ink); margin-bottom: 2px; }
.how .n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand-2-soft); color: var(--brand-2); font-weight: 700; font-size: 13px; margin-bottom: 8px; }

/* ---------- admin ---------- */
.admin-main { padding: 28px 0 10px; }
.page-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-title h1 { font-size: 24px; margin: 0; }
.page-title p { margin: 0; color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.panel h2 { font-size: 17px; margin: 0 0 4px; }
.panel .sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field label .opt { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 9px; background: #fff;
}
.field textarea { min-height: 70px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(11,99,180,.14); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.issued { text-align: center; }
.issued .empty { color: var(--muted); padding: 30px 10px; }
.issued .empty svg { color: #b6c0cb; margin-bottom: 8px; }
.id-display {
  font-family: var(--mono); font-size: clamp(22px, 3.4vw, 30px); font-weight: 700; letter-spacing: .06em;
  color: var(--brand); background: #eef4fa; border: 1.5px dashed #9cc1e6; border-radius: 12px;
  padding: 14px 10px; margin: 8px 0 6px; user-select: all; word-break: break-all;
}
.issued .who { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.issued .who b { color: var(--ink); }
.qr-box { display: inline-block; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px; margin: 6px 0 12px; }
.qr-box canvas, .qr-box img { display: block; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.link-line { font-size: 12px; color: var(--muted); word-break: break-all; margin-top: 10px; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.flash.success { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--bad-soft); color: var(--bad); }

.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 28px 0 12px; }
.list-head h2 { margin: 0; font-size: 18px; }
.list-head form { display: flex; gap: 8px; flex: 1; max-width: 420px; }
.list-head input { flex: 1; min-width: 0; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; }

.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #fafbfc; font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.mono { font-family: var(--mono); font-weight: 600; white-space: nowrap; }
td .muted { color: var(--muted); font-size: 12px; }
td.actions { white-space: nowrap; text-align: right; }
td.actions form { display: inline; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.pill.valid { background: var(--ok-soft); color: var(--ok); }
.pill.revoked { background: var(--warn-soft); color: var(--warn); }
.empty-row { text-align: center; color: var(--muted); padding: 36px; }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }

.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; font-size: 13px; color: var(--muted); }
.stat b { color: var(--ink); font-size: 16px; margin-right: 4px; }

/* login / install */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(900px 400px at 50% -100px, rgba(11,99,180,.45), transparent 70%), var(--brand); }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border-radius: var(--radius); padding: 28px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-card .brand { color: var(--brand); margin-bottom: 18px; }
.auth-card h1 { font-size: 20px; margin: 0 0 4px; }
.auth-card p.sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--brand); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .search-row { flex-direction: column; }
  .row-2 { grid-template-columns: 1fr; }
  .cert-grid div { border-right: 0; padding-top: 10px; padding-bottom: 10px; }
  .topbar nav .hide-sm { display: none; }
  .cert-head, .cert-body, .cert-grid div, .cert-foot { padding-left: 18px; padding-right: 18px; }
}

@media print {
  .topbar, .hero, .search-card, .how, .site-foot, .cert-foot .btn { display: none !important; }
  body { background: #fff; }
  .cert { box-shadow: none; border: 1px solid #ccc; }
  .result { margin-top: 0; }
}
