/* ============================================================================
   DayFlowPro — adaptive-booking-form.css  (v2, frosted-glass system)
   Place at: assets/modules/adaptive-booking-form.css

   Rewritten to sit inside the new .dfp-modal glass panel. Colours now derive
   from the modal/theme tokens, so this section follows light/dark and every
   per-client --accent rebrand automatically. Same class names as v1 —
   the module's JS needs no changes.
   ========================================================================== */

.abf-root {
  /* Inherit from the modal system, with standalone fallbacks so the form
     still looks right if it's ever rendered outside a .dfp-modal. */
  --abf-accent:    var(--accent, #3B82F6);
  --abf-accent-soft: var(--accent-soft, rgba(59, 130, 246, 0.12));
  --abf-text:      var(--dfp-m-text, #16181D);
  --abf-muted:     var(--dfp-m-muted, #5B6472);
  --abf-hair:      var(--dfp-m-hair, rgba(16, 24, 40, 0.10));
  --abf-well:      var(--dfp-m-well, rgba(16, 24, 40, 0.035));
  --abf-panel:     var(--dfp-m-well, rgba(16, 24, 40, 0.035));
  --abf-field-bg:  var(--surface, #FFFFFF);
  --abf-danger:    #E0484A;
  --abf-caution:   #E08A0B;
  --abf-staff:     #8B5CF6;

  box-sizing: border-box;
  color: var(--abf-text);
  container-type: inline-size;
  display: grid;
  gap: 16px;
  min-width: 0;
  width: 100%;
  margin-bottom: 16px;
}

[data-theme="dark"] .abf-root {
  --abf-danger:  #F16A6A;
  --abf-caution: #F5A623;
  --abf-staff:   #A78BFA;
  --abf-field-bg: rgba(0, 0, 0, 0.26);
}

.abf-root *,
.abf-root *::before,
.abf-root *::after { box-sizing: border-box; }

/* ---- 1. Service template selector — the hero control -------------------- */
/* This is the feature that drives everything below it, so it gets the
   strongest treatment in the modal: accent-tinted, raised, wider radius. */
.abf-template {
  position: relative;
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 16px 16px 17px;
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--abf-accent) 26%, transparent);
  background:
    linear-gradient(
      160deg,
      color-mix(in srgb, var(--abf-accent) 11%, transparent) 0%,
      color-mix(in srgb, var(--abf-accent) 3%, transparent) 55%,
      transparent 100%
    ),
    var(--abf-well);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

/* Accent spine down the left edge */
.abf-template::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(
    180deg,
    var(--abf-accent),
    color-mix(in srgb, var(--abf-accent) 30%, transparent)
  );
}

.abf-template > label,
.abf-template .abf-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--abf-accent);
}

/* ---- 2. Fields ---------------------------------------------------------- */
.abf-field {
  display: grid;
  gap: 7px;
  min-width: 0;
  align-content: start;
}

.abf-template__select,
.abf-field input,
.abf-field select,
.abf-field textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  font: inherit;
  font-size: 14.5px;
  color: var(--abf-text);
  background: var(--abf-field-bg);
  border: 1px solid var(--dfp-m-well-hair, rgba(16, 24, 40, 0.13));
  border-radius: 12px;
  transition: border-color 160ms ease, box-shadow 200ms ease, background 160ms ease;
}

/* Custom chevron on every select in this form */
.abf-template__select,
.abf-field select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 40px;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238A93A2' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 17px 17px;
  cursor: pointer;
}

/* The hero select is a size larger than the rest. */
.abf-template__select {
  min-height: 52px;
  font-size: 15.5px;
  font-weight: 600;
  border-radius: 14px;
  border-color: color-mix(in srgb, var(--abf-accent) 32%, transparent);
}

.abf-field textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.55;
}

.abf-field input[type="checkbox"] {
  justify-self: start;
  width: 20px;
  min-height: 20px;
  height: 20px;
  padding: 0;
  accent-color: var(--abf-accent);
  cursor: pointer;
}

