/* Judicemed CRM — form chrome
 * Scoped to .judicemed-* / .judi-* classes so it never collides with the
 * theme's CF7 styling. Uses CSS custom properties so the theme can override.
 */
.judicemed-beneficiario,
.judicemed-geral {
  --judi-radius: 10px;
  --judi-border: #e1e5ea;
  --judi-bg: #ffffff;
  --judi-bg-soft: #f7f9fc;
  --judi-text: #1f2937;
  --judi-muted: #6b7280;
  --judi-primary: #0d6efd;
  --judi-primary-hover: #0b5ed7;
  --judi-ok: #1a7c3c;
  --judi-ok-bg: #e8f5ee;
  --judi-err: #b00020;
  --judi-err-bg: #fdecef;
  --judi-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
}

/* ========== Shared card chrome (Beneficiário & Contato Geral) ========== */
.judicemed-beneficiario,
.judicemed-geral {
  border: 1px solid var(--judi-border);
  background: var(--judi-bg);
  border-radius: var(--judi-radius);
  padding: 20px 24px;
  margin: 16px 0 24px;
  box-shadow: var(--judi-shadow);
  color: var(--judi-text);
}
.judicemed-beneficiario[hidden],
.judicemed-geral[hidden] { display: none; }

.judi-card-header { margin-bottom: 16px; }
.judi-card-header h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--judi-text);
}
.judi-card-sub {
  margin: 0;
  color: var(--judi-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.judi-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 12px;
}
.judi-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--judi-text);
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.judi-req { color: var(--judi-err); font-weight: 700; }
.judi-opt { color: var(--judi-muted); font-weight: 400; font-size: 0.78rem; }

.judi-field input[type="text"],
.judi-field input[type="email"],
.judi-field input[type="tel"],
.judi-field input[type="date"] {
  width: 100%;
  max-width: 420px;
  padding: 9px 12px;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--judi-text);
  background: var(--judi-bg);
  border: 1px solid var(--judi-border);
  border-radius: 6px;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.judi-field input:focus {
  outline: none;
  border-color: var(--judi-primary);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

/* ========== Carteirinha OU CPF row ========== */
.judi-id-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 12px;
  max-width: 560px;
  margin: 0 0 12px;
}
.judi-id-row .judi-field { margin-bottom: 0; max-width: none; }
.judi-id-row .judi-field input { max-width: none; }
.judi-or {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px; /* aligns with input height */
  position: relative;
}
.judi-or span {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--judi-muted);
  background: var(--judi-bg);
  border: 1px solid var(--judi-border);
  border-radius: 999px;
}

@media (max-width: 540px) {
  .judi-id-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .judi-or { height: auto; margin: 4px 0; }
}

/* ========== Action row (button + feedback) ========== */
.judi-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}
.judi-validar,
.judi-continuar {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  cursor: pointer;
  padding: 9px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: var(--judi-primary);
  border-radius: 6px;
  transition: background-color .15s, transform .05s;
}
.judi-validar:hover:not(:disabled),
.judi-continuar:hover:not(:disabled) { background: var(--judi-primary-hover); }
.judi-validar:active:not(:disabled),
.judi-continuar:active:not(:disabled) { transform: translateY(1px); }
.judi-validar:disabled,
.judi-continuar:disabled {
  background: #9aa3ad;
  cursor: not-allowed;
}

.judi-feedback,
.judi-g-feedback {
  font-size: 0.9rem;
  line-height: 1.4;
  padding: 4px 10px;
  border-radius: 4px;
  min-height: 1.4em;
}
.judi-feedback.judi-ok,
.judi-g-feedback.judi-ok    { color: var(--judi-ok);  background: var(--judi-ok-bg); }
.judi-feedback.judi-err,
.judi-g-feedback.judi-err   { color: var(--judi-err); background: var(--judi-err-bg); }
.judi-feedback.judi-loading,
.judi-g-feedback.judi-loading { color: var(--judi-muted); }

/* ========== Gated CF7 region ========== */
.judi-gate[hidden] { display: none; }

/* ========== Collapsed identification card ========== */
/* Once validated/identified, the card collapses to a single-line summary
 * with an "Editar" link. Inputs stay in the DOM (so values still submit),
 * just visually hidden via a single class. */
.judi-collapsed-summary { display: none; }
.judicemed-beneficiario.judi-collapsed,
.judicemed-geral.judi-collapsed {
  padding: 12px 18px;
  background: var(--judi-ok-bg);
  border-color: #b7e0c5;
}
.judicemed-beneficiario.judi-collapsed > *:not(.judi-collapsed-summary),
.judicemed-geral.judi-collapsed > *:not(.judi-collapsed-summary) {
  display: none !important;
}
.judicemed-beneficiario.judi-collapsed > .judi-collapsed-summary,
.judicemed-geral.judi-collapsed > .judi-collapsed-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.judi-collapsed-text {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--judi-ok);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.4;
}
.judi-edit-link {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid #b7e0c5;
  color: var(--judi-ok);
  padding: 4px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .15s, color .15s;
  white-space: nowrap;
}
.judi-edit-link:hover {
  background: var(--judi-ok);
  color: #fff;
}
.judi-edit-link span { margin-right: 4px; }

/* ========== Success hero card (replaces the form after submit) ========== */
.judi-success-card {
  --judi-radius: 14px;
  --judi-ok: #1a7c3c;
  --judi-ok-soft: #e8f5ee;
  --judi-text: #1f2937;
  --judi-muted: #6b7280;
  --judi-border: #d6ead9;

  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  max-width: 560px;
  margin: 32px auto;
  padding: 40px 32px;
  background: linear-gradient(180deg, #f5fbf7 0%, #ffffff 100%);
  border: 1px solid var(--judi-border);
  border-radius: var(--judi-radius);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 8px 24px rgba(26, 124, 60, 0.08);
  color: var(--judi-text);
  outline: none;
  animation: judi-success-in .35s ease-out both;
}
.judi-success-card:focus { outline: none; }

@keyframes judi-success-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.judi-success-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--judi-ok);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  box-shadow: 0 4px 12px rgba(26, 124, 60, 0.25);
  animation: judi-success-pop .45s cubic-bezier(.2, .9, .3, 1.4) both .05s;
}
@keyframes judi-success-pop {
  from { transform: scale(.4); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}

.judi-success-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--judi-text);
  line-height: 1.3;
}
.judi-success-msg {
  margin: 0 0 12px;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--judi-muted);
  max-width: 440px;
}

.judi-success-protocol-box {
  width: 100%;
  max-width: 420px;
  margin: 8px 0 4px;
  padding: 18px 20px;
  background: #ffffff;
  border: 1px solid var(--judi-border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.judi-success-protocol-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--judi-muted);
}
.judi-success-protocol-num {
  /* Fluid size — keeps the 20-digit protocol on a single line across screen
   * widths. clamp() shrinks down to ~16px on narrow viewports without ever
   * exceeding ~24px on wide ones. */
  font-size: clamp(1rem, 4.2vw, 1.5rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--judi-ok);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.2;
  white-space: nowrap;
  user-select: all;
}

.judi-success-hint {
  margin: 6px 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--judi-muted);
  max-width: 440px;
}

@media (max-width: 480px) {
  .judicemed-beneficiario,
  .judicemed-geral { padding: 16px; }
  .judi-success-card { padding: 28px 16px; margin: 20px auto; }
  .judi-success-icon { width: 60px; height: 60px; }
  .judi-success-icon svg { width: 32px; height: 32px; }
  .judi-success-title { font-size: 1.15rem; }
  .judi-success-protocol-box { padding: 14px 12px; }
}
