/* 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;
}

/* ─── Row / field width grid ──────────────────────────────────────────────────── */
/* Fields are grouped into rows (by the embed JS) where widths sum to ≤12.
   Mobile always stacks fields at full width — the width-N classes only
   apply at the desktop breakpoint. */

.lqf-row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 0 12px;
}

.lqf-field-w12,
.lqf-field-w9,
.lqf-field-w8,
.lqf-field-w6,
.lqf-field-w4,
.lqf-field-w3 {
  grid-column: span 12;
  min-width: 0;
}

@media (min-width: 768px) {
  .lqf-field-w9 { grid-column: span 9; }
  .lqf-field-w8 { grid-column: span 8; }
  .lqf-field-w6 { grid-column: span 6; }
  .lqf-field-w4 { grid-column: span 4; }
  .lqf-field-w3 { grid-column: span 3; }
}

/* ─── 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);
}

/* ─── Multi-day events ───────────────────────────────────────────────────────── */
/* The Day 1 block renders bare when multi-day is off, so a form with the feature
   enabled but unchecked looks identical to a single-day form. */

.lqf-multiday-toggle {
  margin-bottom: 16px;
}

.lqf-multiday-toggle .lqf-help {
  margin: 4px 0 0 26px;
}

.lqf-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

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

/* Grouping frame only appears once multi-day is switched on */
.lqf-multiday-on .lqf-day {
  border: 1px solid var(--lqf-border);
  border-radius: var(--lqf-radius-sm);
  background: color-mix(in srgb, var(--lqf-primary) 3%, transparent);
  padding: 16px 16px 0;
  margin-bottom: 16px;
}

/* ─── Day accordion ──────────────────────────────────────────────────────────
   Every rule below is scoped to .lqf-multiday-on: with the toggle off, Day 1 is
   simply the single-day field set and must never collapse or look clickable. */

.lqf-multiday-on .lqf-day-head {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  margin-bottom: 0;
}

.lqf-multiday-on .lqf-day-head:focus-visible {
  outline: 2px solid var(--lqf-primary);
  outline-offset: 2px;
  border-radius: var(--lqf-radius-sm);
}

.lqf-day-chevron {
  display: inline-block;
  transition: transform 0.2s ease;
  margin-right: 8px;
  color: var(--lqf-muted);
  font-size: 12px;
}

.lqf-multiday-on .lqf-day-collapsed .lqf-day-chevron {
  transform: rotate(-90deg);
}

.lqf-day-summary {
  font-weight: 400;
  color: var(--lqf-muted);
}

/* The summary is a stand-in for the fields; once they are on screen it is noise. */
.lqf-day-expanded .lqf-day-summary {
  display: none;
}

.lqf-multiday-on .lqf-day-collapsed {
  background: transparent;
}

.lqf-multiday-on .lqf-day-collapsed:hover {
  border-color: var(--lqf-primary);
}

.lqf-multiday-on .lqf-day-collapsed .lqf-day-body {
  display: none;
}

.lqf-multiday-on .lqf-day-expanded .lqf-day-body {
  display: block;
  animation: lqf-day-open 0.18s ease;
}

/* Padding lives on .lqf-day so the header keeps its box when collapsed; the
   bottom half is dropped there instead, since field margins supply it. */
.lqf-multiday-on .lqf-day-collapsed {
  padding-bottom: 16px;
}

.lqf-multiday-on .lqf-day-expanded .lqf-day-head {
  margin-bottom: 12px;
}

@keyframes lqf-day-open {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lqf-day-chevron,
  .lqf-multiday-on .lqf-day-expanded .lqf-day-body {
    transition: none;
    animation: none;
  }
}

.lqf-multiday-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 20px;
}

.lqf-btn--sm {
  padding: 6px 14px;
  font-size: 14px;
}

.lqf-btn--link {
  border-color: transparent;
  background: transparent;
  color: var(--lqf-muted);
  padding: 4px 8px;
}

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

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

/* ─── 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],
.lqf-day-head[hidden],
.lqf-extra-days[hidden],
.lqf-multiday-controls[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;
  }
}
