/* Property Search Form — self-contained (Elementor Popup + standalone modal) */

.psf-wrap,
.psf-modal,
.psf-panel,
.psf-toast-host {
  --lh-header: #718fa1;
  --lh-border: #102735;
  --lh-active: #718fa1;
  --lh-hover: #102735;
  --lh-text: #333;
  --lh-field-bg: #f3f4f6;
  --lh-step-bg: #d6e4ec;
  --lh-btn-grey: #c8c8c8;
  font-family: "Helvetica Neue", Helvetica, Arial, "PingFang TC", "Microsoft JhengHei", sans-serif;
  color: var(--lh-text);
  box-sizing: border-box;
  line-height: 1.5;
}

.psf-wrap *,
.psf-modal *,
.psf-panel *,
.psf-toast-host *,
.psf-wrap *::before,
.psf-wrap *::after,
.psf-modal *::before,
.psf-modal *::after,
.psf-panel *::before,
.psf-panel *::after {
  box-sizing: border-box;
}

.psf-wrap .d-none,
.psf-wrap .psf-hidden,
.psf-modal .d-none,
.psf-modal .psf-hidden,
.psf-panel .d-none,
.psf-panel .psf-hidden,
.elementor-popup-modal .psf-wrap .d-none,
.elementor-popup-modal .psf-wrap .psf-hidden {
  display: none !important;
}

/* Beat Elementor resets */
.elementor-popup-modal .psf-wrap,
.elementor-shortcode .psf-wrap,
.psf-wrap {
  font-size: 16px !important;
  line-height: 1.5 !important;
  text-align: left !important;
}

.elementor-popup-modal .psf-wrap p,
.elementor-popup-modal .psf-wrap label,
.elementor-popup-modal .psf-wrap span,
.elementor-popup-modal .psf-wrap button,
.elementor-popup-modal .psf-wrap input,
.elementor-popup-modal .psf-wrap select,
.elementor-popup-modal .psf-wrap textarea,
.psf-wrap p,
.psf-wrap label,
.psf-wrap span,
.psf-wrap button,
.psf-wrap input,
.psf-wrap select,
.psf-wrap textarea {
  font-family: inherit !important;
  line-height: 1.5 !important;
  letter-spacing: normal !important;
}

.psf-modal-content .step-content {
  padding: 1rem 1.1rem !important;
}

.psf-modal-content .step-panel {
  margin: 0 !important;
}

.psf-modal-content .intro-text {
  margin: 0 0 1rem !important;
  font-size: 1rem !important;
}

.psf-modal-content .section-label {
  margin: 0 0 0.5rem !important;
  font-size: 1rem !important;
}

.psf-modal-content .form-floating,
.psf-modal-content .underline-field,
.psf-modal-content .search-type-group,
.psf-modal-content .row {
  margin-bottom: 0.75rem !important;
}

.psf-modal-content .mb-2 {
  margin-bottom: 0.75rem !important;
}

.psf-modal-content .mb-3 {
  margin-bottom: 1rem !important;
}

.psf-modal-content .mb-4 {
  margin-bottom: 1.25rem !important;
}

.psf-flex { display: flex; }
.psf-items-center { align-items: center; }
.psf-gap-2 { gap: 0.5rem; }

.psf-wrap .mb-0,
.psf-modal-content .mb-0 { margin-bottom: 0 !important; }
.psf-wrap .mb-2,
.psf-modal-content .mb-2 { margin-bottom: 0.5rem !important; }
.psf-wrap .mb-3,
.psf-modal-content .mb-3 { margin-bottom: 1rem !important; }
.psf-wrap .mb-4,
.psf-modal-content .mb-4 { margin-bottom: 1.5rem !important; }
.psf-wrap .p-3,
.psf-modal-content .p-3 { padding: 1rem !important; }
.psf-wrap .w-100,
.psf-modal-content .w-100 { width: 100% !important; }

.psf-modal-content .row {
  display: flex;
  flex-wrap: wrap;
  margin-left: -0.25rem;
  margin-right: -0.25rem;
}

.psf-modal-content .g-2 > * {
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.psf-modal-content .col-sm-4,
.psf-modal-content .col-sm-6,
.psf-modal-content .col-sm-8 {
  width: 100%;
}

@media (min-width: 576px) {
  .psf-modal-content .col-sm-4 { width: 33.333%; }
  .psf-modal-content .col-sm-6 { width: 50%; }
  .psf-modal-content .col-sm-8 { width: 66.666%; }
}

/* Trigger (modal mode only) */
.psf-trigger-wrap { display: inline-block; }

.psf-btn-open {
  background: var(--lh-header);
  color: #fff !important;
  border: 1px solid var(--lh-border);
  padding: 0.85rem 1.75rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 0.5rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(16, 39, 53, 0.25);
}

.psf-btn-open:hover {
  background: var(--lh-hover);
  color: #fff !important;
}

/* Standalone modal mode */
body.psf-modal-open { overflow: hidden; }

.psf-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999999;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.55);
}