.abf-field input[type="file"] {
  min-height: 48px;
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
}
.abf-field input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 7px 13px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--abf-accent);
  background: var(--abf-accent-soft);
  border: 1px solid color-mix(in srgb, var(--abf-accent) 28%, transparent);
  border-radius: 999px;
  cursor: pointer;
}

.abf-template__select:hover:not([disabled]),
.abf-field input:hover:not([disabled]):not([type="checkbox"]),
.abf-field select:hover:not([disabled]),
.abf-field textarea:hover:not([disabled]) {
  border-color: color-mix(in srgb, var(--abf-accent) 44%, transparent);
}

.abf-template__select:focus-visible,
.abf-template__select:focus,
.abf-field input:focus-visible,
.abf-field input:focus,
.abf-field select:focus,
.abf-field textarea:focus {
  border-color: var(--abf-accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--abf-accent) 18%, transparent);
  outline: none;
}

.abf-field [disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

/* ---- 3. Sections -------------------------------------------------------- */
/* Distinct from the modal's base fields: recessed well, generous radius,
   and a small accent tick on the heading so grouped service fields read as
   their own layer rather than more of the same form. */
.abf-section {
  position: relative;
  min-width: 0;
  margin: 0;
  padding: 18px 16px 16px;
  border: 1px solid var(--abf-hair);
  border-radius: 20px;
  background: var(--abf-well);
}

.abf-section__title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 14px;
  padding: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--abf-muted);
}
.abf-section__title::before {
  content: "";
  flex: 0 0 auto;
  width: 3px;
  height: 13px;
  border-radius: 999px;
  background: var(--abf-accent);
}

/* If the module renders <fieldset><legend>, keep the legend inline-flowed so
   the flex heading rules above still apply cleanly. */
.abf-section > legend.abf-section__title {
  float: left;
  width: 100%;
}
.abf-section > legend.abf-section__title + * { clear: both; }

/* ---- 4. Grid ------------------------------------------------------------ */
.abf-grid {
  display: grid;
  gap: 14px 14px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
}

/* Let long-form fields claim the full row. */
.abf-field:has(textarea),
.abf-field--full { grid-column: 1 / -1; }

/* ---- 5. Labels & helper text ------------------------------------------- */
.abf-label {
  color: var(--abf-text);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: -0.005em;
  line-height: 1.35;
}

.abf-required {
  color: var(--abf-danger);
  font-weight: 700;
  margin-left: 2px;
}

.abf-help,
.abf-suffix {
  color: var(--abf-muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.abf-error {
  color: var(--abf-danger);
  font-size: 12px;
  font-weight: 600;
}

/* ---- 6. Flagged fields -------------------------------------------------- */
/* Sensitive / staff-only fields carry a coloured spine and a faint tint so
   the reason for the flag is legible at a glance, not just a bare stripe. */
.abf-field--sensitive,
.abf-field--staff {
  position: relative;
  padding: 10px 12px 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--abf-hair);
  border-left-width: 3px;
}

.abf-field--sensitive {
  border-left-color: var(--abf-caution);
  background: color-mix(in srgb, var(--abf-caution) 7%, transparent);
}

.abf-field--staff {
  border-left-color: var(--abf-staff);
  background: color-mix(in srgb, var(--abf-staff) 7%, transparent);
}

/* Tiny corner tag identifying the flag. */
.abf-field--sensitive > .abf-label::after,
.abf-field--staff > .abf-label::after {
  content: attr(data-flag);
  float: right;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.abf-field--sensitive > .abf-label::after {
  content: "Sensitive";
  color: var(--abf-caution);
  background: color-mix(in srgb, var(--abf-caution) 16%, transparent);
}
.abf-field--staff > .abf-label::after {
  content: "Staff only";
  color: var(--abf-staff);
  background: color-mix(in srgb, var(--abf-staff) 16%, transparent);
}

/* ---- 7. Recommended release callout ------------------------------------ */
.abf-release {
  grid-column: 1 / -1;
  margin: 0 0 4px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--abf-accent) 26%, transparent);
  border-left: 3px solid var(--abf-accent);
  background:
    linear-gradient(
      110deg,
      color-mix(in srgb, var(--abf-accent) 12%, transparent),
      color-mix(in srgb, var(--abf-accent) 4%, transparent)
    );
}

