/* ============================================================
   Polimed QR — Lot Doğrulama
   Palet: Polimed lacivert (#0a1628) + mavi (#2b9dd6)
   Display: Space Grotesk · Gövde: Inter · Kod: IBM Plex Mono
   ============================================================ */

:root {
  --navy: #0a1628;
  --navy-2: #0f2040;
  --navy-3: #162c52;

  --blue: #2b9dd6;
  --blue-dark: #1a7aaa;
  --blue-soft: #e8f3fb;
  --blue-mid: #c5def4;

  --paper: #f2f6fb;
  --surface: #ffffff;
  --surface-2: #f0f5fa;
  --line: #d8e6f0;
  --line-2: #eaf1f8;
  --text: #0b1e35;
  --text-soft: #3a5570;
  --muted: #7a97b0;

  --accent: #2b9dd6;
  --accent-dark: #1a7aaa;
  --accent-soft: #e8f3fb;

  --ok: #0d7a4f;
  --ok-soft: #e2f3ea;
  --danger: #b3261e;
  --danger-soft: #fbeae8;
  --warn: #7a5800;
  --warn-soft: #fdf3d8;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --shadow-sm: 0 1px 3px rgba(10, 22, 40, .06);
  --shadow: 0 2px 8px rgba(10, 22, 40, .07), 0 16px 40px -16px rgba(10, 22, 40, .18);
  --shadow-lg: 0 24px 60px -20px rgba(10, 22, 40, .35);

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", var(--sans);
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

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

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--paper);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.icon { width: 1.05em; height: 1.05em; stroke-width: 1.9; vertical-align: -2px; flex: none; }

::selection { background: var(--blue-soft); }

/* ---------- Üst bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 22px;
  color: #fff;
  background: var(--navy);
  border-bottom: 1px solid rgba(43,157,214,.18);
}

/* Polimed logosu — wordmark stili */
.topbar .brand {
  display: flex; align-items: center; gap: 0;
  font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: .04em;
}
.topbar .brand .p1 { color: #fff; }
.topbar .brand .sep { color: var(--blue); margin: 0 3px; font-weight: 400; }
.topbar .brand .p2 { color: var(--blue); }
.topbar .brand .sub {
  display: block; font-size: 9px; font-weight: 400; letter-spacing: .12em;
  color: rgba(255,255,255,.42); text-transform: uppercase; margin-top: -1px; line-height: 1;
}

.topbar .spacer { flex: 1; }
.topbar .tag {
  font-family: var(--mono); font-size: 11px; letter-spacing: .09em;
  color: rgba(255,255,255,.38); text-transform: uppercase;
}
.topbar a { color: rgba(255,255,255,.65); font-size: 13px; }
.topbar a:hover { color: #fff; text-decoration: none; }

/* ---------- Genel kaplar ---------- */
.shell { max-width: 600px; margin: 0 auto; padding: 0 16px 72px; }
.shell-wide { max-width: 1060px; }

.footer-note {
  text-align: center; color: var(--muted); font-size: 12px; line-height: 1.6;
  max-width: 420px; margin: 30px auto 0;
}
.footer-note .mono { font-family: var(--mono); color: var(--text-soft); }

/* ============================================================
   PUBLIC — Doğrulama
   ============================================================ */

/* Hero — Polimed lacivert; sade, kurumsal (parıltı yok, ince mavi taban çizgisi) */
.hero {
  position: relative; overflow: hidden;
  background: var(--navy);
  border-bottom: 2px solid var(--blue);
  color: #fff;
  padding: 34px 22px 64px;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(160deg, var(--navy-2) 0%, var(--navy) 55%);
  pointer-events: none;
}
.hero-inner { position: relative; max-width: 600px; margin: 0 auto; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--blue);
}
.eyebrow .icon { width: 14px; height: 14px; }

.hero h1 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(28px, 8vw, 38px); line-height: 1.06; letter-spacing: -.015em;
  margin: 12px 0 0; color: #fff;
}
.hero .maker {
  font-family: var(--mono); font-size: 12px; letter-spacing: .03em;
  color: rgba(255,255,255,.45); margin-top: 10px;
}
.hero .lede { color: rgba(255,255,255,.65); font-size: 14.5px; margin: 10px 0 0; max-width: 46ch; }