.psf-modal.is-open { display: flex; }

.psf-modal-dialog {
  width: 100%;
  max-width: 800px;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Inline mode for Elementor Popup */
.psf-mode-inline {
  width: 100%;
}

.psf-panel {
  display: block;
  width: 100%;
}

.psf-panel-inner {
  width: 100%;
  max-width: 100%;
}

.psf-mode-inline .psf-modal-content {
  box-shadow: none;
}

/* Shared shell */
.psf-modal-content {
  background: #fff;
  border: 1px solid var(--lh-border);
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.psf-modal-header {
  background: var(--lh-header);
  border-bottom: 1px solid var(--lh-border);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1.25rem;
  color: #fff;
  text-align: left;
}

.psf-header-left,
.psf-header-right {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.psf-modal-content .header-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.psf-modal-content .header-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
}

.psf-modal-content .header-subtitle {
  font-size: 0.78rem;
  opacity: 0.9;
  line-height: 1.2;
  color: #fff;
}

.psf-modal-content .btn-phone {
  background: rgba(16, 39, 53, 0.2);
  color: #fff !important;
  border: 1px solid var(--lh-border);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 0.35rem 0.75rem;
  text-decoration: none;
  border-radius: 0.25rem;
}

.psf-modal-content .btn-phone:hover {
  background: rgba(16, 39, 53, 0.35);
  color: #fff !important;
}

.psf-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
  opacity: 0.9;
}

.psf-close:hover { opacity: 1; }

.psf-modal-body {
  background: #fff;
  padding: 0;
}

.psf-modal-content .intro-text {
  font-size: 1rem;
  color: var(--lh-text);
  margin: 0 0 0.75rem;
}

.psf-modal-content .section-label {
  display: block;
  font-weight: 600;
  color: var(--lh-text);
  margin-bottom: 0.5rem;
}

/* Tabs */
.psf-modal-content .search-type-group {
  display: flex;
  width: 100%;
  border: 1px solid var(--lh-border);
}

.psf-modal-content .search-type-group .btn {
  flex: 1;
  color: var(--lh-border);
  background: #fff;
  border: none;
  border-right: 1px solid var(--lh-border);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.55rem 0.5rem;
  border-radius: 0;
  cursor: pointer;
}

.psf-modal-content .search-type-group .btn:last-child { border-right: none; }

.psf-modal-content .search-type-group .btn:hover {
  color: #fff;
  background-color: var(--lh-hover);
}

.psf-modal-content .search-type-group .btn.active {
  color: #fff;
  background-color: var(--lh-active);
}

/* Form controls */
.psf-modal-content .form-floating { position: relative; }

.psf-modal-content .form-control,
.psf-modal-content .form-select {
  display: block !important;
  width: 100% !important;
  min-height: 3.25rem !important;
  height: auto !important;
  padding: 1.15rem 0.85rem 0.4rem !important;
  margin: 0 !important;
  font-size: 1rem !important;
  line-height: 1.5 !important;
  color: var(--lh-text) !important;
  background-color: var(--lh-field-bg) !important;
  border: 1px solid var(--lh-border) !important;
  border-radius: 0.25rem !important;
  outline: none !important;
  box-shadow: none !important;
  appearance: none !important;
  -webkit-appearance: none !important;
}

.psf-modal-content .form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23102735' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.psf-modal-content .form-floating {
  position: relative !important;
}

.psf-modal-content .form-floating > label {
  position: absolute !important;
  left: 0.85rem !important;
  top: 0.45rem !important;
  right: auto !important;
  bottom: auto !important;
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 0.72rem !important;
  font-weight: 500 !important;
  line-height: 1.2 !important;
  color: var(--lh-border) !important;
  background: transparent !important;
  pointer-events: none !important;
  transform: none !important;
  opacity: 1 !important;
}

.psf-modal-content .form-control:focus,
.psf-modal-content .form-select:focus {
  border-color: var(--lh-border);
  box-shadow: 0 0 0 0.15rem rgba(16, 39, 53, 0.15);
  background-color: #fff;
}

.psf-modal-content .form-control.is-invalid,
.psf-modal-content .underline-input.is-invalid {
  border-color: #dc3545;
}

.psf-modal-content .date-field .form-control { color-scheme: light; }

