/*
 * PZ Property Search – base stylesheet.
 *
 * Extracted from the inline <style> block in pz_ps_footer_assets().
 *
 * Fixes applied vs the original Code Snippets source:
 *   1. Duplicate @media (max-width: 480px) blocks (lines 79, 333–349)
 *      merged into a single canonical block at the bottom.
 *   2. Duplicate @media (max-width: 1024px) blocks (lines 352–368)
 *      merged into a single canonical block at the bottom.
 *   3. Invalid colour #00FFFFFF on --pz-surface corrected to #ffffff
 *      (the leading 00 is an alpha byte valid in CSS color() but not
 *      as a hex colour literal in older browsers; intent is opaque white).
 *   4. Patch-comment noise removed; rules consolidated in logical order.
 *   5. All !important declarations kept where they defend against
 *      Elementor/theme style bleed — these are intentional.
 *
 * Custom overrides go in WP Admin > Settings > PZ Property Search.
 * They are appended via wp_add_inline_style() after this file loads,
 * so specificity order is always correct without touching this file.
 */

/* ============================================================
   CSS Custom Properties
   ============================================================ */
:root {
  /* Brand */
  --pz-accent:        #007DB9;
  --pz-accent-600:    #7a89c9;
  --pz-accent-700:    #6b7cc2;

  /* Neutrals */
  --pz-fg:            #0f172a;
  --pz-muted:         #5b647e;
  --pz-border:        #dfe3f6;
  --pz-border-strong: #cfd5ee;
  --pz-surface:       #ffffff;   /* was #00FFFFFF — corrected */
  --pz-surface-2:     #f7f8fe;

  /* Shape / sizes */
  --pz-radius:        14px;
  --pz-radius-sm:     8px;
  --pz-fs:            0.875rem;
  --pz-dd-fs:         0.95rem;
  --pz-label-fs:      0.8rem;
  --pz-field-h:       46px;
  --pz-gap:           14px;
}

/* ============================================================
   Search container & grid
   ============================================================ */
.pz-search {
  font-family: Lato, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: var(--pz-fs);
  color: var(--pz-fg);
  letter-spacing: 1px;
}

.pz-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--pz-gap);
  align-items: end;
  background: var(--pz-surface);
  border: 1px solid var(--pz-border);
  border-radius: var(--pz-radius);
  padding: 16px;
}

/* ============================================================
   Fields & labels
   ============================================================ */
.pz-field {
  position: relative;
}

.pz-field > label {
  display: block;
  margin: 0 0 6px;
  font-weight: 700;
  letter-spacing: 1px;
  font-size: var(--pz-label-fs);
  color: var(--pz-muted);
  text-transform: uppercase;
}

/* ============================================================
   Inputs & select buttons — base + hover/focus
   ============================================================ */
.pz-input,
.pz-select__button {
  width: 100%;
  height: var(--pz-field-h);
  padding: 0 12px;
  border-radius: var(--pz-radius-sm);
  border: 1px solid var(--pz-border);
  background: var(--pz-surface);
  color: var(--pz-fg);
  outline: none;
  transition: box-shadow .15s, border-color .15s, background .15s, color .15s;
  box-shadow: inset 0 0 0 1px transparent;
}

.pz-input:hover,
.pz-select__button:hover {
  border-color: var(--pz-border-strong);
  box-shadow: inset 0 0 0 2px var(--pz-accent);
}

.pz-select__button:focus,
.pz-select__button:focus-visible {
  border-color: var(--pz-accent) !important;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--pz-accent) 22%, transparent) !important;
}

/* SELECT — custom arrow, remove spinner on number inputs */
.pz-search select.pz-input {
  appearance: none;
  background-image:
    linear-gradient(45deg,  transparent 50%, var(--pz-muted) 50%),
    linear-gradient(135deg, var(--pz-muted) 50%, transparent 50%),
    linear-gradient(to right, transparent, transparent);
  background-position: calc(100% - 16px) 19px, calc(100% - 11px) 19px, 0 0;
  background-size: 6px 6px, 6px 6px, 100% 100%;
  background-repeat: no-repeat;
}

.pz-search input[type="number"].pz-input {
  background-image: none !important;
}

/* ============================================================
   Theme / Elementor hardening for inputs & buttons
   (keeps all controls visually identical regardless of active kit)
   ============================================================ */
#pz-search-root .pz-search .pz-input,
#pz-search-root .pz-search select.pz-input,
#pz-search-root .pz-search input.pz-input[type="text"],
#pz-search-root .pz-search input.pz-input[type="number"],
#pz-search-root .pz-search textarea.pz-input,
#pz-search-root .pz-search .pz-select__button {
  box-sizing: border-box !important;
  height: var(--pz-field-h) !important;
  line-height: calc(var(--pz-field-h) - 2px) !important;
  padding: 0 12px !important;
  border: 1px solid var(--pz-border) !important;
  border-radius: var(--pz-radius-sm) !important;
  background: var(--pz-surface) !important;
  color: var(--pz-fg) !important;
  font-size: var(--pz-fs) !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

