/* =============================================
   Auth Form Builder Pro — Public Frontend CSS
   ============================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --afbp-primary: #2563eb;
  --afbp-primary-dark: #1d4ed8;
  --afbp-radius: 10px;
  --afbp-font: 'Inter', -apple-system, sans-serif;
  --afbp-text: #111827;
  --afbp-muted: #6b7280;
  --afbp-border: #e5e7eb;
  --afbp-input-bg: #f9fafb;
  --afbp-label: #374151;
  --afbp-error: #ef4444;
  --afbp-success: #10b981;
  --afbp-shadow: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
  --afbp-shadow-lg: 0 20px 25px -5px rgba(0,0,0,.1), 0 10px 10px -5px rgba(0,0,0,.04);
}

/* ---- WRAPPER ---- */
.afbp-form-wrapper {
  font-family: var(--afbp-font);
  color: var(--afbp-text);
  box-sizing: border-box;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* ---- TITLE ---- */
.afbp-form-title {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px;
  line-height: 1.2;
}
.afbp-form-description {
  font-size: 14px;
  color: var(--afbp-muted);
  margin: 0 0 24px;
  line-height: 1.6;
}

/* ---- FORM ---- */
.afbp-form { width: 100%; }

/* ---- FIELD ---- */
.afbp-field {
  margin-bottom: 16px;
}
.afbp-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--afbp-label);
  margin-bottom: 6px;
}
.afbp-required { color: var(--afbp-error); margin-left: 2px; }

/* ---- INPUT WRAPPER ---- */
.afbp-input-wrapper {
  position: relative;
}
.afbp-input-wrapper.afbp-has-icon .afbp-input {
  padding-left: 40px;
}
.afbp-input-wrapper.afbp-has-toggle .afbp-input {
  padding-right: 40px;
}
.afbp-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  display: flex;
  align-items: center;
  pointer-events: none;
}

/* ---- INPUTS ---- */
.afbp-input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  font-size: 14px;
  font-family: var(--afbp-font);
  color: var(--afbp-text);
  background: var(--afbp-input-bg);
  border: 1.5px solid var(--afbp-border);
  border-radius: var(--afbp-radius);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  appearance: none;
  -webkit-appearance: none;
}
.afbp-input::placeholder { color: #9ca3af; }
.afbp-input:focus {
  border-color: var(--afbp-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.afbp-input.afbp-input-error {
  border-color: var(--afbp-error);
  background: #fff5f5;
}
.afbp-input.afbp-input-success {
  border-color: var(--afbp-success);
}

/* Input styles */
.afbp-input-outline {
  background: transparent;
  border: 1.5px solid var(--afbp-border);
}
.afbp-input-flat {
  background: #f3f4f6;
  border-color: transparent;
  border-radius: calc(var(--afbp-radius) / 2);
}
.afbp-input-flat:focus {
  background: #fff;
  border-color: var(--afbp-primary);
}
.afbp-input-underline {
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--afbp-border);
  border-radius: 0;
  padding-left: 0;
}
.afbp-input-underline:focus {
  border-bottom-color: var(--afbp-primary);
  box-shadow: none;
}

/* ---- PASSWORD TOGGLE ---- */
.afbp-password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color .15s;
}
.afbp-password-toggle:hover { color: var(--afbp-primary); }

/* ---- CHECKBOX ---- */
.afbp-field-checkbox { margin-bottom: 14px; }
.afbp-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--afbp-label);
  cursor: pointer;
  line-height: 1.5;
}
.afbp-checkbox-label input[type="checkbox"] {
  width: 17px;
  height: 17px;
  border: 1.5px solid var(--afbp-border);
  border-radius: 4px;
  cursor: pointer;
  accent-color: var(--afbp-primary);
  flex-shrink: 0;
  margin-top: 2px;
}
.afbp-checkbox-label a { color: var(--afbp-primary); text-decoration: none; }
.afbp-checkbox-label a:hover { text-decoration: underline; }

/* ---- SELECT ---- */
.afbp-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 36px;
  cursor: pointer;
}

/* ---- FIELD HINT & ERROR ---- */
.afbp-field-hint {
  display: block;
  font-size: 12px;
  color: var(--afbp-muted);
  margin-top: 5px;
}
.afbp-field-error {
  font-size: 12px;
  color: var(--afbp-error);
  margin-top: 5px;
  display: none;
}
.afbp-field-error.visible { display: block; }

/* ---- SUBMIT BUTTON ---- */
.afbp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--afbp-font);
  border: none;
  border-radius: var(--afbp-radius);
  cursor: pointer;
  transition: all .2s;
  position: relative;
  overflow: hidden;
  margin-top: 8px;
}
.afbp-btn:disabled { opacity: .7; cursor: not-allowed; }

