/* ============================================================
   Revival MD — Form Page Styles
   ============================================================ */

/* ── reCAPTCHA Wrapper ── */
.captcha-wrapper {
  position: relative;
  margin-top: 0.5rem;
  display: inline-block;
}
.captcha-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--slate-700);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.6rem;
}
.captcha-label .required { color: var(--error); }
.g-recaptcha {
  display: inline-block;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
#captcha-error { margin-top: 0.4rem; }


/* ── Progress Bar ── */
#progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--teal-400), var(--gold-400));
  z-index: 500;
  transition: width 0.4s ease;
  border-radius: 0 2px 2px 0;
}

/* ── Header ── */
.site-header {
  background: linear-gradient(135deg, var(--teal-900) 0%, var(--teal-800) 60%, #0a3a42 100%);
  padding: 2rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top center, rgba(42,157,184,0.18) 0%, transparent 65%);
}
.site-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gold-500), var(--teal-400), var(--gold-500));
}

.logo-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.logo-circle {
  width: 90px; height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-600), var(--teal-900));
  border: 3px solid rgba(212,160,23,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 30px rgba(10,31,92,0.5), 0 0 60px rgba(10,31,92,0.2);
}
.logo-circle svg { width: 52px; height: 52px; }

.header-brand {
  color: white;
  font-family: var(--font-serif);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 10px rgba(0,0,0,0.4);
}
.header-tagline {
  color: var(--gold-300);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}
.header-divider {
  color: rgba(255,255,255,0.3);
  margin: 0 0.5rem;
}

/* ── Form Hero Title ── */
.form-hero {
  background: linear-gradient(180deg, var(--teal-900), var(--teal-800));
  padding: 2.5rem 1.5rem 3rem;
  text-align: center;
  position: relative;
}
.form-hero::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 40px;
  background: var(--slate-100);
  clip-path: ellipse(55% 100% at 50% 100%);
}

.form-hero-title {
  color: white;
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 700;
  text-shadow: 0 2px 12px rgba(0,0,0,0.4);
  position: relative;
  z-index: 1;
}
.form-hero-sub {
  color: var(--gold-300);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 0.4rem;
  font-weight: 500;
  position: relative;
  z-index: 1;
}

/* ── Main Layout ── */
.form-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* ── Section Cards ── */
.form-section {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
  overflow: hidden;
  transition: var(--transition-base);
}
.form-section:hover { box-shadow: var(--shadow-lg); }

.section-header {
  background: linear-gradient(135deg, var(--teal-800), var(--teal-700));
  padding: 1.1rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: default;
}
.section-header.gold-accent {
  background: linear-gradient(135deg, var(--teal-900), var(--teal-800));
  border-left: 4px solid var(--gold-400);
}
.section-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.section-title {
  color: white;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.section-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.12);
  color: var(--gold-300);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.section-body { padding: 1.75rem; }

/* ── Form Fields ── */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}
.field-grid-3 { grid-template-columns: repeat(3, 1fr); }
.field-span-2 { grid-column: span 2; }
.field-full   { grid-column: 1 / -1; }

.field-group {
  display: flex;
  flex-direction: column;
  position: relative;
  gap: 0.4rem;
}

.field-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--slate-700);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.field-label .required { color: var(--error); margin-left: 2px; }

.field-input,
.field-select {
  width: 100%;
  margin-top: auto;
  padding: 0.75rem 1rem;
  border: 2px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  color: var(--slate-800);
  background: var(--slate-50);
  transition: var(--transition-fast);
  outline: none;
}
.field-input:focus,
.field-select:focus {
  border-color: var(--teal-400);
  background: white;
  box-shadow: 0 0 0 3px rgba(10,31,92,0.18);
}
.field-input.error { border-color: var(--error); }
.field-input::placeholder { color: var(--slate-400); }

.field-select { cursor: pointer; }
.field-select option { background: white; color: var(--slate-800); }