/* Panel — hero'nun altına biner */
.panel {
  position: relative; z-index: 2;
  margin: -38px auto 0; max-width: 600px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.panel + .panel, .panel + .cert { margin-top: 14px; }
/* SPA: sonuç #result-area içinde sarılı olduğu için kardeş seçici tutmaz → ilk çocuğa boşluk ver */
#result-area > .panel, #result-area > .cert { margin-top: 14px; }

.panel .plabel {
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
  color: var(--text-soft); margin-bottom: 9px; display: block;
}

/* Lot kod girişi */
.lot-field { position: relative; }
.lot-field input {
  width: 100%; font-family: var(--mono); font-weight: 600;
  font-size: 20px; letter-spacing: .12em; text-align: center; text-transform: uppercase;
  color: var(--navy); background: var(--surface-2);
  padding: 16px 14px; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); transition: border-color .16s, box-shadow .16s, background .16s;
}
.lot-field input::placeholder { color: #b5c9db; letter-spacing: .08em; }
.lot-field input:focus {
  outline: none; background: #fff;
  border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft);
}
.hint { font-size: 12.5px; color: var(--muted); margin: 9px 2px 0; }

/* ---------- Butonlar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--sans); font-size: 15px; font-weight: 600; cursor: pointer;
  padding: 13px 20px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--blue); color: #fff; text-decoration: none;
  transition: transform .12s ease, background .16s, box-shadow .16s;
}
.btn:hover { background: var(--blue-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--blue-mid); outline-offset: 2px; }
.btn.block { width: 100%; }
.btn.lg { padding: 15px 22px; font-size: 16px; }
.btn.sm { padding: 8px 13px; font-size: 13px; gap: 6px; }
.btn.primary { background: var(--navy); }
.btn.primary:hover { background: var(--navy-2); }
.btn.ghost { background: #fff; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: #fff; color: var(--danger); border-color: #efcbc7; }
.btn.danger:hover { background: var(--danger-soft); }
.btn-row { display: flex; flex-wrap: wrap; gap: 9px; }
.mt { margin-top: 16px; }

/* ---------- Doğrulanan lot: sertifika belgesi ---------- */
.cert {
  position: relative; max-width: 600px; margin: 14px auto 0;
  background: var(--surface);
  border: 1px solid var(--blue-mid);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise .5s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* doğrulama şeridi — sade, düz zemin */
.cert-seal {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 22px;
  background: var(--blue-soft);
  border-bottom: 1px solid var(--blue-mid);
}
.stamp {
  width: 46px; height: 46px; flex: none; border-radius: 50%;
  background: var(--ok); color: #fff; display: grid; place-items: center;
}
.stamp .icon { width: 23px; height: 23px; stroke-width: 2.6; }
.cert-seal .label { line-height: 1.25; }
.cert-seal .k {
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--blue-dark); font-weight: 600;
}
.cert-seal .v { font-family: var(--display); font-weight: 700; font-size: 19px; color: var(--navy); }

.cert-body { padding: 20px 22px 22px; }

.data { display: grid; grid-template-columns: auto 1fr; gap: 11px 18px; margin: 2px 0 4px; }
.data dt { font-size: 12px; letter-spacing: .03em; color: var(--muted); text-transform: uppercase; align-self: center; }
.data dd { margin: 0; font-family: var(--mono); font-weight: 600; font-size: 15px; color: var(--text); }

.section-h {
  display: flex; align-items: baseline; gap: 9px;
  font-family: var(--display); font-weight: 600; font-size: 16px; letter-spacing: -.01em;
  margin: 20px 0 12px;
}
.section-h .count { font-family: var(--mono); font-size: 12px; color: var(--muted); font-weight: 500; }
.rule { height: 1px; background: var(--line-2); border: 0; margin: 18px 0; }

