/* ============================================================
   SXMeets Mobile — Consent flow (WS-D)
   ------------------------------------------------------------
   Self-contained 3-step bottom sheet:
     1. Phone entry
     2. SMS / WhatsApp verification code
     3. Signature canvas + submit

   No human face in any captured content without a signed consent.
   Pre-camera modal calls SXConsent.open() and receives a consent_id
   on success — that id is then passed to /api/content/capture/init
   when has_human=true.

   Required:
     _shared/tokens.css OR your host's own --bg/--text/--border/etc
     (component is token-agnostic — uses var() with fallbacks)
   ============================================================ */

/* Backdrop + sheet */
.sx-cs-bd {
  position: fixed;
  inset: 0;
  z-index: 200;          /* above content-studio's cs-* (z:90) */
  background: rgba(0, 0, 0, .60);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: flex-end;
  animation: sx-cs-fade-in .18s ease-out;
}
.sx-cs-bd.open { display: flex; }

@keyframes sx-cs-fade-in { from { opacity: 0 } to { opacity: 1 } }
@keyframes sx-cs-slide-up { from { transform: translateY(100%) } to { transform: none } }
@keyframes sx-cs-shake {
  0%, 100% { transform: translateX(0) }
  20%, 60% { transform: translateX(-6px) }
  40%, 80% { transform: translateX(6px) }
}

.sx-cs-sheet {
  background: var(--surface, #1A1F2E);
  color: var(--text, #F4F6FB);
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 22px 22px 0 0;
  padding: 14px 20px 28px;
  border: 1px solid var(--border, rgba(255,255,255,.10));
  border-bottom: none;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  animation: sx-cs-slide-up .25s cubic-bezier(.2,.9,.3,1);
}
.sx-cs-handle {
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, .25);
  border-radius: 2px;
  margin: 0 auto 18px;
}
body.bright .sx-cs-handle { background: rgba(10, 26, 46, .25); }

/* Headers */
.sx-cs-eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted, rgba(255, 255, 255, .60));
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.sx-cs-eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--coral, #FF5533);
}
.sx-cs-title {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -.4px;
  margin-bottom: 6px;
  line-height: 1.2;
}
.sx-cs-sub {
  font-size: 13px;
  color: var(--muted, rgba(255, 255, 255, .60));
  line-height: 1.5;
  margin-bottom: 20px;
}

/* Steps (one visible at a time) */
.sx-cs-step { display: none; }
.sx-cs-step.active { display: block; }

/* Progress dots */
.sx-cs-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 18px;
}
.sx-cs-dot {
  width: 28px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .12);
  transition: background .2s;
}
.sx-cs-dot.done   { background: var(--green, #4ADE80); }
.sx-cs-dot.active { background: var(--coral, #FF5533); }

/* Inputs */
.sx-cs-field {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-2, rgba(255, 255, 255, .06));
  border: 1.5px solid var(--border, rgba(255, 255, 255, .10));
  color: var(--text, #F4F6FB);
  font-size: 16px;        /* >=16px prevents iOS zoom on focus */
  font-weight: 600;
  letter-spacing: .2px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, background .15s;
}
.sx-cs-field:focus {
  border-color: var(--coral, #FF5533);
  background: rgba(255, 255, 255, .08);
}
.sx-cs-field::placeholder {
  color: var(--muted-2, rgba(255, 255, 255, .35));
  font-weight: 500;
}

.sx-cs-field.code {
  text-align: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 22px;
  letter-spacing: 8px;
  font-weight: 700;
}

.sx-cs-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--muted, rgba(255, 255, 255, .55));
  margin-bottom: 8px;
  display: block;
}

/* Scope description block */
.sx-cs-scope {
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border-2, rgba(255, 255, 255, .06));
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted, rgba(255, 255, 255, .70));
  margin-bottom: 16px;
}
.sx-cs-scope b {
  color: var(--text, #F4F6FB);
  display: block;
  margin-bottom: 4px;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* Error message */
.sx-cs-error {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 77, 61, .14);
  border: 1px solid rgba(255, 77, 61, .35);
  color: var(--red, #FF4D3D);
  font-size: 12px;
  font-weight: 700;
  display: none;
}
.sx-cs-error.show {
  display: block;
  animation: sx-cs-shake .4s ease-in-out;
}

/* Buttons */
.sx-cs-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.sx-cs-btn {
  flex: 1;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .2px;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: transform .08s, opacity .15s;
}
.sx-cs-btn:active { transform: scale(.97); }
.sx-cs-btn:disabled {
  opacity: .5;
  pointer-events: none;
}
.sx-cs-btn.primary {
  background: var(--coral, #FF5533);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 85, 51, .30);
}
.sx-cs-btn.ghost {
  background: rgba(255, 255, 255, .06);
  color: var(--text, #F4F6FB);
  border: 1px solid var(--border, rgba(255, 255, 255, .12));
}

/* Signature canvas */
.sx-cs-sig-wrap {
  position: relative;
  margin-top: 6px;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  border: 1.5px solid var(--border, rgba(255, 255, 255, .12));
  touch-action: none;     /* let JS handle pointer events */
}
.sx-cs-sig {
  display: block;
  width: 100%;
  height: 180px;
  cursor: crosshair;
}
.sx-cs-sig-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: rgba(10, 26, 46, .35);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .3px;
}
.sx-cs-sig-wrap.signed .sx-cs-sig-hint { display: none; }
.sx-cs-sig-clear {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .6px;
  text-transform: uppercase;
  background: rgba(10, 26, 46, .08);
  color: rgba(10, 26, 46, .65);
  border: none;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}
.sx-cs-sig-clear:active { transform: scale(.95); }

/* Loading spinner inside the primary button */
.sx-cs-btn.loading::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: sx-cs-spin .8s linear infinite;
  margin-right: 4px;
}
@keyframes sx-cs-spin { to { transform: rotate(360deg) } }

/* Success step */
.sx-cs-success {
  text-align: center;
  padding: 16px 0 8px;
}
.sx-cs-success-ic {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--green, #4ADE80);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #0A1A2E;
  font-weight: 900;
  animation: sx-cs-pop .4s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes sx-cs-pop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.sx-cs-success h3 {
  font-size: 18px;
  font-weight: 900;
  margin-bottom: 6px;
}
.sx-cs-success p {
  font-size: 13px;
  color: var(--muted, rgba(255, 255, 255, .60));
  line-height: 1.5;
}

/* Legal footer text on every step */
.sx-cs-legal {
  margin-top: 16px;
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--muted-2, rgba(255, 255, 255, .42));
  text-align: center;
}
.sx-cs-legal a {
  color: var(--muted, rgba(255, 255, 255, .65));
  text-decoration: underline;
}

/* Bright-mode tweaks */
body.bright .sx-cs-sheet {
  background: #FFFFFF;
  color: #0A1A2E;
  border-color: rgba(10, 26, 46, .12);
}
body.bright .sx-cs-field {
  background: rgba(10, 26, 46, .04);
  border-color: rgba(10, 26, 46, .12);
  color: #0A1A2E;
}
body.bright .sx-cs-field:focus { background: rgba(10, 26, 46, .06); }
body.bright .sx-cs-scope { background: rgba(10, 26, 46, .04); border-color: rgba(10, 26, 46, .08); }
body.bright .sx-cs-btn.ghost { background: rgba(10, 26, 46, .04); border-color: rgba(10, 26, 46, .12); color: #0A1A2E; }