/* ── Checkbox Items ── */
.agreement-text {
  font-size: 0.9rem;
  color: var(--slate-600);
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  background: var(--slate-50);
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
}
.checkbox-item:hover {
  background: var(--teal-50);
  border-color: var(--teal-300);
}
.checkbox-item.checked,
.checkbox-item:has(input[type="checkbox"]:checked) {
  background: var(--teal-50);
  border-color: var(--teal-400);
}
/* ── Required-but-unchecked error state ── */
.checkbox-item.required-error {
  background: #fff5f5;
  border-color: var(--error);
  animation: shakeBox 0.35s ease;
}
.checkbox-item.required-error .custom-checkbox {
  border-color: var(--error);
  background: #fee2e2;
}
.checkbox-item.required-error .checkbox-label {
  color: var(--slate-800);
}
/* Remove error state as soon as user checks it */
.checkbox-item.required-error.checked,
.checkbox-item.required-error:has(input[type="checkbox"]:checked) {
  background: var(--teal-50);
  border-color: var(--teal-400);
  animation: none;
}
.checkbox-item.required-error.checked .custom-checkbox,
.checkbox-item.required-error:has(input[type="checkbox"]:checked) .custom-checkbox {
  border-color: var(--teal-600);
  background: var(--teal-600);
}

@keyframes shakeBox {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(3px); }
}

/* Required asterisk badge on checkbox-list heading */
.checkbox-required-note {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--error);
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-full);
  padding: 0.15rem 0.6rem;
  margin-bottom: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.checkbox-item input[type="checkbox"] { 
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.custom-checkbox {
  width: 20px; height: 20px;
  border: 2px solid var(--slate-300);
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  transition: var(--transition-fast);
  background: white;
}
.checkbox-item.checked .custom-checkbox,
.checkbox-item input[type="checkbox"]:checked + .custom-checkbox {
  background: var(--teal-600);
  border-color: var(--teal-600);
}
.custom-checkbox::after {
  content: '';
  width: 5px; height: 9px;
  border: 2px solid white;
  border-top: none; border-left: none;
  transform: rotate(45deg) translateY(-1px);
  display: none;
}
.checkbox-item.checked .custom-checkbox::after,
.checkbox-item input[type="checkbox"]:checked + .custom-checkbox::after { display: block; }

.checkbox-label {
  font-size: 0.88rem;
  color: var(--slate-700);
  line-height: 1.6;
  flex: 1;
}

/* ── Signature Pad ── */
.signature-section {
  background: var(--slate-50);
  border: 2px dashed var(--slate-300);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: var(--transition-fast);
}
.signature-section:hover, .signature-section.active {
  border-color: var(--teal-400);
  background: var(--teal-50);
}

.signature-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

#signature-canvas {
  width: 100%;
  height: 140px;
  border-radius: var(--radius-sm);
  background: white;
  cursor: crosshair;
  touch-action: none;
  display: block;
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.08);
}

.signature-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.sig-clear-btn {
  background: none;
  border: 1.5px solid var(--slate-300);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  color: var(--slate-600);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: var(--transition-fast);
}
.sig-clear-btn:hover { border-color: var(--error); color: var(--error); }

/* ── Submit Section ── */
.submit-section {
  text-align: center;
  padding: 2.5rem 1.75rem;
}
.submit-note {
  font-size: 0.82rem;
  color: var(--slate-500);
  margin-top: 1rem;
}

.submit-btn-wrap { position: relative; display: inline-block; }

#submit-btn {
  font-size: 1.1rem;
  padding: 1.1rem 3.5rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.03em;
  position: relative;
}
#submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* ── Success Modal ── */
.success-icon {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-500), var(--teal-700));
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 2rem;
  box-shadow: 0 8px 24px rgba(10,31,92,0.35);
  animation: successPop 0.5s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
@keyframes successPop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.success-title {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  color: var(--teal-800);
  margin-bottom: 0.5rem;
}
.success-id {
  font-size: 0.8rem;
  color: var(--slate-500);
  margin-top: 1rem;
  font-family: monospace;
}

/* ── Field Error Message ── */
.field-error {
  font-size: 0.78rem;
  color: var(--error);
  display: none;
  position: absolute;
  top: calc(100% + 0.1rem);
  left: 0;
  width: 100%;
  white-space: nowrap;
  pointer-events: none;
}
.field-error.visible { display: block; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .field-grid     { grid-template-columns: 1fr; }
  .field-grid-3   { grid-template-columns: 1fr 1fr; }
  .field-span-2   { grid-column: span 1; }
  .section-body   { padding: 1.25rem; }
}
