/* ============================================================
   GraftrHQ — forms.css
   Form inputs, upload zone, price selector, toggle, materials
   ============================================================ */

/* --- Form section label ------------------------------------ */
.form-section-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 0 4px;
  margin: 16px 0 6px;
}

/* --- Form group & fields ----------------------------------- */
.form-group {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.form-field {
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 0.5px solid var(--separator);
  min-height: 44px;
}

.form-field:last-child { border-bottom: none; }

.form-field input,
.form-field textarea,
.form-field select {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 17px;
  font-family: inherit;
  color: var(--text-primary);
  padding: 12px 0;
  width: 100%;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: var(--text-placeholder);
}

.form-field select {
  appearance: none;
  cursor: pointer;
}

.form-field select.placeholder { color: var(--text-placeholder); }

.form-field.select-field::after {
  content: '›';
  color: var(--text-tertiary);
  font-size: 22px;
  pointer-events: none;
}

.form-field textarea {
  resize: none;
  padding-top: 13px;
  line-height: 1.5;
  min-height: 100px;
  align-items: flex-start;
}

.form-note {
  font-size: 13px;
  color: var(--text-tertiary);
  padding: 6px 4px 10px;
  line-height: 1.5;
}

/* --- Upload zone ------------------------------------------- */
.upload-zone {
  border: 2px dashed var(--separator-strong);
  border-radius: var(--radius);
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 16px;
  background: var(--surface);
  transition: border-color 0.2s;
}

.upload-zone:hover { border-color: var(--orange); }
.upload-zone-icon  { font-size: 36px; margin-bottom: 10px; }
.upload-zone-title { font-size: 16px; font-weight: 500; margin-bottom: 4px; }
.upload-zone-sub   { font-size: 13px; color: var(--text-tertiary); }

.upload-previews {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.upload-thumb {
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  background: var(--surface-2);
}

.upload-thumb img,
.upload-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-thumb-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.upload-thumb-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.upload-thumb-caption {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 8px;
  font-weight: 600;
  letter-spacing: 0.2px;
  pointer-events: none;
}

/* --- Collapsible measurements card ------------------------- */
/* ============================================================
   Customer quote page (/quote/:slug) — iOS-style mockup
   ============================================================ */
.quote-page { max-width: 390px; margin: 0 auto; }

/* Tradesman header card — left-aligned avatar + name + coverage */
.tm-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 16px 0;
}
.tm-av {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--orange); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; flex-shrink: 0;
}
.tm-name { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.tm-area { font-size: 12px; color: var(--text-tertiary); margin-top: 1px; }
.tm-badge {
  display: inline-block;
  background: var(--orange-tint); color: var(--orange);
  font-size: 10px; font-weight: 600;
  padding: 2px 8px; border-radius: 20px;
  margin-top: 4px;
}

.quote-page .page-title {
  padding: 16px 16px 4px;
  font-size: 22px; font-weight: 700;
  color: var(--text-primary); letter-spacing: -0.5px;
}
.quote-page .page-sub {
  padding: 0 16px 16px;
  font-size: 13px; color: var(--text-tertiary); line-height: 1.5;
}

.quote-page .sec-lbl {
  font-size: 12px; font-weight: 600; color: var(--text-primary);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 0 16px; margin-bottom: 6px;
}

/* Form group: card with stacked icon-rows. Scoped under .quote-page so
   it doesn't clash with the legacy .form-group used by other pages. */
.quote-page .form-group {
  background: var(--surface);
  border-radius: 14px;
  margin: 0 16px 10px;
  overflow: hidden;
  border: 0.5px solid rgba(0,0,0,0.08);
  box-shadow: none;
}
.quote-page .form-row {
  display: flex; align-items: flex-start;
  padding: 12px 14px; gap: 12px;
  border-bottom: 0.5px solid rgba(0,0,0,0.06);
  min-height: 44px;
}
.quote-page .form-row:last-child { border-bottom: none; }

.f-icon {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.f-icon svg { width: 15px; height: 15px; }
.f-icon.f-icon-orange { background: rgba(249,115,22,0.10); color: var(--orange); }
.f-icon.f-icon-blue   { background: rgba(0,122,255,0.10);  color: var(--blue); }
.f-icon.f-icon-green  { background: rgba(52,199,89,0.10);  color: var(--green); }
.f-icon.f-icon-red    { background: rgba(255,59,48,0.10);  color: var(--red); }
.f-icon.f-icon-indigo { background: rgba(88,86,214,0.10);  color: #5856d6; }
.f-icon svg { stroke: currentColor; }

.f-content { flex: 1; min-width: 0; }
.f-label {
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 4px;
}
.f-input {
  width: 100%; border: none; outline: none; background: transparent;
  font-size: 16px; font-family: inherit; color: var(--text-primary);
  padding: 0; resize: none;
}
.f-input::placeholder { color: var(--text-placeholder); }
.f-input.ta { min-height: 80px; line-height: 1.5; }
.f-hint { font-size: 11px; color: var(--text-tertiary); margin-top: 3px; line-height: 1.4; }

/* Measurements disclosure — inside .quote-page form-group, not its own card */
.quote-page .measurements-card {
  background: transparent;
  border-radius: 0; box-shadow: none; margin: 0; overflow: visible;
}
.quote-page .measurements-card > summary {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; min-height: 44px;
  border-bottom: 0.5px solid rgba(0,0,0,0.06);
}
.quote-page .measurements-card[open] > summary { border-bottom: 0.5px solid rgba(0,0,0,0.06); }
.quote-page .measurements-row { padding: 0; min-height: 0; }
.quote-page .measurements-icon { background: rgba(88,86,214,0.10); color: #5856d6; }
.quote-page .measurements-grid { padding: 10px 14px 14px; border-top: none; }

/* Photo grid v2 — 3-col tiles + Add tile + counter slot */
.photo-section { margin: 0 16px 10px; }
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.photo-slot {
  aspect-ratio: 1; border-radius: 12px; position: relative; overflow: hidden;
  background: var(--surface-2);
}
.photo-slot img, .photo-slot video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.photo-pic-label {
  position: absolute; left: 6px; bottom: 6px;
  font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.95);
  background: rgba(0,0,0,0.45);
  padding: 2px 7px; border-radius: 5px;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
}
.photo-video-badge {
  position: absolute; left: 6px; top: 6px;
  font-size: 10px; font-weight: 700; color: #fff;
  background: rgba(0,0,0,0.55);
  padding: 2px 7px; border-radius: 5px;
}
.photo-remove-btn {
  position: absolute; top: 5px; right: 5px;
  width: 22px; height: 22px;
  background: rgba(0,0,0,0.55); border: none;
  border-radius: 50%; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; cursor: pointer; padding: 0;
  font-family: inherit;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.photo-add-slot {
  aspect-ratio: 1; border-radius: 12px;
  border: 1.5px dashed var(--separator-strong);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; cursor: pointer;
  background: rgba(249,115,22,0.03);
  transition: all 0.15s;
  font-family: inherit;
}
.photo-add-slot:active { background: rgba(249,115,22,0.08); border-color: var(--orange); }
.photo-add-slot svg { width: 22px; height: 22px; stroke: var(--orange); fill: none; stroke-width: 2; }
.photo-add-slot-text { font-size: 10px; color: var(--text-tertiary); font-weight: 600; }
.photo-counter-slot {
  aspect-ratio: 1; border-radius: 12px;
  background: rgba(0,0,0,0.03);
  border: 0.5px solid rgba(0,0,0,0.05);
  display: flex; align-items: center; justify-content: center;
}
.photo-counter-text {
  font-size: 10px; color: var(--text-tertiary); font-weight: 500;
  text-align: center; line-height: 1.4; padding: 4px;
}
.photo-spacer { aspect-ratio: 1; }

/* Video card */
.video-card {
  background: var(--surface);
  border-radius: 14px;
  margin: 0 16px 10px;
  padding: 13px 14px;
  border: 0.5px solid rgba(0,0,0,0.08);
  display: flex; align-items: center; gap: 12px;
  cursor: pointer;
  font-family: inherit;
  width: calc(100% - 32px);
  text-align: left;
}
.video-card .video-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(249,115,22,0.10);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.video-card .video-icon svg { width: 18px; height: 18px; stroke: var(--orange); fill: none; stroke-width: 2; }
.video-text { flex: 1; }
.video-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.video-sub { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }
.video-add { font-size: 13px; font-weight: 600; color: var(--orange); white-space: nowrap; }

/* Filled state — preview replaces the empty card after a video is picked */
.video-card-wrap { margin: 0 16px 10px; }
.video-card-wrap .video-card { margin: 0; width: 100%; }
.video-preview {
  background: var(--surface);
  border-radius: 14px;
  border: 0.5px solid rgba(0,0,0,0.08);
  padding: 10px 12px 10px 10px;
  display: flex; align-items: center; gap: 10px;
  position: relative;
}
.video-preview-el {
  width: 64px; height: 64px; flex-shrink: 0;
  border-radius: 10px; background: #000;
  object-fit: cover; display: block;
}
.video-preview-meta { flex: 1; min-width: 0; }
.video-preview-name {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.video-preview-sub { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.video-preview-remove {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,0.06); border: none; color: var(--text-secondary);
  font-size: 13px; font-weight: 600; cursor: pointer; padding: 0; flex-shrink: 0;
  font-family: inherit;
}
.video-preview-remove:active { background: rgba(0,0,0,0.12); }
.video-error {
  margin-top: 6px; padding: 8px 12px;
  background: rgba(255,59,48,0.08); color: #b91c1c;
  border-radius: 10px; font-size: 12px;
}

/* Tradesman enquiry-detail video block */
.enquiry-video { margin: 0 16px 14px; }
.enquiry-video-link {
  display: inline-block; margin-top: 8px;
  font-size: 13px; color: var(--orange); text-decoration: none; font-weight: 600;
}

/* Submit button + note */
.quote-page .submit-wrap { padding: 6px 16px 0; }
.quote-page .submit-btn {
  width: 100%; background: var(--orange); color: #fff;
  border: none; border-radius: 14px; padding: 16px;
  font-size: 17px; font-weight: 700; font-family: inherit;
  letter-spacing: -0.2px; cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.quote-page .submit-btn:active { opacity: 0.88; transform: scale(0.99); }
.quote-page .submit-note {
  font-size: 12px; color: var(--text-tertiary);
  text-align: center; margin-top: 10px; line-height: 1.5; padding: 0 8px;
}

/* ─── legacy measurements-card kept for any other page that uses it ── */
.measurements-card {
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.measurements-card > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.measurements-card > summary::-webkit-details-marker { display: none; }
.measurements-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  min-height: 56px;
}
.measurements-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(88, 86, 214, 0.12);
  color: #5856d6;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.measurements-icon svg { width: 16px; height: 16px; }
.measurements-summary {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.measurements-summary-label {
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 500;
}
.measurements-summary-hint {
  font-size: 12px;
  color: var(--text-placeholder);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.measurements-summary-hint.filled { color: var(--text-secondary); }
.measurements-chevron {
  font-size: 22px;
  line-height: 1;
  color: var(--text-tertiary);
  transition: transform 0.2s ease;
}
.measurements-card[open] .measurements-chevron { transform: rotate(90deg); }
.measurements-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px 14px 14px;
  border-top: 0.5px solid var(--separator);
}
.measure-cell {
  background: #f7f7f7;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.measure-cell-full { grid-column: span 2; }
.measure-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.measure-input {
  display: flex;
  align-items: center;
  gap: 4px;
}
.measure-input input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: inherit;
  padding: 0;
  width: 100%;
  min-width: 0;
  -moz-appearance: textfield;
}
.measure-input input::-webkit-outer-spin-button,
.measure-input input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.measure-input input::placeholder {
  color: var(--text-placeholder);
  font-weight: 400;
  font-size: 16px;
}
.measure-unit {
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 500;
  flex-shrink: 0;
}

/* --- Tradesman-facing measurements display ----------------- */
.job-meas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 6px;
  margin-top: 12px;
}
.job-meas-cell {
  background: #f7f7f7;
  border-radius: 8px;
  padding: 8px 10px;
}
.job-meas-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.job-meas-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2px;
}

.upload-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--text-tertiary);
  font-size: 28px;
}

.upload-error {
  font-size: 13px;
  color: var(--red);
  background: var(--red-tint);
  border-radius: 10px;
  padding: 10px 12px;
  margin: -8px 0 16px;
  line-height: 1.4;
}

/* --- Price range selector ---------------------------------- */
.price-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.price-option {
  background: var(--surface);
  border: 1.5px solid var(--separator-strong);
  border-radius: 10px;
  padding: 13px 8px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all 0.15s;
}

.price-option.selected {
  background: var(--orange-tint);
  border-color: var(--orange);
  color: var(--orange);
  font-weight: 600;
}

.price-custom {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.price-custom-label {
  font-size: 15px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.price-custom input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 17px;
  font-family: inherit;
  color: var(--text-primary);
  text-align: center;
}

/* --- Toggle switch ----------------------------------------- */
.toggle-row {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

.toggle-label { font-size: 17px; color: var(--text-primary); }

.toggle {
  width: 51px;
  height: 31px;
  border-radius: 16px;
  background: var(--separator-strong);
  position: relative;
  cursor: pointer;
  transition: background 0.25s;
  flex-shrink: 0;
}

.toggle.on { background: var(--green); }

.toggle-thumb {
  width: 27px;
  height: 27px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.toggle.on .toggle-thumb { transform: translateX(20px); }

/* --- Materials notes box ----------------------------------- */
.materials-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.materials-box textarea {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-primary);
  resize: none;
  min-height: 80px;
  line-height: 1.5;
}

.materials-box textarea::placeholder { color: var(--text-placeholder); }

/* --- Address autocomplete dropdown (quote page) ------------ */
.quote-page .addr-suggest {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 4px 0 0;
  padding: 4px 0;
  list-style: none;
  background: var(--surface, #fff);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 0.5px solid var(--separator, rgba(60,60,67,0.18));
  z-index: 30;
  max-height: 280px;
  overflow-y: auto;
}
.quote-page .addr-suggest-item {
  padding: 10px 14px;
  font-size: 15px;
  color: var(--text-primary, #1c1c1e);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.3;
}
.quote-page .addr-suggest-item:active,
.quote-page .addr-suggest-item.is-active,
.quote-page .addr-suggest-item:hover {
  background: rgba(249, 115, 22, 0.08);
  color: var(--orange, #f97316);
}

.quote-page .addr-manual-link {
  color: var(--orange, #f97316);
  text-decoration: none;
  font-weight: 600;
}
.quote-page .addr-manual-link:active { opacity: 0.7; }

/* ── Desktop / tablet (≥ 768px) ─────────────────────────────────── */
@media (min-width: 768px) {
  .quote-page { max-width: 640px; }
}
