/* Loomie Quote Form Embed — storefront styles
   CSS custom properties scoped to .lqf so merchant theme doesn't bleed in.
   Primary color is set inline from block.settings.primary_color. */

.loomie-form-embed {
  box-sizing: border-box;
  font-family: inherit;
}

/* ─── Root ─────────────────────────────────────────────────────────────────── */

.lqf {
  --lqf-primary: #7c3aed;
  --lqf-primary-hover: #6d28d9;
  --lqf-border: #d1d5db;
  --lqf-border-error: #dc2626;
  --lqf-text: #111827;
  --lqf-muted: #6b7280;
  --lqf-bg: #ffffff;
  --lqf-bg-alt: #f9fafb;
  --lqf-radius: 8px;
  --lqf-radius-sm: 4px;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 32px;
  color: var(--lqf-text);
  font-size: 15px;
  line-height: 1.5;
}

/* ─── Progress bar ──────────────────────────────────────────────────────────── */

.lqf-progress {
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  margin-bottom: 28px;
  overflow: hidden;
}

.lqf-progress-fill {
  height: 100%;
  background: var(--lqf-primary);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}

/* ─── Step ──────────────────────────────────────────────────────────────────── */

.lqf-step-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--lqf-text);
}

.lqf-step-desc {
  color: var(--lqf-muted);
  margin: 0 0 24px;
  font-size: 14px;
}

/* ─── Field ──────────────────────────────────────────────────────────────────── */

.lqf-field {
  margin-bottom: 20px;
}

.lqf-label {
  display: block;
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--lqf-text);
}

.lqf-required {
  color: var(--lqf-border-error);
  margin-left: 2px;
}

.lqf-help {
  font-size: 13px;
  color: var(--lqf-muted);
  margin: 0 0 6px;
}

/* ─── Inputs ──────────────────────────────────────────────────────────────────── */

.lqf-input,
.lqf-select {
  display: block;
  width: 100%;
  border: 1px solid var(--lqf-border);
  border-radius: var(--lqf-radius-sm);
  padding: 10px 14px;
  font-size: 15px;
  line-height: 1.5;
  background: var(--lqf-bg);
  color: var(--lqf-text);
  box-sizing: border-box;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.lqf-input:focus,
.lqf-select:focus {
  border-color: var(--lqf-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--lqf-primary) 15%, transparent);
}

.lqf-input.lqf-error,
.lqf-select.lqf-error {
  border-color: var(--lqf-border-error);
}

.lqf-textarea {
  resize: vertical;
  min-height: 88px;
}

.lqf-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%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 36px;
  cursor: pointer;
}

.lqf-date-input,
.lqf-time-input {
  width: auto;
}

/* ─── Checkbox ────────────────────────────────────────────────────────────────── */

.lqf-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 15px;
}

.lqf-checkbox {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--lqf-primary);
  cursor: pointer;
}

/* ─── Address ─────────────────────────────────────────────────────────────────── */

.lqf-address-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lqf-address-wrap .lqf-input {
  margin-bottom: 0;
}

/* ─── File ────────────────────────────────────────────────────────────────────── */

.lqf-file {
  font-size: 14px;
  color: var(--lqf-muted);
}

/* ─── Divider ─────────────────────────────────────────────────────────────────── */

.lqf-divider {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 8px 0;
}

/* ─── Info block ──────────────────────────────────────────────────────────────── */

.lqf-info-block {
  background: var(--lqf-bg-alt);
  border: 1px solid var(--lqf-border);
  border-radius: var(--lqf-radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--lqf-text);
}

/* ─── Calc output ─────────────────────────────────────────────────────────────── */

.lqf-calc-field {
  background: var(--lqf-bg-alt);
  border: 1px solid var(--lqf-border);
  border-radius: var(--lqf-radius-sm);
  padding: 12px 16px;
}

.lqf-calc-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--lqf-primary);
  margin: 4px 0 0;
}

/* ─── Field error ─────────────────────────────────────────────────────────────── */

.lqf-field-error {
  color: var(--lqf-border-error);
  font-size: 13px;
  margin: 4px 0 0;
}

/* ─── Navigation ──────────────────────────────────────────────────────────────── */

.lqf-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}

.lqf-submit-error {
  width: 100%;
  color: var(--lqf-border-error);
  font-size: 14px;
  margin: 0;
}

.lqf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--lqf-border);
  border-radius: var(--lqf-radius-sm);
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  background: var(--lqf-bg);
  color: var(--lqf-text);
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
}

.lqf-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.lqf-btn--primary {
  background: var(--lqf-primary);
  border-color: var(--lqf-primary);
  color: #ffffff;
  margin-left: auto;
}

.lqf-btn--primary:hover:not(:disabled) {
  background: var(--lqf-primary-hover);
  border-color: var(--lqf-primary-hover);
}

/* ─── Turnstile ───────────────────────────────────────────────────────────────── */

.lqf-turnstile {
  width: 100%;
  margin-bottom: 8px;
}

/* ─── Success ─────────────────────────────────────────────────────────────────── */

.lqf-success-content {
  text-align: center;
  padding: 32px 16px;
}

.lqf-success-content p {
  font-size: 16px;
  color: var(--lqf-text);
  margin: 0;
}

/* ─── Error block (load failure) ─────────────────────────────────────────────── */

.lqf-error-block {
  color: var(--lqf-muted);
  font-size: 14px;
  text-align: center;
  padding: 24px;
}

/* ─── Signature placeholder ──────────────────────────────────────────────────── */

.lqf-signature-placeholder {
  border: 1px dashed var(--lqf-border);
  border-radius: var(--lqf-radius-sm);
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--lqf-muted);
  font-size: 14px;
}

/* ─── Hidden attribute override ──────────────────────────────────────────────── */
/* display: flex/inline-flex on .lqf-btn etc. overrides the HTML hidden attribute.
   This rule restores the expected behaviour for all elements that use hidden. */

.lqf-btn[hidden],
.lqf-progress[hidden],
.lqf-step[hidden],
.lqf-field-error[hidden],
.lqf-success-content[hidden],
.lqf-turnstile[hidden] {
  display: none !important;
}

/* ─── Responsive ──────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .lqf {
    padding: 0 0 24px;
  }

  .lqf-btn--primary {
    margin-left: 0;
    width: 100%;
  }

  .lqf-nav {
    flex-direction: column-reverse;
  }

  .lqf-btn--prev {
    width: 100%;
    text-align: center;
  }
}
