/* =====================================================
   Dentalead — Liquid Glass Form (.lgf-*)
   Site-integrated styles using main.css design tokens
   ===================================================== */

/* ---------- Form base ---------- */
.lgf-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}
.lgf-form.lgf-compact { gap: 10px; }
.lgf-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 520px) {
  .lgf-row { grid-template-columns: 1fr; }
}

/* ---------- Field (label wrapper) ---------- */
.lgf-field {
  position: relative;
  display: block;
  --lgf-border: var(--glass-white-12);
  --lgf-bg: var(--glass-white-5);
  --lgf-accent: var(--cyan-primary);
}

.lgf-input,
.lgf-textarea {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--text-primary);
  background: var(--lgf-bg);
  border: 1px solid var(--lgf-border);
  border-radius: 12px;
  padding: 18px 14px 8px 42px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .25s ease, background .25s ease, box-shadow .25s ease;
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
}
.lgf-form.lgf-compact .lgf-input,
.lgf-form.lgf-compact .lgf-textarea {
  padding: 16px 12px 6px 38px;
  font-size: 14px;
  border-radius: 10px;
}

.lgf-textarea {
  min-height: 92px;
  resize: vertical;
  padding-top: 22px;
  line-height: 1.4;
}

.lgf-input:hover,
.lgf-textarea:hover {
  border-color: rgba(255,255,255,.22);
}

.lgf-input:focus,
.lgf-textarea:focus {
  border-color: var(--lgf-accent);
  background: rgba(107,175,192,0.08);
  box-shadow: 0 0 0 3px rgba(107,175,192,0.18);
}

.lgf-input::placeholder,
.lgf-textarea::placeholder { color: transparent; }

/* ---------- Inline icon ---------- */
.lgf-icon {
  position: absolute;
  left: 14px;
  top: 18px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color .25s ease, transform .25s ease;
}
.lgf-form.lgf-compact .lgf-icon {
  left: 12px;
  top: 16px;
  width: 16px;
  height: 16px;
}
.lgf-field.textarea .lgf-icon { top: 18px; }

.lgf-input:focus ~ .lgf-icon,
.lgf-textarea:focus ~ .lgf-icon,
.lgf-field:focus-within .lgf-icon {
  color: var(--cyan-bright);
}

/* ---------- Floating label ---------- */
.lgf-label {
  position: absolute;
  left: 42px;
  top: 16px;
  font-size: 14px;
  color: var(--text-muted);
  pointer-events: none;
  transform-origin: left top;
  transition: transform .2s ease, color .2s ease, opacity .2s ease;
  background: transparent;
  padding: 0 4px;
  white-space: nowrap;
}
.lgf-form.lgf-compact .lgf-label {
  left: 38px;
  top: 14px;
  font-size: 13px;
}

/* Float label up when input is focused or has content */
.lgf-input:focus ~ .lgf-label,
.lgf-input:not(:placeholder-shown) ~ .lgf-label,
.lgf-textarea:focus ~ .lgf-label,
.lgf-textarea:not(:placeholder-shown) ~ .lgf-label {
  transform: translateY(-12px) scale(0.78);
  color: var(--cyan-bright);
}

/* ---------- Error state ---------- */
.lgf-error {
  display: block;
  font-size: 12px;
  color: var(--red-text);
  margin-top: 4px;
  padding-left: 4px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height .2s ease, opacity .2s ease;
}
.lgf-field.invalid .lgf-input,
.lgf-field.invalid .lgf-textarea {
  border-color: var(--red-text);
  background: var(--red-soft);
  box-shadow: 0 0 0 3px rgba(248,113,113,0.15);
}
.lgf-field.invalid .lgf-icon { color: var(--red-text); }
.lgf-field.invalid .lgf-label { color: var(--red-text); }
.lgf-field.invalid .lgf-error {
  max-height: 40px;
  opacity: 1;
}

/* ---------- Honeypot ---------- */
.lgf-honey {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ---------- Submit button ---------- */
.lgf-submit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 18px;
  margin-top: 4px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--cyan-primary) 0%, var(--blue-primary) 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 12px 28px -10px rgba(22,114,192,0.45),
              inset 0 1px 0 rgba(255,255,255,.18);
  transition: transform .15s ease, box-shadow .25s ease, opacity .25s ease;
}
.lgf-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px -10px rgba(22,114,192,.55),
              inset 0 1px 0 rgba(255,255,255,.22);
}
.lgf-submit:active { transform: translateY(0); }

.lgf-submit::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg,
    transparent 30%,
    rgba(255,255,255,.25) 50%,
    transparent 70%);
  transform: translateX(-100%);
  transition: transform .8s ease;
}
.lgf-submit:hover::before { transform: translateX(100%); }

.lgf-submit:disabled,
.lgf-submit.loading {
  cursor: progress;
  opacity: .85;
}

.lgf-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  animation: lgfSpin .8s linear infinite;
}
.lgf-submit.loading .lgf-spinner { display: inline-block; }
@keyframes lgfSpin { to { transform: rotate(360deg); } }

/* ---------- Success state ---------- */
.lgf-success {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 16px;
  gap: 10px;
}
.lgf-success.visible { display: flex; }
.lgf-check {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(15,209,122,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  border: 1px solid rgba(15,209,122,0.4);
}
.lgf-success h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.lgf-success p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

/* ---------- Light mode overrides ---------- */
body.light-mode .lgf-field {
  --lgf-border: rgba(10,15,30,.12);
  --lgf-bg: rgba(255,255,255,.6);
}
body.light-mode .lgf-input,
body.light-mode .lgf-textarea {
  color: #0A0F1E;
}
body.light-mode .lgf-icon { color: #6B7A8E; }
body.light-mode .lgf-label { color: #6B7A8E; }
body.light-mode .lgf-input:hover,
body.light-mode .lgf-textarea:hover {
  border-color: rgba(10,15,30,.22);
}
body.light-mode .lgf-input:focus,
body.light-mode .lgf-textarea:focus {
  background: rgba(107,175,192,.08);
}

/* ---------- iOS / autofill polish ---------- */
.lgf-input:-webkit-autofill,
.lgf-textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--text-primary);
  -webkit-box-shadow: 0 0 0 100px rgba(10,15,30,.6) inset;
  caret-color: var(--text-primary);
}
body.light-mode .lgf-input:-webkit-autofill,
body.light-mode .lgf-textarea:-webkit-autofill {
  -webkit-text-fill-color: #0A0F1E;
  -webkit-box-shadow: 0 0 0 100px rgba(255,255,255,.85) inset;
}
