.cfe-tour-search {
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: #ffffff;
  border: 1px solid #e5e7f0;
  border-radius: 16px;
  padding: 20px;
}

/* Header */
.cfe-ts-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid #eef0f6;
}

.cfe-ts-header-icon {
  display: flex;
  color: #6b7280;
}

.cfe-ts-header-title {
  margin: 0;
  font-size: 16px !important;
  color: #20263a !important;
  flex: 1;
}

.cfe-ts-reset {
  background: none;
  border: 1px solid transparent;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  color: #9aa0ac;
  cursor: pointer;
}

.cfe-ts-reset:hover,
.cfe-ts-reset:focus-visible {
  background: none;
  border-color: transparent;
  color: #4b5563;
}

/* Field chung */
.cfe-ts-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.cfe-ts-field > label {
  font-size: 13px;
  font-weight: 700;
  color: #20263a;
}

.cfe-ts-field select,
.cfe-ts-field input[type="text"],
.cfe-ts-field input[type="number"] {
  border: 1px solid #e5e7f0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  color: #20263a;
  background: #ffffff;
  width: 100%;
}

.cfe-ts-dest[hidden] {
  display: none;
}

/* Ngày đi */
.cfe-ts-date-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid #e5e7f0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  color: #20263a;
  background: #ffffff;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.cfe-ts-date-trigger:hover,
.cfe-ts-date-trigger:focus,
.cfe-ts-date-trigger:focus-visible {
  background: #ffffff;
  border-color: #9aa0ac;
  color: #20263a;
}

.cfe-ts-date-trigger svg {
  flex: none;
  color: #9aa0ac;
}

.cfe-ts-datepicker {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: 300px;
  max-width: 90vw;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(20, 25, 60, 0.18);
  padding: 16px;
}

.cfe-dp-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.cfe-dp-nav {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: #f4f5fa;
  color: #20263a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.cfe-dp-nav:hover,
.cfe-dp-nav:focus-visible {
  background: #f4f5fa;
  border-color: #9aa0ac;
  color: #20263a;
}

.cfe-dp-nav[disabled] {
  opacity: 0.35;
  cursor: default;
}

.cfe-dp-title {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #f4f5fa;
  border: 1px solid transparent;
  border-radius: 100px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 700;
  color: #20263a;
  cursor: pointer;
}

.cfe-dp-title:hover,
.cfe-dp-title:focus,
.cfe-dp-title:focus-visible {
  background: #f4f5fa;
  border-color: #9aa0ac;
  color: #20263a;
}

.cfe-dp-title-divider {
  width: 1px;
  height: 14px;
  background: #c7cad4;
}

.cfe-dp-weekdays,
.cfe-dp-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cfe-dp-weekday {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #9aa0ac;
  padding: 4px 0;
}

.cfe-dp-weekday.is-weekend {
  color: #6b7280;
}

.cfe-dp-day,
.cfe-dp-cell {
  border: 1px solid transparent;
  background: none;
  border-radius: 10px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #20263a;
  cursor: pointer;
}

.cfe-dp-day:hover:not([disabled]),
.cfe-dp-day:focus-visible:not([disabled]),
.cfe-dp-cell:hover:not([disabled]),
.cfe-dp-cell:focus-visible:not([disabled]) {
  background: #f4f5fa;
  color: #20263a;
  border-color: #9aa0ac;
}

.cfe-dp-day.is-weekend {
  color: #6b7280;
}

.cfe-dp-day.is-today {
  box-shadow: inset 0 -2px 0 #9aa0ac;
}

.cfe-dp-day.is-selected {
  background: #374151;
  color: #ffffff;
  box-shadow: none;
}

.cfe-dp-day[disabled],
.cfe-dp-cell[disabled] {
  background: #ffffff;
  color: #d3d6de;
  cursor: default;
}

.cfe-dp-months,
.cfe-dp-years {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.cfe-dp-cell {
  aspect-ratio: auto;
  padding: 10px 0;
  font-weight: 600;
}

/* Radio (Loại tour) */
.cfe-ts-radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cfe-ts-radio {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #e5e7f0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  color: #20263a;
  cursor: pointer;
}

.cfe-ts-radio:hover {
  border-color: #9aa0ac;
}

.cfe-ts-radio:has(input:checked) {
  border-color: #9aa0ac;
  background: #f4f5fa;
  color: #20263a;
  font-weight: 700;
}

.cfe-ts-radio input {
  accent-color: #3a4b98;
}

.cfe-ts-radio input:focus-visible {
  outline: 2px solid #9aa0ac;
  outline-offset: 2px;
}

/* "Loại tour" / "Điểm đến" bị khoá theo ngữ cảnh trang archive hiện tại
   (xem CFE_Widget_Tour_Search_Form::get_archive_lock_context()) — vẫn hiện
   rõ lựa chọn đang chọn nhưng không cho tương tác. */
.cfe-ts-radio:has(input:disabled) {
  cursor: default;
  opacity: 0.85;
}

.cfe-ts-radio:has(input:disabled):hover {
  border-color: #e5e7f0;
}

.cfe-ts-dest[disabled] {
  cursor: default;
  opacity: 0.7;
  background: #f4f5fa;
}

.cfe-ts-lock-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: #9aa0ac;
  font-style: italic;
}

/* Checkbox (Khách sạn / Phương tiện / Hãng bay) */
.cfe-ts-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cfe-ts-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #20263a;
  cursor: pointer;
}

