/* =====================================================================
   AntiGravity Forms – Public Form CSS
   Beautiful, accessible frontend form styles
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Wrapper ──────────────────────────────────────────────────────── */
.agf-form-wrapper {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  max-width: 680px;
  margin: 0 auto;
  color: #1E293B;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.agf-form-wrapper * { box-sizing: border-box; }

/* ── Multi-step Progress Bar ──────────────────────────────────────── */
.agf-progress-bar-wrap {
  margin-bottom: 28px;
}

.agf-progress-steps {
  display: flex;
  align-items: center;
  gap: 0;
}

.agf-progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.agf-step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #94A3B8;
  background: white;
  transition: all .25s ease;
}

.agf-progress-step.active .agf-step-num {
  background: #6366F1;
  border-color: #6366F1;
  color: white;
  box-shadow: 0 0 0 4px rgba(99,102,241,.15);
}

.agf-progress-step.done .agf-step-num {
  background: #10B981;
  border-color: #10B981;
  color: white;
}

.agf-step-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #94A3B8;
  text-align: center;
  max-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agf-progress-step.active .agf-step-label { color: #6366F1; }
.agf-progress-step.done .agf-step-label   { color: #10B981; }

.agf-step-line {
  flex: 1;
  height: 2px;
  background: #E2E8F0;
  margin: 0 8px;
  margin-bottom: 22px;
  transition: background .3s ease;
}

.agf-step-line.done { background: #10B981; }

/* ── Form ─────────────────────────────────────────────────────────── */
.agf-form {
  background: #FFFFFF;
  border-radius: 16px;
  border: 1px solid #E2E8F0;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,.07);
  overflow: hidden;
}

/* ── Form Step ────────────────────────────────────────────────────── */
.agf-form-step {
  display: none;
  padding: 28px 32px;
  animation: agf-fade-up .35s cubic-bezier(.4,0,.2,1);
}

.agf-form-step.active { display: block; }

@keyframes agf-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Field rows with widths */
.agf-field-wrap { margin-bottom: 20px; }

.agf-field-width-half,
.agf-field-width-third {
  display: inline-block;
  vertical-align: top;
}

.agf-field-width-half  { width: calc(50% - 8px); margin-right: 16px; }
.agf-field-width-third { width: calc(33.33% - 11px); margin-right: 16px; }
.agf-field-width-half:nth-child(2n),
.agf-field-width-third:nth-child(3n) { margin-right: 0; }
.agf-field-width-full { width: 100%; display: block; }

/* ── Labels ───────────────────────────────────────────────────────── */
.agf-field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #0F172A;
  margin-bottom: 7px;
  line-height: 1.4;
}

.agf-required {
  color: #EF4444;
  margin-left: 2px;
  font-size: 0.9em;
}

/* ── Inputs ───────────────────────────────────────────────────────── */
.agf-input,
.agf-select,
.agf-textarea {
  width: 100%;
  padding: 11px 14px;
  font-size: 0.9375rem;
  font-family: inherit;
  color: #0F172A;
  background: #FFFFFF;
  border: 1.5px solid #CBD5E1;
  border-radius: 8px;
  transition: border-color .2s ease, box-shadow .2s ease;
  outline: none;
  line-height: 1.5;
  appearance: none;
}

.agf-input:focus,
.agf-select:focus,
.agf-textarea:focus {
  border-color: #6366F1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

.agf-input.agf-error,
.agf-select.agf-error,
.agf-textarea.agf-error {
  border-color: #EF4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,.1);
}

.agf-input::placeholder,
.agf-textarea::placeholder { color: #94A3B8; }
.agf-textarea { min-height: 120px; resize: vertical; }
.agf-select    { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394A3B8' fill='none' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }

/* ── Help text ────────────────────────────────────────────────────── */
.agf-field-help {
  font-size: 0.8rem;
  color: #64748B;
  margin: 5px 0 0;
}

/* ── Field errors ─────────────────────────────────────────────────── */
.agf-field-error {
  font-size: 0.8rem;
  color: #DC2626;
  margin-top: 5px;
  min-height: 0;
  transition: all .2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.agf-field-error:not(:empty)::before {
  content: '⚠';
  font-size: 0.75rem;
}

/* ── Choices (radio/checkbox) ─────────────────────────────────────── */
.agf-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agf-choice-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 10px 14px;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  transition: all .2s ease;
  font-size: 0.9rem;
}

.agf-choice-item:hover {
  border-color: #6366F1;
  background: #EEF2FF;
}

.agf-choice-item input[type="radio"],
.agf-choice-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #6366F1;
  cursor: pointer;
  flex-shrink: 0;
}

.agf-choice-item:has(input:checked) {
  border-color: #6366F1;
  background: #EEF2FF;
}

/* ── File Upload ──────────────────────────────────────────────────── */
.agf-file-drop-zone {
  position: relative;
  border: 2px dashed #CBD5E1;
  border-radius: 10px;
  text-align: center;
  padding: 24px;
  cursor: pointer;
  transition: all .2s ease;
  background: #FAFAFA;
}

.agf-file-drop-zone:hover,
.agf-file-drop-zone.drag-over {
  border-color: #6366F1;
  background: #EEF2FF;
}

.agf-file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.agf-file-icon  { font-size: 28px; display: block; margin-bottom: 8px; }
.agf-file-label { display: block; font-size: 0.9rem; font-weight: 600; color: #374151; margin-bottom: 4px; }
.agf-file-hint  { font-size: 0.78rem; color: #94A3B8; }

.agf-file-preview {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #15803D;
}

/* ── Star Rating ──────────────────────────────────────────────────── */
.agf-rating-wrap {
  display: flex;
  flex-direction: row-reverse;
  gap: 4px;
  width: fit-content;
}

.agf-rating-wrap input { display: none; }
.agf-star { font-size: 28px; color: #CBD5E1; cursor: pointer; transition: color .15s ease; }
.agf-rating-wrap input:checked ~ label.agf-star,
.agf-rating-wrap label.agf-star:hover,
.agf-rating-wrap label.agf-star:hover ~ label.agf-star { color: #F59E0B; }

/* ── Section Break ────────────────────────────────────────────────── */
.agf-section-break {
  padding: 16px 0 8px;
  margin-bottom: 4px;
  border-top: 1px solid #F1F5F9;
}

.agf-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0F172A;
  margin: 0 0 6px;
}

.agf-section-desc {
  font-size: 0.875rem;
  color: #64748B;
}

/* ── HTML Block ───────────────────────────────────────────────────── */
.agf-html-block {
  font-size: 0.9rem;
  color: #374151;
  line-height: 1.7;
}

/* ── Submit Row ───────────────────────────────────────────────────── */
.agf-submit-row {
  padding: 20px 32px 28px;
  background: #FAFAFA;
  border-top: 1px solid #F1F5F9;
}

.agf-submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 32px;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all .2s ease;
  box-shadow: 0 4px 12px rgba(99,102,241,.3);
  min-width: 140px;
  justify-content: center;
}

.agf-submit-btn:hover {
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99,102,241,.4);
}

.agf-submit-btn:active  { transform: translateY(0); }
.agf-submit-btn:disabled { opacity: .7; cursor: not-allowed; transform: none; }

.agf-submit-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: white;
  border-radius: 50%;
  animation: agf-spin .6s linear infinite;
}

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

/* ── Multi-step Navigation ────────────────────────────────────────── */
.agf-step-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #F1F5F9;
}

.agf-btn-prev,
.agf-btn-next {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s ease;
}

.agf-btn-prev {
  background: #F1F5F9;
  color: #475569;
  border: 1.5px solid #E2E8F0;
}

.agf-btn-prev:hover { background: #E2E8F0; color: #1E293B; }

.agf-btn-next {
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  color: white;
  border: none;
  box-shadow: 0 2px 8px rgba(99,102,241,.25);
  margin-left: auto;
}

.agf-btn-next:hover {
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  transform: translateY(-1px);
}

/* ── Form Messages ────────────────────────────────────────────────── */
.agf-form-messages { padding: 0 32px 20px; }

.agf-success-message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #F0FDF4;
  border: 1.5px solid #86EFAC;
  border-radius: 10px;
  padding: 16px 20px;
  animation: agf-fade-up .4s ease;
}

.agf-success-icon { font-size: 24px; }
.agf-success-title { font-size: 1rem; font-weight: 700; color: #15803D; margin: 0 0 4px; }
.agf-success-text  { font-size: 0.875rem; color: #166534; margin: 0; }

.agf-error-message {
  background: #FEF2F2;
  border: 1.5px solid #FCA5A5;
  border-radius: 10px;
  padding: 14px 18px;
  color: #DC2626;
  font-size: 0.875rem;
  font-weight: 500;
}

/* ── Payment Section ──────────────────────────────────────────────── */
.agf-payment-section {
  padding: 20px 32px;
  border-top: 1px solid #F1F5F9;
}

.agf-payment-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.agf-gateway-logo { height: 28px; object-fit: contain; }
.agf-payment-amount { font-size: 1.2rem; font-weight: 700; color: #0F172A; margin-left: auto; }

.agf-stripe-element {
  padding: 14px;
  border: 1.5px solid #CBD5E1;
  border-radius: 8px;
  background: white;
  margin-bottom: 12px;
}

.agf-payment-error {
  color: #DC2626;
  font-size: 0.85rem;
  margin-top: 8px;
}

/* ── Honeypot – must be invisible ─────────────────────────────────── */
.agf-hp-field {
  display: none !important;
  visibility: hidden;
  position: absolute;
  left: -9999px;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .agf-form-step { padding: 20px 18px; }
  .agf-submit-row { padding: 16px 18px 22px; }
  .agf-form-messages { padding: 0 18px 16px; }
  .agf-payment-section { padding: 16px 18px; }
  .agf-field-width-half  { width: 100%; display: block; margin-right: 0; }
  .agf-field-width-third { width: 100%; display: block; margin-right: 0; }
  .agf-submit-btn { width: 100%; }
}