#pz-search-root .pz-search .pz-input:hover,
#pz-search-root .pz-search .pz-input:focus,
#pz-search-root .pz-search .pz-select__button:hover,
#pz-search-root .pz-search .pz-select__button:focus,
#pz-search-root .pz-search .pz-select__button:focus-visible {
  border-color: var(--pz-accent) !important;
  box-shadow:
    inset 0 0 0 2px var(--pz-accent) !important,
    0 0 0 3px color-mix(in oklab, var(--pz-accent) 22%, transparent) !important;
  background: var(--pz-surface) !important;
  color: var(--pz-fg) !important;
  outline: none !important;
}

/* Re-apply SELECT arrow inside hardened scope */
#pz-search-root .pz-search select.pz-input {
  background-image:
    linear-gradient(45deg,  transparent 50%, var(--pz-muted) 50%),
    linear-gradient(135deg, var(--pz-muted) 50%, transparent 50%),
    linear-gradient(to right, transparent, transparent) !important;
  background-position: calc(100% - 16px) 19px, calc(100% - 11px) 19px, 0 0 !important;
  background-size: 6px 6px, 6px 6px, 100% 100% !important;
  background-repeat: no-repeat !important;
}

/* ============================================================
   Custom dropdown component
   ============================================================ */
.pz-select {
  position: relative;
}

.pz-select__button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
}

.pz-select__button::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: 10px;
  border-right: 2px solid var(--pz-muted);
  border-bottom: 2px solid var(--pz-muted);
  transform: rotate(45deg);
  transition: transform .12s;
}

.pz-select.open .pz-select__button::after {
  transform: rotate(-135deg);
}

#pz-search-root .pz-search .pz-select__button {
  border: 1px solid var(--pz-border) !important;
  border-radius: var(--pz-radius-sm) !important;
  background: var(--pz-surface) !important;
  color: var(--pz-fg) !important;
}

#pz-search-root .pz-search .pz-select__button:hover,
#pz-search-root .pz-search .pz-select__button:focus,
#pz-search-root .pz-search .pz-select__button:focus-visible {
  border-color: var(--pz-accent) !important;
  box-shadow:
    inset 0 0 0 2px var(--pz-accent) !important,
    0 0 0 3px color-mix(in oklab, var(--pz-accent) 22%, transparent) !important;
  background: var(--pz-surface) !important;
  color: var(--pz-fg) !important;
}

/* Dropdown menu */
.pz-select__menu {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 360px;
  overflow: auto;
  background: var(--pz-surface);
  border: 1px solid var(--pz-border);
  border-radius: var(--pz-radius);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
  padding: 6px;
  display: none;
  font-size: var(--pz-dd-fs);
}

.pz-select.open .pz-select__menu {
  display: block;
}

/* Location headers */
.pz-loc-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--pz-surface-2);
  color: var(--pz-muted);
  font-weight: 800;
  text-transform: uppercase;
  font-size: var(--pz-label-fs);
  padding: 8px 10px;
  margin: 4px;
  border-radius: 8px;
  border: 1px solid var(--pz-border);
  letter-spacing: 1px;
}

.pz-loc-section + .pz-loc-section {
  margin-top: 6px;
  padding-top: 6px;
}

/* ============================================================
   Options / chips
   ============================================================ */
.pz-option {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: 9px 12px;
  margin: 4px;
  border: 1px solid var(--pz-border);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  transition: .15s;
  font-size: var(--pz-dd-fs);
}

.pz-option input {
  width: 16px;
  height: 16px;
}

.pz-option input:checked ~ span {
  font-weight: 700;
  color: var(--pz-accent-700);
}

.pz-select__menu .pz-option {
  border: 0 !important;
  background: transparent;
  box-shadow: none;
  padding: 10px 12px;
}

.pz-select__menu .pz-option:hover {
  background: color-mix(in oklab, var(--pz-accent) 10%, #fff);
}

.pz-select__menu .pz-option:has(input:checked) {
  background: color-mix(in oklab, var(--pz-accent) 12%, #fff);
}

#pz-search-root .pz-search .pz-select__menu .pz-option:hover,
#pz-search-root .pz-search .pz-select__menu .pz-option:has(input:checked) {
  background: color-mix(in oklab, var(--pz-accent) 12%, #fff) !important;
  color: var(--pz-fg) !important;
  border-color: transparent !important;
}

#pz-search-root .pz-search .pz-option input:checked ~ span {
  color: var(--pz-accent-700) !important;
  font-weight: 700 !important;
}

/* Neutralise theme checkbox accent inside search root */
#pz-search-root .pz-search input[type="checkbox"] {
  accent-color: initial !important;
}

/* ============================================================
   Actions row & buttons
   ============================================================ */