.cfe-ts-checkbox input {
  accent-color: #3a4b98;
  width: 16px;
  height: 16px;
  flex: none;
}

.cfe-ts-checkbox input:focus-visible {
  outline: 2px solid #9aa0ac;
  outline-offset: 2px;
}

.cfe-ts-checkbox-count {
  color: #9aa0ac;
  font-size: 13px;
}

/* Ngân sách (range slider) */
.cfe-ts-price-slider {
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
}

.cfe-ts-price-track {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 4px;
  background: #e5e7f0;
}

.cfe-ts-price-fill {
  position: absolute;
  height: 100%;
  border-radius: 4px;
  background: #374151;
}

.cfe-ts-price-handle {
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  margin: 0;
  background: none;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
}

.cfe-ts-price-handle::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  pointer-events: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #374151;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(20, 25, 60, 0.25);
}

.cfe-ts-price-handle::-moz-range-thumb {
  pointer-events: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #374151;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(20, 25, 60, 0.25);
}

.cfe-ts-price-handle:focus-visible::-webkit-slider-thumb {
  border-color: #9aa0ac;
}

.cfe-ts-price-handle:focus-visible::-moz-range-thumb {
  border-color: #9aa0ac;
}

.cfe-ts-price-handle::-webkit-slider-runnable-track {
  background: none;
}

.cfe-ts-price-handle::-moz-range-track {
  background: none;
}

.cfe-ts-price-labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
}

/* Submit */
.cfe-ts-submit {
  background: #374151;
  color: #ffffff;
  border: 1px solid #374151;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: 8px;
  cursor: pointer;
}

.cfe-ts-submit:hover,
.cfe-ts-submit:focus-visible {
  background: #374151;
  border-color: #9aa0ac;
}

.cfe-ts-submit[disabled],
.cfe-ts-reset[disabled] {
  opacity: 0.6;
  cursor: default;
}

/* =========================================================================
   Mobile: form thu gọn thành 1 thanh tóm tắt, bấm vào mở dialog (bottom
   sheet) — cùng 1 <form>, chỉ đổi cách hiển thị qua CSS + JS toggle class
   ".is-open" trên ".cfe-ts-widget" (xem tour-search-form.js). Trên desktop,
   các phần tử mobile-only này ẩn hoàn toàn, form hiện bình thường như cũ.
   ========================================================================= */

.cfe-ts-summary,
.cfe-ts-modal-backdrop,
.cfe-ts-modal-cancel,
.cfe-ts-title-mobile {
  display: none;
}

.cfe-ts-modal-footer .cfe-ts-submit {
  width: 100%;
}

@media (max-width: 782px) {
  .cfe-ts-widget {
    position: relative;
  }

  /* Thanh tóm tắt thay thế hoàn toàn vị trí form trên mobile */
  .cfe-ts-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    background: #ffffff !important;
    border: 1px solid #e5e7f0;
    border-radius: 6px;
    padding: 14px 16px !important;
    cursor: pointer;
    font: inherit;
    text-align: left;
    color: inherit;
  }

  .cfe-ts-summary-body {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
  }

  .cfe-ts-summary-route {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    font-weight: 700;
    color: #20263a;
    overflow: hidden;
    white-space: nowrap;
  }

  .cfe-ts-summary-route svg {
    flex: none;
    color: #9aa0ac;
  }

  .cfe-ts-summary-from,
  .cfe-ts-summary-to {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 120px;
  }

  .cfe-ts-summary-label {
    font-weight: 500;
    color: #6b7280;
  }

  .cfe-ts-summary-date {
    font-size: 13px;
    font-weight: 700;
    color: var(--cfe-ts-accent, #c82129);
  }

  .cfe-ts-summary-edit {
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f4f5fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cfe-ts-accent, #c82129);
  }

  /* Tiêu đề dialog riêng cho mobile, thay cho tiêu đề "Bộ lọc" của sidebar
     desktop; icon ẩn đi cho gọn, "Đặt lại" vẫn giữ để đổi lại filter. */
  .cfe-ts-title-desktop {
    display: none;
  }

  .cfe-ts-title-mobile {
    display: inline;
  }

  .cfe-ts-header-icon {
    display: none;
  }

  /* Nền mờ phía sau dialog */
  .cfe-ts-modal-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 18, 36, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 1000;
  }

  /* Form trở thành dialog kiểu bottom-sheet, trượt lên từ dưới */
  .cfe-tour-search {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    max-height: 88vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 0.28s ease;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .cfe-ts-widget.is-open .cfe-ts-modal-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .cfe-ts-widget.is-open .cfe-tour-search {
    transform: translateY(0);
  }

  .cfe-ts-modal-footer {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .cfe-ts-modal-cancel {
    display: block;
    flex: none;
    background: none;
    border: 1px solid transparent;
    color: #6b7280;
    font-weight: 700;
    font-size: 14px;
    padding: 12px 14px;
    cursor: pointer;
  }

  .cfe-ts-modal-footer .cfe-ts-submit {
    flex: 1;
    width: auto;
  }
}

/* Khoá cuộn trang nền khi dialog mobile đang mở */
body.cfe-ts-modal-open {
  overflow: hidden;
}