/* Underline fields (step 1 / 頂手 / 生意轉讓 如圖) */
.psf-modal-content .underline-field {
  background: var(--lh-field-bg) !important;
  padding: 0.75rem 0.85rem 0.35rem !important;
  border: none !important;
  border-radius: 0.15rem 0.15rem 0 0 !important;
  margin-bottom: 0.65rem !important;
}

.psf-modal-content .row .underline-field {
  margin-bottom: 0 !important;
  height: 100%;
}

.psf-modal-content .underline-input,
.psf-modal-content select.underline-input {
  border: none !important;
  border-bottom: 1px solid #9a9a9a !important;
  border-radius: 0 !important;
  background: transparent !important;
  padding: 0.35rem 0 !important;
  width: 100% !important;
  min-height: 1.75rem !important;
  height: auto !important;
  font-size: 1rem !important;
  line-height: 1.4 !important;
  color: var(--lh-text) !important;
  outline: none !important;
  box-shadow: none !important;
}

.psf-modal-content select.underline-input {
  padding-right: 1.5rem !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23102735' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.15rem center !important;
  cursor: pointer;
}

.psf-modal-content .underline-input:focus,
.psf-modal-content select.underline-input:focus {
  border-bottom-color: var(--lh-border) !important;
}

.psf-modal-content .underline-field.has-label {
  position: relative !important;
  padding: 1.2rem 0.85rem 0.4rem !important;
}

.psf-modal-content .underline-field.has-label .field-label {
  position: absolute !important;
  left: 0.85rem !important;
  top: 0.95rem !important;
  right: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  color: #8a8a8a !important;
  font-size: 1rem !important;
  font-weight: 400 !important;
  line-height: 1.3 !important;
  pointer-events: none !important;
  transform: none !important;
  background: transparent !important;
  transition: all 0.15s ease !important;
}

.psf-modal-content .underline-field.has-label .field-label .req { color: #e53935 !important; }

.psf-modal-content .underline-field.has-label .underline-input:focus ~ .field-label,
.psf-modal-content .underline-field.has-label .underline-input:not(:placeholder-shown) ~ .field-label,
.psf-modal-content .underline-field.has-select .field-label {
  top: 0.3rem !important;
  font-size: 0.72rem !important;
  color: #666 !important;
}

.psf-modal-content .underline-field.has-select .underline-input {
  padding-top: 0.15rem !important;
}

.psf-modal-content .date-field .underline-input {
  color-scheme: light;
}

/* Area row — 租/賣/頂手顯示，生意轉讓隱藏 */
.psf-modal-content [data-psf-area-wrap] {
  width: 100% !important;
}

/* 其他信息 textarea */
.psf-modal-content .psf-other-info {
  margin-bottom: 0 !important;
}

.psf-modal-content .psf-other-info textarea.underline-input {
  resize: vertical !important;
  min-height: 4.5rem !important;
  padding: 0.35rem 0 !important;
  line-height: 1.45 !important;
}

.psf-modal-content .psf-other-info.has-label textarea.underline-input:focus ~ .field-label,
.psf-modal-content .psf-other-info.has-label textarea.underline-input:not(:placeholder-shown) ~ .field-label {
  top: 0.3rem !important;
  font-size: 0.72rem !important;
  color: #666 !important;
}

/* Footer */
.psf-modal-content .step-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-top: 1px solid #e5e5e5;
  background: #fff;
}

.psf-modal-content .step-indicator {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.95rem;
  font-weight: 500;
}

.psf-modal-content .step-num.current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.25rem;
  background: var(--lh-step-bg);
  color: var(--lh-border);
  font-weight: 700;
}

.psf-modal-content .step-sep,
.psf-modal-content .step-total { color: #666; }

.psf-modal-content .btn-back-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--lh-border);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.psf-modal-content .btn-back-arrow:hover { color: var(--lh-header); }

.psf-modal-content .btn-next-page,
.psf-modal-content .btn-finish,
.elementor-popup-modal .psf-modal-content .btn-next-page,
.elementor-popup-modal .psf-modal-content .btn-finish {
  background: var(--lh-btn-grey) !important;
  color: #111 !important;
  border: 1px solid #b5b5b5 !important;
  font-weight: 600 !important;
  font-size: 1rem !important;
  line-height: 1.4 !important;
  padding: 0.5rem 1.35rem !important;
  border-radius: 0.2rem !important;
  min-width: 5.5rem !important;
  height: auto !important;
  cursor: pointer !important;
  display: inline-block !important;
  text-align: center !important;
  text-decoration: none !important;
  box-shadow: none !important;
}

