/* Service listing pages only. Tailwind remains the main styling system. */
/* Shared field/input/focus styling lives in static/css/utilities.css. */

.form-field textarea {
  min-height: 120px;
}

.filter-chip-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.filter-chip {
  display: inline-flex;
  cursor: pointer;
  align-items: center;
  border-radius: var(--b4-radius-pill);
  border: 1px solid var(--b4-color-border);
  padding: 0.375rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--b4-color-text-muted);
}

.filter-chip-input:checked + .filter-chip {
  border-color: var(--b4-color-primary);
  background: var(--b4-color-success-bg);
  color: var(--b4-color-primary-dark);
}

.filter-chip-input:focus-visible + .filter-chip {
  outline: none;
  box-shadow:
    0 0 0 2px var(--b4-color-surface),
    0 0 0 4px var(--b4-color-primary);
}

.toggle-switch-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-switch {
  position: relative;
  display: inline-flex;
  height: 1.5rem;
  width: 2.75rem;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: var(--b4-radius-pill);
  background: var(--b4-color-border);
  transition: background-color var(--b4-duration-fast) var(--b4-ease-standard);
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 0.125rem;
  left: 0.125rem;
  height: 1.25rem;
  width: 1.25rem;
  border-radius: var(--b4-radius-pill);
  background: var(--b4-color-surface);
  box-shadow: var(--b4-shadow-card);
  transition: transform var(--b4-duration-fast) var(--b4-ease-standard);
}

.toggle-switch-input:checked + .toggle-switch {
  background: var(--b4-color-primary);
}

.toggle-switch-input:checked + .toggle-switch::after {
  transform: translateX(1.25rem);
}

.toggle-switch-input:focus-visible + .toggle-switch {
  outline: none;
  box-shadow:
    0 0 0 2px var(--b4-color-surface),
    0 0 0 4px var(--b4-color-primary);
}

/*
 * Browse Services polish. The search bar and "More Filters" used to be
 * two separate bordered/shadowed cards stacked with a gap - read as
 * two disconnected boxes rather than one search experience. Fixed by
 * making .search-panel the ONE visual card (border/shadow/radius all
 * live here, with overflow:hidden clipping its children's corners),
 * with .search-bar and the <details> "More Filters" content as flush,
 * borderless sections inside it, separated only by a thin border-top.
 */
.search-panel {
  overflow: hidden;
  border-radius: 1.25rem;
  border: 1px solid var(--b4-color-border);
  background: var(--b4-color-surface);
  /* --b4-shadow-raised (not the plain -card token) - the same
     elevated weight the premium hero band above it uses, documented
     since Phase 1 for exactly this kind of hero/KPI surface. */
  box-shadow: var(--b4-shadow-raised);
}

/*
 * A bold, always-visible primary search bar (Search/City/Sort)
 * inspired by booking-site search bars - segmented, ending in a
 * filled submit button. Category/Price/Available-only stay in the
 * "More Filters" disclosure below this, since those are secondary
 * refinements, not primary search intent. Inputs are styled via this
 * wrapping class (border:none, transparent) rather than adding
 * classes in forms.py, the same convention .form-field's own
 * boxed-input style already uses.
 */
.search-bar {
  display: flex;
  flex-direction: column;
  background: var(--b4-color-success-bg);
}

@media (min-width: 768px) {
  .search-bar {
    flex-direction: row;
    align-items: stretch;
  }
}

.search-bar-segment {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--b4-color-border);
  transition: background-color var(--b4-duration-fast) var(--b4-ease-standard);
}

.search-bar-segment:last-of-type {
  border-bottom: none;
}

@media (min-width: 768px) {
  .search-bar-segment {
    border-bottom: none;
    border-right: 1px solid var(--b4-color-border);
  }

  .search-bar-segment:last-of-type {
    border-right: none;
  }
}

.search-bar-segment:focus-within {
  background: var(--b4-color-page);
}

.search-bar-icon {
  height: 1.25rem;
  width: 1.25rem;
  flex-shrink: 0;
  color: var(--b4-color-primary);
}

.search-bar-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--b4-color-text-muted);
}

.search-bar-segment input,
.search-bar-segment select {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--b4-color-text);
  outline: none;
}

.search-bar-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  background: var(--b4-color-primary);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 700;
  transition: background-color var(--b4-duration-fast) var(--b4-ease-standard);
}

.search-bar-submit:hover {
  background: var(--b4-color-primary-dark);
}

/*
 * Smooth reveal for "More Filters" - progressive enhancement, no JS.
 * transition-behavior:allow-discrete lets a display:none<->block jump
 * animate in browsers that support it (paired with @starting-style
 * for the fade-in's start state); everywhere else this is simply
 * ignored and the panel shows/hides instantly, today's exact
 * behavior - never a regression, only ever a smoother upgrade.
 */
.search-panel-more {
  transition: opacity var(--b4-duration-base) var(--b4-ease-standard), display var(--b4-duration-base) allow-discrete;
}

details:not([open]) > .search-panel-more {
  display: none;
  opacity: 0;
}

details[open] > .search-panel-more {
  display: block;
  opacity: 1;
}

@starting-style {
  details[open] > .search-panel-more {
    opacity: 0;
  }
}

/*
 * Browse Services polish. Removable active-filter chips (reuses
 * .filter-chip's pill shape/spacing, but as a real link since each
 * one navigates to a query string with just that filter dropped -
 * not a form control like .filter-chip's radio inputs).
 */
.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border-radius: var(--b4-radius-pill);
  border: 1px solid var(--b4-color-primary);
  background: var(--b4-color-success-bg);
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--b4-color-primary-dark);
}

.active-filter-chip:hover {
  background: var(--b4-color-primary);
  color: #fff;
}

.active-filter-chip-clear {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--b4-color-text-muted);
  text-decoration: underline;
}

/*
 * Modernization Phase 7. Booking step indicator.
 *
 * Two steps, matching what the flow actually does: GET a date, then
 * POST slot + quantity + notes. Active state is carried by
 * aria-current="step" in the markup as well as this colour, so it is
 * never colour-only.
 */
.booking-step {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--b4-color-text-muted);
}

.booking-step-marker {
  display: inline-flex;
  height: 1.75rem;
  width: 1.75rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: var(--b4-radius-pill);
  border: 1px solid var(--b4-color-border);
  background: var(--b4-color-surface);
  font-size: 0.75rem;
  font-weight: 700;
}

.booking-step-current {
  color: var(--b4-color-primary-dark);
}

.booking-step-current .booking-step-marker {
  border-color: var(--b4-color-primary);
  background: var(--b4-color-success-bg);
  color: var(--b4-color-primary-dark);
}

.booking-step-done .booking-step-marker {
  border-color: var(--b4-color-primary);
  color: var(--b4-color-primary-dark);
}

/*
 * Slot chips reuse .filter-chip (Stage 10D) for the radio +
 * adjacent-sibling behaviour and focus ring; these rules only add the
 * larger hit area a time range needs. 44px min-height keeps the mobile
 * tap target honest.
 */
.slot-chip {
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
}

.slot-chip-input:checked + .slot-chip {
  border-width: 2px;
}
