/* =========================================================
   client-doc.css - the chrome around a client's document

   style.css does the document itself and the print isolation.
   This file styles only what sits around it: the header, the
   consent and signature panel, and the unavailable screen.

   Two rules that are not negotiable:

   1. Everything here is .no-print or lives inside an element
      that is. style.css hides body * and un-hides
      #formPrintDialog, so anything added outside that must
      stay out of the printed page.

   2. This is a client's first impression of the company on a
      phone, at whatever hour they got the text. Big targets,
      high contrast, nothing clever.
   ========================================================= */

.client-doc-body {
  margin: 0;
  background: #eef1f5;
  color: #1d2733;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

/* ---------- header ---------- */

.client-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: #10233a;
  color: #fff;
}

.client-brand { display: flex; align-items: center; gap: 12px; }
.client-brand img { height: 34px; width: auto; display: block; }
.client-brand div { display: flex; flex-direction: column; line-height: 1.25; }
.client-brand strong { font-size: 15px; letter-spacing: .2px; }
.client-brand span { font-size: 11.5px; opacity: .75; }

.client-header-actions { display: flex; align-items: center; gap: 10px; }

.client-pill {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .4px;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
}
.client-pill.signed { background: #1f7a52; color: #fff; }

/* Shown wherever the page had to be scaled down to fit. */
.client-zoom-hint {
  display: none;
  margin-top: 3px;
  font-size: 12px;
  opacity: .8;
}

.client-note {
  margin: 0;
  padding: 11px 18px;
  background: #dfe6ee;
  color: #33465c;
  font-size: 13px;
  line-height: 1.5;
}

/* ---------- buttons ---------- */

.client-btn {
  /* 44px is the smallest target that is comfortable on a phone. */
  min-height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.client-btn.primary { background: #1f7a52; color: #fff; }
.client-btn.primary:disabled { background: #b7c2ce; color: #eef1f5; cursor: not-allowed; }
.client-btn.secondary { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.3); }

/* ---------- the signing panel ---------- */

.client-sign {
  max-width: 8.5in;
  margin: 18px auto 40px;
  padding: 20px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 14px rgba(16,35,58,.10);
}
.client-sign h2 { margin: 0 0 14px; font-size: 17px; color: #10233a; }
.client-sign.done { border-left: 4px solid #1f7a52; }

.client-consent {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 13px;
  margin-bottom: 16px;
  background: #f5f8fb;
  border: 1px solid #d8e1ea;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.5;
  cursor: pointer;
}
.client-consent input {
  width: 22px; height: 22px;
  margin: 0; flex: none;
  accent-color: #1f7a52;
}

.client-pad-label {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #5a6672;
  margin-bottom: 6px;
}

/* The pad markup comes from print-render.js, so only the surround is set here.
   The box carries its own padding and card styling in style.css, which here
   would nest inside .client-sign and cost 34px of signing width on a phone -
   the widest part of the page a client actually has to use. */
#clientPadHost .signature-box {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}
#clientPadHost .signature-pad {
  width: 100%;
  height: 150px;
  background: #fff;
  border: 2px dashed #b7c2ce;
  border-radius: 10px;
  touch-action: none;   /* or the browser scrolls instead of drawing */
}
#clientPadHost .signature-label { display: none; }
#clientPadHost .signature-actions { margin-top: 8px; }

.client-sign-actions {
  display: flex; align-items: center; gap: 12px;
  margin-top: 16px; flex-wrap: wrap;
}
.client-sign-status { font-size: 13px; color: #a63a3a; }

.client-fineprint {
  margin: 14px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: #6b7684;
}

/* ---------- messages ---------- */

.client-message {
  max-width: 34rem;
  margin: 12vh auto;
  padding: 30px 24px;
  text-align: center;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 14px rgba(16,35,58,.10);
}
.client-message h1 { margin: 0 0 12px; font-size: 20px; color: #10233a; }
.client-message p { margin: 0 0 10px; font-size: 14px; line-height: 1.6; color: #4a5867; }
.client-message-action { font-weight: 700; color: #1d2733; }

.client-spinner {
  width: 26px; height: 26px;
  margin: 0 auto 16px;
  border: 3px solid #d8e1ea;
  border-top-color: #2e5f8f;
  border-radius: 50%;
  animation: client-spin .8s linear infinite;
}
@keyframes client-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .client-spinner { animation: none; border-top-color: #d8e1ea; }
}

/* ---------- phones ---------- */

/* screen, not all: this is page chrome, and none of it belongs on paper. */
@media screen and (max-width: 700px) {
  .client-header { padding: 12px 14px; }
  .client-header-actions { width: 100%; }
  .client-btn { width: 100%; }
  .client-sign { margin: 12px 10px 32px; border-radius: 12px; padding: 16px; }
}

/* ---------- screens too narrow for a Letter page ----------

   A separate threshold from the phone one above, because it answers a
   different question: 8.5in is 816px, plus gutters about 852px, so a portrait
   tablet at 768 or 820px needs this every bit as much as a phone does even
   though none of the phone chrome applies to it.

   Keep it in step with FIT_QUERY in client-doc.js. */
@media screen and (max-width: 860px) {
  .client-zoom-hint { display: block; }

  /* The sheet keeps its Letter size and the whole page is scaled down to the
     width of the screen. Reflowing it would read more easily at a glance and
     be wrong: what the client signs should be the page that prints, and
     anything too small to read is what pinch-to-zoom is for.

     --doc-zoom is measured and set by fitDocumentToScreen() in client-doc.js.
     It is applied here rather than inline so it cannot leak into print. */
  #printFormContent {
    padding: 8px;
    zoom: var(--doc-zoom, 1);
  }
  #printFormContent .print-sheet {
    width: 8.5in;
    min-height: 11in;
    margin: 0 auto 12px;
    box-shadow: 0 2px 10px rgba(16,35,58,.10);
  }

  /* If zoom is not supported, fall back to reflowing rather than leaving an
     816px sheet overflowing a 390px screen. */
  @supports not (zoom: 1) {
    #printFormContent .print-sheet { width: auto; min-height: 0; margin: 10px; }
  }
}

/* ---------- printing ----------
   Belt and braces. style.css already hides everything outside
   #formPrintDialog, but these elements are new to this page and a future
   change to that rule must not put a "Submit Signature" button on a
   client's signed contract. */
@media print {
  .client-doc-body { background: #fff; }
  #clientTop, #clientSign, .no-print { display: none !important; }
}