.psf-modal-content .btn-next-page:hover { background: #b8b8b8; }

.psf-modal-content .btn-finish {
  background: #fff;
  color: #666;
  border: 1px solid #c8c8c8;
}

.psf-modal-content .btn-finish:hover:not(:disabled) {
  background: #f5f5f5;
  color: #333;
}

.psf-modal-content .btn-finish:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.psf-modal-content .step-indicator-block {
  background: var(--lh-step-bg);
  padding: 0.15rem 0.4rem;
}

.psf-modal-content .step-indicator-block .step-num.current {
  background: transparent;
  min-width: auto;
  height: auto;
  padding: 0;
}

/* Step 2 — 聯絡資料 + 同意條款 */
.psf-modal-content .psf-step2 .step-content {
  padding: 1.25rem 1.25rem 1rem !important;
}

.psf-modal-content .psf-step2 .underline-field {
  background: #f0f0f0 !important;
  margin-bottom: 0.55rem !important;
}

.psf-modal-content .psf-step2 .underline-field.has-label {
  padding: 1.15rem 0.9rem 0.4rem !important;
}

/* Consent */
.psf-modal-content .consent-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.75rem !important;
  margin: 1rem 0 !important;
}

.psf-modal-content .consent-item {
  display: flex !important;
  align-items: center !important;
  gap: 0.6rem !important;
  margin: 0 !important;
  cursor: pointer;
  font-size: 0.95rem !important;
  line-height: 1.4 !important;
  color: #333 !important;
  user-select: none;
}

.psf-modal-content .consent-item input {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.psf-modal-content .consent-box {
  flex: 0 0 1.15rem !important;
  width: 1.15rem !important;
  height: 1.15rem !important;
  border: 1px solid #b0b0b0 !important;
  background: #fff !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 0.1rem !important;
}

.psf-modal-content .consent-box::after {
  content: "" !important;
  width: 0.35rem !important;
  height: 0.65rem !important;
  border: solid #fff !important;
  border-width: 0 2px 2px 0 !important;
  transform: rotate(45deg) translate(-1px, -1px) !important;
  opacity: 0 !important;
}

.psf-modal-content .consent-item input:checked + .consent-box {
  background: #102735 !important;
  border-color: #102735 !important;
}

.psf-modal-content .consent-item input:checked + .consent-box::after {
  opacity: 1 !important;
}

.psf-modal-content .consent-item.is-invalid .consent-box {
  border-color: #dc3545 !important;
}

.psf-modal-content .consent-link {
  color: #0d6efd !important;
  text-decoration: none !important;
}

.psf-modal-content .consent-link:hover {
  text-decoration: underline !important;
}

.psf-modal-content .privacy-note {
  font-size: 0.8rem !important;
  color: #777 !important;
  line-height: 1.5 !important;
  margin: 0.25rem 0 0 !important;
}

.psf-modal-content .step-indicator-block {
  background: var(--lh-step-bg) !important;
  padding: 0.15rem 0.45rem !important;
}

.psf-modal-content .btn-finish {
  background: #fff !important;
  color: #666 !important;
  border: 1px solid #c8c8c8 !important;
}

.psf-modal-content .psf-form-message {
  margin-top: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.9rem;
}

.psf-modal-content .psf-form-message.is-error {
  background: #fdecea;
  color: #b71c1c;
  border: 1px solid #f5c2c7;
}

.psf-modal-content .psf-form-message.is-success {
  background: #e8f5e9;
  color: #1b5e20;
  border: 1px solid #c3e6cb;
}

.psf-modal-content input[type="number"]::-webkit-outer-spin-button,
.psf-modal-content input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.psf-modal-content input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Toast */
.psf-toast-host {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1000000;
}

.psf-toast {
  display: none;
  background: #198754;
  color: #fff;
  padding: 0.85rem 1.1rem;
  border-radius: 0.35rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  max-width: 360px;
}

.psf-toast.is-show { display: block; }

/* Elementor popup tweaks */
.elementor-popup-modal .psf-wrap {
  width: 100%;
  margin-left: 0 !important;
  margin-right: auto !important;
  text-align: left !important;
}

.elementor-popup-modal .psf-modal-content {
  border-radius: 0;
  margin-left: 0 !important;
  margin-right: auto !important;
}

.elementor-popup-modal .psf-modal-header,
.psf-modal-header {
  justify-content: flex-start !important;
}

.elementor-popup-modal .psf-modal-content .intro-text,
.elementor-popup-modal .psf-modal-content .section-label,
.psf-modal-content .intro-text,
.psf-modal-content .section-label {
  text-align: left !important;
}

@media (max-width: 575.98px) {
  .psf-modal-header { flex-wrap: wrap; }

  .psf-modal-content .btn-phone {
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
  }

  .psf-modal-content .search-type-group .btn {
    font-size: 0.85rem;
    padding: 0.45rem 0.25rem;
  }
}
