/* ==========================================================================
   Blue Carbon shared theme — design tokens extracted from bc-web-app app.css.
   Dark glassmorphism chrome; the contract itself renders in a white .paper
   panel. Used by both the admin SPA and the public signing page.
   Fonts: Google Fonts links in each page head (Oxanium, Manrope, Great Vibes).
   ========================================================================== */

:root {
  --bc-bg: #0a0e17;
  --bc-text: #e2e8f0;
  --bc-text-soft: #cbd5e1;
  --bc-text-muted: #94a3b8;
  --bc-text-faint: #64748b;
  --bc-accent: #60a5fa;
  --bc-accent-alt: #38bdf8;
  --bc-primary: #2563eb;
  --bc-navy: #163880;
  --bc-danger: #dc2626;
  --bc-border: rgba(255, 255, 255, 0.08);
  --bc-ink: #1e293b; /* signature ink — forced dark, lands on a white PDF */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background-color: #0a0e17;
  background-image:
    radial-gradient(1200px 600px at 20% -10%, rgba(37, 99, 235, 0.18), transparent 60%),
    radial-gradient(1000px 500px at 90% 0%, rgba(56, 189, 248, 0.10), transparent 55%);
  background-attachment: fixed;
  color: #e2e8f0;
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
.btn,
.steps {
  font-family: 'Oxanium', 'Manrope', system-ui, sans-serif;
}

h1 {
  font-size: 1.45rem;
  font-weight: 600;
  margin: 0 0 10px;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 18px 0 8px;
  color: #cbd5e1;
}

a {
  color: #60a5fa;
}

.muted {
  color: #94a3b8;
}

.hidden {
  display: none !important;
}

/* ---- layout chrome ---- */

.bc-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
}

.bc-header .bc-logo {
  height: 48px;
  width: auto;
  display: block;
}

.bc-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 8px 20px 64px;
}

.screen {
  margin-top: 20px;
}

/* ---- glass panel (contract-pinned tokens) ---- */

.glass-panel {
  background: rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
}

.step-panel {
  margin-bottom: 16px;
}

/* ---- buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  color: #e2e8f0;
  background: #163880;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s ease, transform 0.05s ease;
}

.btn:hover {
  filter: brightness(1.15);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: #2563eb;
  border-color: #2563eb;
}

.btn-danger {
  background: #dc2626;
  border-color: #dc2626;
}

.btn-ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.16);
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ---- forms (dark theme) ---- */

.field {
  margin-bottom: 14px;
}

.field label,
.field .field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 4px;
}

input[type="text"],
input[type="email"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

input::placeholder,
textarea::placeholder {
  color: #64748b;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

input.field-locked {
  background: rgba(255, 255, 255, 0.03);
  color: #94a3b8;
  border-style: dashed;
  cursor: default;
}

input.field-locked:focus {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}

/* Pair "Address line 1" and "Address line 2" on one row: force line 1 to start a fresh row. */
.field-grid .field.addr-line-1 {
  grid-column-start: 1;
}

/* A full-sentence prompt (e.g. the typed-signature name box) reads as prose, not an all-caps label. */
.field label.instruction-label {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  font-size: 0.9rem;
  color: #cbd5e1;
}

/* "Signed on / IP address logged" lines on the confirmation screen. */
.signed-meta {
  font-size: 0.85rem;
}

/* Inline spinner shown in the Sign button while the executed document is generated. */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: bc-spin 0.7s linear infinite;
  vertical-align: middle;
}

@keyframes bc-spin {
  to { transform: rotate(360deg); }
}

.consent-label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: #cbd5e1;
  cursor: pointer;
}

.consent-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex: none;
  accent-color: #2563eb;
}

/* ---- white paper contract panel ---- */

.paper {
  background: #ffffff;
  color: #111827;
  border-radius: 8px;
}

.paper-frame {
  display: block;
  width: 100%;
  height: 70vh;
  border: 0;
}

/* ---- signature pad ---- */

.sig-canvas {
  display: block;
  width: 100%;
  height: 200px;
  background: #ffffff; /* white pad regardless of theme — PNG lands on a white PDF */
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  touch-action: none; /* pointer events own the surface; no scroll while signing */
  cursor: crosshair;
}

.sig-toolbar {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.sig-toolbar .btn {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.sig-typed-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  padding: 0 12px;
  overflow: hidden;
  text-align: center;
  background: #ffffff;
  color: #1e293b;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  font-family: 'Great Vibes', cursive;
  font-size: 2.6rem;
}

/* ---- steps indicator ---- */

.steps {
  display: flex;
  gap: 8px;
  margin: 4px 0 16px;
}

.step {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #64748b;
  border-bottom: 2px solid rgba(255, 255, 255, 0.08);
}

.step.active {
  color: #60a5fa;
  border-bottom-color: #2563eb;
}

/* ---- toasts ---- */

#bc-toasts {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, calc(100vw - 32px));
}

.bc-toast {
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.bc-toast-success {
  border-color: #38bdf8;
}

.bc-toast-error {
  border-color: #dc2626;
}

/* ---- responsive breakpoints ---- */

@media (max-width: 640px) {
  .bc-header {
    padding: 12px 14px;
  }

  .bc-main {
    padding: 4px 12px 48px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .paper-frame {
    height: 60vh;
  }

  .actions {
    flex-direction: column-reverse;
  }

  .actions .btn {
    width: 100%;
  }

  .sig-typed-preview {
    font-size: 2rem;
  }
}

@media (min-width: 1200px) {
  .bc-main {
    max-width: 900px;
  }
}