.pz-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.pz-btn {
  padding: 0 18px;
  height: 44px;
  line-height: 42px;
  border-radius: var(--pz-radius-sm);
  font-weight: 400;
  letter-spacing: 1px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Search button — locked to brand blue across all states */
.pz-btn--search,
#pz-search-root .pz-search button.pz-btn--search,
#pz-search-root .pz-search button.pz-btn--search:link,
#pz-search-root .pz-search button.pz-btn--search:visited {
  background: var(--pz-accent) !important;
  color: #fff !important;
  border: 1px solid var(--pz-accent) !important;
  text-decoration: none !important;
  background-image: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease, border-color .15s ease;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

#pz-search-root .pz-search button.pz-btn--search:hover {
  background: var(--pz-accent) !important;
  color: #fff !important;
  border-color: var(--pz-accent) !important;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--pz-accent) 22%, transparent) !important;
}

#pz-search-root .pz-search button.pz-btn--search:focus,
#pz-search-root .pz-search button.pz-btn--search:focus-visible,
#pz-search-root .pz-search button.pz-btn--search:focus-within {
  background: var(--pz-accent) !important;
  color: #fff !important;
  border-color: var(--pz-accent) !important;
  outline: none !important;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--pz-accent) 22%, transparent) !important;
}

#pz-search-root .pz-search button.pz-btn--search:active {
  background: color-mix(in oklab, var(--pz-accent) 92%, black) !important;
  color: #fff !important;
  border-color: var(--pz-accent) !important;
  box-shadow: none !important;
}

/* Neutralise Elementor generic button overrides inside root */
#pz-search-root .pz-search .elementor-button,
#pz-search-root .pz-search .elementor-button:active,
#pz-search-root .pz-search .elementor-button:focus,
#pz-search-root .pz-search .elementor-button:hover {
  background: var(--pz-accent) !important;
  color: #fff !important;
  border-color: var(--pz-accent) !important;
}

/* Reset button */
.pz-btn--reset,
#pz-search-root .pz-search .pz-btn--reset {
  background: #fff !important;
  color: var(--pz-accent) !important;
  border: 1px solid var(--pz-accent) !important;
}

#pz-search-root .pz-search .pz-btn--reset:hover,
#pz-search-root .pz-search .pz-btn--reset:focus {
  background: var(--pz-accent) !important;
  color: #fff !important;
  border-color: var(--pz-accent) !important;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--pz-accent) 22%, transparent) !important;
}

/* ============================================================
   Toggle switches (Cat2/HEPPS & Residency Restrictions)
   ============================================================ */
#pz-search-root .pz-w3-switch {
  position: relative !important;
  display: inline-block !important;
  width: 60px !important;
  height: 34px !important;
  vertical-align: middle;
}

#pz-search-root .pz-w3-switch input {
  position: absolute !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  pointer-events: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

#pz-search-root .pz-w3-slider {
  position: absolute !important;
  inset: 0 !important;
  background: transparent !important;
  border: 1px solid var(--pz-accent) !important;
  border-radius: 34px !important;
  transition: .4s !important;
  box-shadow: none !important;
}

#pz-search-root .pz-w3-switch:hover .pz-w3-slider {
  border-color: var(--pz-accent-700) !important;
}

#pz-search-root .pz-w3-slider:before {
  content: "" !important;
  position: absolute !important;
  height: 26px !important;
  width: 26px !important;
  left: 4px !important;
  bottom: 4px !important;
  background: #fff !important;
  border: 1px solid var(--pz-accent) !important;
  border-radius: 50% !important;
  transition: .4s !important;
}

#pz-search-root .pz-w3-switch input:checked + .pz-w3-slider {
  background: var(--pz-accent) !important;
  border-color: var(--pz-accent) !important;
}

#pz-search-root .pz-w3-switch input:checked + .pz-w3-slider:before {
  transform: translateX(26px) !important;
  border-color: #fff !important;
}

#pz-search-root .pz-w3-switch input:focus + .pz-w3-slider {
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--pz-accent) 22%, transparent) !important;
  outline: none !important;
}

/* ============================================================
   Font-size overrides (ensure dropdown text is consistent)
   ============================================================ */
.pz-search .pz-select__button,
.pz-search .pz-select__menu,
.pz-search .pz-option,
.pz-search .pz-option span {
  font-size: var(--pz-dd-fs) !important;
  line-height: 1.25 !important;
}

.pz-search .pz-input {
  font-size: var(--pz-fs) !important;
}

/* ============================================================
   Layout helpers
   ============================================================ */
.pz-keywords {
  grid-column: span 2;
}

.pz-toggle-field {
  align-self: start;
}

#pz-location-wrap {
  display: flex;
  flex-direction: column;
}

#pz-location-wrap .pz-option {
  order: 0;
}

/* ============================================================
   Responsive — single canonical breakpoints
   (previously duplicated 3× in the original source)
   ============================================================ */

/* Tablets and below */
@media (max-width: 1024px) {
  #pz-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  #pz-grid .pz-keywords {
    grid-column: 1 !important;
  }

  .pz-loop-results {
    display: grid;
    grid-template-columns: 1fr !important;
  }
}

/* Phones */
@media (max-width: 480px) {
  :root {
    --pz-field-h: 42px;
  }

  .pz-btn {
    height: 42px;
    line-height: 40px;
  }
}