.afbp-btn-primary { background: var(--afbp-primary); color: #fff; }
.afbp-btn-primary:hover:not(:disabled) { background: var(--afbp-primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,.35); }

.afbp-btn-gradient {
  background: linear-gradient(135deg, var(--afbp-primary) 0%, #4f46e5 100%);
  color: #fff;
}
.afbp-btn-gradient:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--afbp-primary-dark) 0%, #4338ca 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(37,99,235,.4);
}
.afbp-btn-outline {
  background: transparent;
  color: var(--afbp-primary);
  border: 2px solid var(--afbp-primary);
}
.afbp-btn-outline:hover:not(:disabled) { background: var(--afbp-primary); color: #fff; }

.afbp-btn-shadow {
  background: var(--afbp-primary);
  color: #fff;
  box-shadow: 0 4px 15px rgba(37,99,235,.4);
}
.afbp-btn-shadow:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(37,99,235,.5); }

/* Spinner */
.afbp-btn-spinner svg {
  animation: afbp-spin .7s linear infinite;
}
@keyframes afbp-spin { to { transform: rotate(360deg); } }

/* ---- DIVIDER ---- */
.afbp-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--afbp-muted);
  font-size: 13px;
}
.afbp-divider::before,
.afbp-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--afbp-border);
}

/* ---- SOCIAL BUTTONS ---- */
.afbp-social-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}
.afbp-social-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1.5px solid var(--afbp-border);
  border-radius: var(--afbp-radius);
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  color: var(--afbp-text);
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  font-family: var(--afbp-font);
}
.afbp-social-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.afbp-social-btn svg, .afbp-social-btn img { flex-shrink: 0; }

/* ---- FORM MESSAGES ---- */
.afbp-form-messages {
  margin: 12px 0;
  min-height: 0;
}
.afbp-message {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.afbp-message-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.afbp-message-error   { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }
.afbp-message-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }

/* ---- FORM LINKS ---- */
.afbp-form-links {
  text-align: center;
  margin-top: 16px;
}
.afbp-form-links p { margin: 6px 0; font-size: 13px; color: var(--afbp-muted); }
.afbp-link {
  color: var(--afbp-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color .15s;
}
.afbp-link:hover { color: var(--afbp-primary-dark); text-decoration: underline; }

/* ---- COMBINED TABS ---- */
.afbp-combined-forms { }
.afbp-tabs { display: flex; gap: 0; margin-bottom: 24px; border-bottom: 2px solid var(--afbp-border); }
.afbp-tab {
  flex: 1; padding: 11px; font-size: 14px; font-weight: 600;
  background: none; border: none; cursor: pointer;
  color: var(--afbp-muted); border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all .15s; font-family: var(--afbp-font);
}
.afbp-tab.active { color: var(--afbp-primary); border-bottom-color: var(--afbp-primary); }
.afbp-tab-content { display: none; }
.afbp-tab-content.active { display: block; }

/* ---- OTP INPUT ---- */
.afbp-otp-wrapper {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 16px 0;
}
.afbp-otp-input {
  width: 48px; height: 56px;
  text-align: center; font-size: 22px; font-weight: 700;
  border: 2px solid var(--afbp-border); border-radius: 10px;
  background: var(--afbp-input-bg); color: var(--afbp-text);
  outline: none; transition: all .15s;
}
.afbp-otp-input:focus { border-color: var(--afbp-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); background: #fff; }

/* ---- MODAL ---- */
.afbp-modal {
  display: none;
  position: fixed; inset: 0; z-index: 999999;
  align-items: center; justify-content: center;
}
.afbp-modal.afbp-modal-open { display: flex; }
.afbp-modal-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
}
.afbp-modal-content {
  position: relative; z-index: 1;
  background: #fff; border-radius: 16px;
  padding: 32px; width: 100%; max-width: 460px;
  margin: 20px;
  box-shadow: var(--afbp-shadow-lg);
  animation: afbp-modal-in .2s ease;
}
@keyframes afbp-modal-in {
  from { opacity: 0; transform: scale(.95) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.afbp-modal-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; cursor: pointer;
  font-size: 22px; color: #9ca3af; line-height: 1;
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; transition: all .12s;
}
.afbp-modal-close:hover { background: #f1f5f9; color: #374151; }

/* ---- ANIMATIONS ---- */
.afbp-form-wrapper.afbp-anim-fade { animation: afbp-fade .3s ease; }
.afbp-form-wrapper.afbp-anim-slide { animation: afbp-slide .35s ease; }
.afbp-form-wrapper.afbp-anim-zoom { animation: afbp-zoom .3s ease; }
@keyframes afbp-fade  { from { opacity:0 } to { opacity:1 } }
@keyframes afbp-slide { from { opacity:0; transform:translateY(16px) } to { opacity:1; transform:translateY(0) } }
@keyframes afbp-zoom  { from { opacity:0; transform:scale(.96) } to { opacity:1; transform:scale(1) } }

/* ---- LOADING OVERLAY ---- */
.afbp-form-loading {
  position: relative;
}
.afbp-form-loading::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,.7);
  border-radius: var(--afbp-radius);
  backdrop-filter: blur(1px);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 480px) {
  .afbp-form-title { font-size: 20px; }
  .afbp-social-buttons { flex-direction: column; }
  .afbp-otp-wrapper { gap: 6px; }
  .afbp-otp-input { width: 40px; height: 48px; font-size: 18px; }
  .afbp-modal-content { padding: 24px 20px; }
}