/* belge satırı */
.doc {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
.doc + .doc { margin-top: 9px; }
.doc:hover { border-color: var(--blue-mid); box-shadow: var(--shadow-sm); }
.doc .dot {
  width: 40px; height: 40px; flex: none; border-radius: 9px;
  background: var(--blue-soft); color: var(--blue);
  display: grid; place-items: center;
}
.doc .meta { flex: 1; min-width: 0; }
.doc .meta .t { font-weight: 600; font-size: 14.5px; }
.doc .meta .s { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.doc .acts { display: flex; gap: 6px; flex: none; }

/* ---------- Uyarılar ---------- */
.note {
  display: flex; gap: 11px; align-items: flex-start;
  border-radius: var(--radius-sm); padding: 14px 15px; font-size: 14px;
}
.note .icon { margin-top: 1px; }
.note.err { background: var(--danger-soft); color: var(--danger); }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.ok { background: var(--ok-soft); color: var(--ok); }
.note.info { background: var(--blue-soft); color: var(--accent-dark); }
.note strong { font-weight: 600; }

/* ============================================================
   ADMIN — aynı dil, sade
   ============================================================ */
.adminbar { background: var(--navy); border-bottom: 1px solid rgba(43,157,214,.18); }
.adminbar .brand .p1 { color: #fff; }
.adminbar .spacer { flex: 1; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px;
}
.card + .card { margin-top: 16px; }

h1.page { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -.01em; margin: 0; }
h2.block { font-family: var(--display); font-weight: 600; font-size: 16px; margin: 0 0 4px; }
.sub { color: var(--text-soft); margin: 0; }
.sub.sm { font-size: 13px; }
.muted { color: var(--muted); }

.toprow { display: flex; align-items: center; gap: 12px; margin: 24px 0 18px; flex-wrap: wrap; }
.toprow .spacer { flex: 1; }
.back { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13px; margin-top: 20px; }
.back:hover { color: var(--text-soft); text-decoration: none; }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=file], textarea, select {
  width: 100%; font: inherit; color: var(--text);
  padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-xs);
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft);
}
textarea { min-height: 84px; resize: vertical; }
.field .hint { margin-top: 5px; }
.field code, code.inline { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-soft); }
.check input { width: auto; }
.row-form { display: flex; gap: 10px; flex-wrap: wrap; }
.row-form .field { flex: 1; min-width: 140px; }

