/* KKA-Sign — gemeinsames Stylesheet für Signier- und Send-Seite */

@font-face {
  font-family: "KKA Signature";
  src: url("./dancing-script.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1c2733;
  --muted: #6a7683;
  --line: #e2e7ee;
  --brand: #1f6feb;
  --brand-dark: #1a5fd0;
  --ok: #1a8a4a;
  --err: #c23b3b;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(20, 40, 70, 0.06), 0 8px 30px rgba(20, 40, 70, 0.07);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 900px; margin: 0 auto; padding: 24px 18px 80px; }

header.top {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 2px 18px; border-bottom: 1px solid var(--line); margin-bottom: 22px;
}
header.top .brand-logo { height: 34px; width: auto; max-width: 240px; display: block; }
header.top .titles { line-height: 1.2; }
header.top .titles b { font-size: 15px; }
header.top .titles span { display: block; font-size: 12px; color: var(--muted); }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; margin-bottom: 18px;
}
.card h2 { margin: 0 0 4px; font-size: 17px; }
.card .sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

/* PDF-Vorschau (Signier-Seite) */
.pdf-scroll {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  max-height: 64vh; overflow: auto; background: #eceff3;
  border: 1px solid var(--line); border-radius: 10px; padding: 14px;
}
.sign-page-wrap { position: relative; box-shadow: 0 1px 4px rgba(0,0,0,0.14); border-radius: 2px; }
.sign-page-wrap canvas { display: block; background: #fff; border-radius: 2px; }
.sign-marker {
  position: absolute; transform: translate(-50%, -50%);
  background: rgba(26,138,74,0.16); border: 2px dashed var(--ok);
  color: #12683a; font-size: 12px; font-weight: 700;
  padding: 8px 12px; border-radius: 6px; white-space: nowrap; pointer-events: none;
}
.pdf-frame { width: 100%; height: 72vh; border: 1px solid var(--line); border-radius: 10px; background: #fff; display: block; }
.pdf-fallback { text-align: center; font-size: 12px; color: var(--muted); margin-top: 8px; }
.pdf-fallback a { color: var(--brand); }

/* Unterschrift platzieren (Send-Seite) */
.place-pages {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  max-height: 60vh; overflow: auto; background: #eceff3;
  border: 1px solid var(--line); border-radius: 10px; padding: 14px;
}
.page-wrap { position: relative; cursor: crosshair; box-shadow: 0 1px 4px rgba(0,0,0,0.14); border-radius: 2px; }
.page-wrap canvas { display: block; background: #fff; border-radius: 2px; }
.sig-marker {
  position: absolute; transform: translate(-50%, -50%);
  background: rgba(31,111,235,0.14); border: 2px dashed var(--brand);
  color: var(--brand-dark); font-size: 12px; font-weight: 700;
  padding: 8px 12px; border-radius: 6px; white-space: nowrap; pointer-events: none;
}

/* Tabs */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab {
  flex: 1; padding: 10px; border: 1px solid var(--line); background: #fff;
  border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted);
  transition: all .12s ease;
}
.tab.active { border-color: var(--brand); color: var(--brand); background: #f2f7ff; }

/* Signaturfeld */
.sig-box {
  position: relative; border: 2px dashed #c3ccd6; border-radius: 10px;
  background: #fff; height: 170px; overflow: hidden;
}
.sig-box canvas { width: 100%; height: 100%; touch-action: none; display: block; }
.sig-box .hint {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #b3bcc7; font-size: 14px; pointer-events: none;
}
.typed-preview {
  height: 170px; display: grid; place-items: center; border: 2px dashed #c3ccd6;
  border-radius: 10px; background: #fff;
}
.typed-preview span { font-family: "KKA Signature", cursive; font-size: 58px; color: #14315e; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
input[type="text"], input[type="email"], textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, textarea:focus { outline: none; border-color: var(--brand); }
textarea { min-height: 78px; resize: vertical; }

.consent {
  display: flex; gap: 10px; align-items: flex-start; margin: 16px 0;
  padding: 12px 14px; background: #f7f9fc; border: 1px solid var(--line); border-radius: 10px;
}
.consent input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.consent label { font-size: 13.5px; color: var(--ink); }

.actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
button.primary {
  background: var(--brand); color: #fff; border: none; padding: 13px 22px;
  border-radius: 10px; font-size: 15px; font-weight: 700; cursor: pointer;
  transition: background .12s ease;
}
button.primary:hover:not(:disabled) { background: var(--brand-dark); }
button.primary:disabled { background: #b9c4d1; cursor: not-allowed; }
button.ghost {
  background: #fff; color: var(--muted); border: 1px solid var(--line);
  padding: 12px 16px; border-radius: 10px; font-size: 14px; cursor: pointer; font-weight: 600;
}

.note { font-size: 12px; color: var(--muted); }
.spacer { flex: 1; }

/* Status-Screens */
.state { text-align: center; padding: 46px 20px; }
.state .icon { font-size: 46px; margin-bottom: 10px; }
.state h2 { margin: 0 0 6px; }
.state p { color: var(--muted); max-width: 460px; margin: 0 auto; }
.state.ok .icon { color: var(--ok); }
.state.err .icon { color: var(--err); }

.hidden { display: none !important; }

.banner {
  padding: 11px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 14px;
}
.banner.err { background: #fdecec; color: var(--err); border: 1px solid #f4c9c9; }
.banner.info { background: #eef4ff; color: var(--brand-dark); border: 1px solid #cfe0ff; }

.linkout { word-break: break-all; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }

.spinner {
  width: 34px; height: 34px; border: 3px solid #dfe5ee; border-top-color: var(--brand);
  border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

footer.legal { text-align: center; font-size: 11.5px; color: #9aa5b1; margin-top: 26px; }