.abf-release__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--abf-accent);
}
.abf-release__title::before {
  content: "";
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  background: currentColor;
  /* Lucide file-signature glyph as a mask so it inherits the accent. */
  -webkit-mask: var(--abf-release-icon) center / contain no-repeat;
  mask: var(--abf-release-icon) center / contain no-repeat;
}
.abf-release {
  --abf-release-icon:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z'/%3E%3Cpath d='M14 2v4a2 2 0 0 0 2 2h4'/%3E%3Cpath d='M8 18h1'/%3E%3Cpath d='M12.5 15.5a1.5 1.5 0 0 1 3 0v3.5a1 1 0 0 1-1 1H8'/%3E%3C/svg%3E");
}

.abf-release__list {
  margin: 9px 0 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--abf-text);
}
.abf-release__list li::marker { color: var(--abf-accent); }
.abf-release__send {
  appearance: none;
  background: var(--abf-accent-soft);
  border: 1px solid var(--abf-accent);
  border-radius: 7px;
  color: var(--abf-accent);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
}

.abf-existing-files {
  margin: 4px 0 0;
  padding-left: 18px;
  color: var(--abf-muted);
  font-size: 12px;
  line-height: 1.55;
}

/* ---- 8. States ---------------------------------------------------------- */
.abf-empty,
.abf-loading,
.abf-error--block {
  margin: 0;
  padding: 20px 18px;
  border: 1px dashed var(--dfp-m-well-hair, rgba(16, 24, 40, 0.16));
  border-radius: 18px;
  background: var(--abf-well);
  color: var(--abf-muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.abf-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.abf-loading::before {
  content: "";
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--abf-accent) 28%, transparent);
  border-top-color: var(--abf-accent);
  animation: abfSpin 700ms linear infinite;
}
@keyframes abfSpin { to { transform: rotate(360deg); } }

.abf-field[hidden] { display: none; }

/* ---- 9. Responsive ------------------------------------------------------ */
/* Container query is the primary mechanism — the form reflows to the space it
   actually has, which matters because it lives in modals of several widths. */
@container (max-width: 560px) {
  .abf-grid { grid-template-columns: minmax(0, 1fr); }
  .abf-section { padding: 16px 14px 14px; }
  .abf-template { padding: 14px 14px 15px; }
}

/* Viewport fallback for browsers without container queries. */
@supports not (container-type: inline-size) {
  @media (max-width: 700px) {
    .abf-grid { grid-template-columns: minmax(0, 1fr); }
  }
}

@media (max-width: 640px) {
  .abf-root { gap: 14px; }

  /* Kills the iOS focus-zoom. */
  .abf-template__select,
  .abf-field input,
  .abf-field select,
  .abf-field textarea {
    font-size: 16px;
    min-height: 50px;
  }
  .abf-template__select { min-height: 54px; }
  .abf-field input[type="checkbox"] { min-height: 22px; height: 22px; width: 22px; }
}

/* ---- 10. Quality floor -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .abf-root *,
  .abf-root *::before,
  .abf-root *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto;
  }
}

/* Fallback for engines without color-mix(): flat tints instead of blends. */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .abf-template,
  .abf-release { background: var(--abf-accent-soft); }
  .abf-field--sensitive { background: rgba(224, 138, 11, 0.08); }
  .abf-field--staff { background: rgba(139, 92, 246, 0.08); }
}