.badge { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .04em; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-soft); text-transform: uppercase; }
.badge.on { background: var(--ok-soft); color: var(--ok); }
.badge.off { background: #eef0ee; color: var(--muted); }

.list-item {
  display: flex; align-items: center; gap: 13px;
  padding: 15px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.list-item + .list-item { margin-top: 10px; }
.list-item:hover { border-color: var(--blue-mid); box-shadow: var(--shadow-sm); text-decoration: none; }
.list-item .ico { width: 40px; height: 40px; flex: none; border-radius: 10px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t { font-weight: 600; color: var(--text); }
.list-item .s { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 1px; }

.empty { text-align: center; color: var(--muted); padding: 30px 12px; }

.alert { border-radius: var(--radius-sm); padding: 13px 15px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.err { background: var(--danger-soft); color: var(--danger); }

.grid2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 780px) { .grid2 { grid-template-columns: 1.45fr 1fr; align-items: start; } }

/* QR kutusu */
.qrbox { text-align: center; }
.qrbox .qrframe {
  display: inline-block; margin: 14px 0; padding: 14px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.qrbox img { display: block; width: 200px; height: 200px; }
.urlpill {
  display: block; word-break: break-all; font-family: var(--mono); font-size: 12.5px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-xs);
  padding: 10px 12px; margin: 8px 0 14px; color: var(--text-soft);
}

.divider { height: 1px; background: var(--line-2); border: 0; margin: 20px 0; }

/* ---------- Kare kutu ızgarası (tile) ---------- */
.tilegrid {
  display: grid; gap: 14px; margin-top: 6px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.tile {
  position: relative; display: flex; flex-direction: column; gap: 5px;
  aspect-ratio: 1 / 1; padding: 18px; font: inherit; text-align: left; color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.tile:hover { border-color: var(--blue-mid); box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }
.tile:active { transform: translateY(0); }
.tile:focus-visible { outline: 3px solid var(--blue-soft); outline-offset: 2px; }
.tile .tile-ico { width: 46px; height: 46px; border-radius: 13px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; }
.tile .tile-ico .icon { width: 25px; height: 25px; }
.tile .tile-title { font-family: var(--mono); font-weight: 600; font-size: 16px; margin-top: auto; word-break: break-word; }
.tile .tile-sub { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.tile .tile-desc { font-size: 11.5px; line-height: 1.35; color: var(--muted); margin-top: 4px; }
.tile .badge { position: absolute; top: 14px; right: 14px; }

/* ekle / aksiyon kutuları */
.tile-add, .tile-action {
  align-items: center; justify-content: center; text-align: center; gap: 12px;
  font-family: var(--mono); font-weight: 600; font-size: 14px;
  color: var(--blue-dark); background: var(--blue-soft); border-color: var(--blue-mid);
}
.tile-add { border-style: dashed; }
.tile-add .icon, .tile-action .icon { width: 30px; height: 30px; }
.tile-add:hover, .tile-action:hover { background: var(--blue-mid); }
.tile-ctext { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.tile-add .tile-desc, .tile-action .tile-desc { color: var(--blue-dark); opacity: .65; margin-top: 0; font-weight: 500; }

/* ---------- Modal (native <dialog>) ---------- */
dialog.modal {
  width: min(560px, calc(100vw - 28px)); max-height: calc(100vh - 56px);
  padding: 0; border: 0; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); background: var(--surface); color: var(--text);
  overflow: hidden;
}
dialog.modal::backdrop { background: rgba(10, 22, 40, .5); backdrop-filter: blur(2px); }
.modal-head {
  display: flex; align-items: center; gap: 12px; padding: 17px 20px;
  border-bottom: 1px solid var(--line-2); background: var(--surface);
}
.modal-head h2 { font-family: var(--display); font-weight: 600; font-size: 17px; margin: 0; }
.modal-close {
  margin-left: auto; flex: none; width: 34px; height: 34px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-soft);
  display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.modal-close .icon { width: 18px; height: 18px; }
.modal-close:hover { background: var(--danger-soft); color: var(--danger); border-color: #efcbc7; }
.modal-body { padding: 20px; overflow-y: auto; max-height: calc(100vh - 56px - 66px); }

/* Belge ekle kutusu */
.addbox {
  margin-top: 14px; padding: 14px; border: 1px dashed var(--line);
  border-radius: var(--radius-xs); background: var(--surface-2);
}

/* İç katlanır — parti ayarları (buton görünümlü, açılır olduğu belli) */
.subfold { margin-top: 18px; }
.subfold > summary {
  list-style: none; cursor: pointer; -webkit-user-select: none; user-select: none;
  display: flex; align-items: center; gap: 9px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-xs);
  background: var(--surface-2); font-size: 13.5px; font-weight: 600; color: var(--text-soft);
  transition: background .15s, border-color .15s, color .15s;
}
.subfold > summary::-webkit-details-marker { display: none; }
.subfold > summary:hover { background: var(--blue-soft); border-color: var(--blue-mid); color: var(--text); }
.subfold > summary:focus-visible { outline: 3px solid var(--blue-soft); outline-offset: 2px; }
.subfold > summary .edit-ico { width: 16px; height: 16px; flex: none; color: var(--muted); }
.subfold > summary:hover .edit-ico { color: var(--blue); }
.subfold > summary .chev { width: 17px; height: 17px; flex: none; margin-left: auto; color: var(--muted); transition: transform .2s; }
.subfold[open] > summary .chev { transform: rotate(180deg); }
.subfold[open] > summary {
  border-bottom-left-radius: 0; border-bottom-right-radius: 0;
  background: var(--blue-soft); border-color: var(--blue-mid); color: var(--text);
}

/* ---------- Responsive (telefon) ---------- */
@media (max-width: 460px) {
  .topbar { padding: 12px 16px; gap: 8px; }
  .hero { padding: 28px 18px 58px; }
  .shell { padding: 0 12px 56px; }
  .panel { padding: 18px; }
  .cert-body { padding: 18px 18px 20px; }
  /* Belge satırı: aksiyonlar alta insin, taşma olmasın */
  .doc { flex-wrap: wrap; }
  .doc .meta { flex-basis: calc(100% - 53px); }
  .doc .acts { width: 100%; margin-left: 53px; }
  .doc .acts .btn { flex: 1; }
}

/* ---------- Erişilebilirlik ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
