/* === NEVESTATE Country Search — aligned to theme system === */
/* Tokens: primary #A17E3F, primary-hover #7c6131, dark #0F172A, border #334155, muted #64748b */
/* Theme convention: border-radius: 0, font-weight 500, no uppercase, transparent bg on inputs */

/* Mounted INSIDE .country-properties (its own container handles width/padding) */
.country-search { padding: 0; margin: 24px 0 32px; background: transparent; }
.country-search__container { max-width: none; margin: 0; padding: 0; box-sizing: border-box; }
@media (max-width: 639px) {
  .country-search { margin: 16px 0 24px; }
}

/* === Form bar — narrower than the results grid === */
.country-search__form {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 0.9fr auto auto;
  gap: 12px;
  align-items: stretch;
  box-sizing: border-box;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
}

.country-search__field { position: relative; min-width: 0; }
.country-search__field--select::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid #334155;
  border-bottom: 1.5px solid #334155;
  transform: translateY(-75%) rotate(45deg);
  pointer-events: none;
}

.country-search__select {
  width: 100%;
  height: 48px;
  padding: 8px 36px 8px 16px;
  border: 1px solid #334155;
  border-radius: 0;
  background: transparent;
  font-family: Lato, Inter, sans-serif;
  font-size: 15px;
  line-height: 24px;
  color: #94a3b8;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: border-color .2s, color .2s;
  box-sizing: border-box;
}
.country-search__select:hover { border-color: #000; }
.country-search__select:focus { outline: none; border-color: #a17e3f; color: #000; }
.country-search__select:not(:invalid) { color: #000; }

/* More filters — outline gold */
.country-search__more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 20px;
  background: transparent;
  border: 2px solid #a17e3f;
  border-radius: 0;
  color: #a17e3f;
  font-family: Lato, Inter, sans-serif;
  font-size: 15px;
  line-height: 24px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
  text-transform: none;
}
.country-search__more:hover { background: #a17e3f; color: #fff; }
.country-search__more svg { flex-shrink: 0; }

.country-search__more .country-search__filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: #fff;
  color: #a17e3f;
  border: 1px solid currentColor;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  margin-left: 4px;
}
.country-search__more:hover .country-search__filter-count { background: #fff; color: #a17e3f; }

/* Search — filled gold */
.country-search__submit {
  height: 48px;
  padding: 0 32px;
  background: #a17e3f;
  border: 2px solid #a17e3f;
  border-radius: 0;
  color: #fff;
  font-family: Lato, Inter, sans-serif;
  font-size: 15px;
  line-height: 24px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
  text-transform: none;
}
.country-search__submit:hover { background: #7c6131; border-color: #7c6131; }
.country-search__submit:active { background: #6b541f; border-color: #6b541f; }

/* === Tablet === */
@media (max-width: 1023px) {
  .country-search__form { grid-template-columns: 1fr 1fr; gap: 10px; }
}

/* === Mobile === */
@media (max-width: 639px) {
  .country-search__form { grid-template-columns: 1fr; gap: 10px; }
  .country-search__more, .country-search__submit { width: 100%; }
}

/* === Results === */
.country-search__results-wrapper { margin-top: 32px; }

/* Meta aligns to the grid edges (same horizontal padding as the grid) */
.country-search__results-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 20px;
  padding: 0 64px;
  font-family: Lato, Inter, sans-serif;
  font-size: 15px;
  line-height: 24px;
  color: #0f172a;
  flex-wrap: wrap;
  gap: 12px;
}
@media (max-width: 1279px) {
  .country-search__results-meta { padding: 0; }
}
.country-search__total { font-weight: 600; }
.country-search__reset {
  background: none;
  border: none;
  color: #a17e3f;
  font-family: Lato, Inter, sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.country-search__reset:hover { color: #7c6131; }

/* Grid — mirrors the native .country-properties__grid (gap, padding, breakpoints) */
.country-search__results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  padding: 0 64px;
  min-height: 80px;
  transition: opacity .2s ease;
}
.country-search__results.is-loading { pointer-events: none; }

/* Skeleton cards while loading */
.country-search__skeleton-card {
  height: 380px;
  background-color: #f1f5f9;
  background-image: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.7) 50%, transparent 100%);
  background-repeat: no-repeat;
  background-size: 60% 100%;
  background-position: -60% 0;
  animation: cs-shimmer 1.3s ease-in-out infinite;
}
@keyframes cs-shimmer {
  to { background-position: 160% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .country-search__skeleton-card { animation: none; opacity: .6; }
}
@media (max-width: 639px) { .country-search__skeleton-card { height: 320px; } }

/* Meta state during loading */
.country-search__total.is-loading {
  color: #64748b;
  font-weight: 500;
}

/* Empty state — proper card, not just text */
.country-search__empty {
  grid-column: 1 / -1;
  padding: 64px 24px;
  text-align: center;
  color: #475569;
  font-family: Lato, Inter, sans-serif;
  font-size: 17px;
  line-height: 26px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
}
.country-search__empty p { margin: 0; }

@media (min-width: 768px) and (max-width: 1279px) {
  .country-search__results { grid-template-columns: repeat(2, 1fr); gap: 20px; padding: 0; }
}
@media (max-width: 767px) {
  .country-search__results { grid-template-columns: 1fr; gap: 20px; padding: 0; }
  .country-search__empty { padding: 48px 16px; font-size: 15px; line-height: 22px; }
}

.country-search__pagination { margin-top: 32px; display: flex; justify-content: center; }

/* When search is active, native Popular Properties grid/swiper/CTA hide
   (results take their place — same place, same width, no duplication) */
.country-properties.is-search-active .country-properties__grid,
.country-properties.is-search-active .country-properties__swiper,
.country-properties.is-search-active .country-properties__load-more,
.country-properties.is-search-active .country-properties__cta {
  display: none !important;
}

/* === Modal === */
.country-search__modal[hidden] { display: none !important; }
.country-search__modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.country-search__modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  cursor: pointer;
}
.country-search__modal-content {
  position: relative;
  background: #fff;
  border-radius: 0;
  padding: 32px;
  width: calc(100% - 32px);
  max-width: 720px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  box-shadow: 0 24px 64px rgba(15, 23, 42, .3);
  box-sizing: border-box;
}
.country-search__modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #64748b;
  transition: color .2s ease;
}
.country-search__modal-close:hover { color: #0f172a; }
.country-search__modal-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 28px;
  line-height: 32px;
  color: #0f172a;
  margin: 0 40px 24px 0;
  font-weight: 600;
}
.country-search__modal-section { margin-bottom: 28px; }
.country-search__modal-subtitle {
  font-family: 'LT Superior', Inter, sans-serif;
  font-size: 18px;
  line-height: 24px;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 14px;
}
.country-search__amenities {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 16px;
}
.country-search__amenity {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: Lato, Inter, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  color: #0f172a;
  cursor: pointer;
  padding: 4px 0;
}
.country-search__amenity input {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
  accent-color: #a17e3f;
  cursor: pointer;
}
.country-search__size { display: flex; align-items: center; gap: 12px; }
.country-search__size-input {
  flex: 1;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #334155;
  border-radius: 0;
  background: transparent;
  font-family: Lato, Inter, sans-serif;
  font-size: 15px;
  color: #000;
  box-sizing: border-box;
}
.country-search__size-input:focus { outline: none; border-color: #a17e3f; }
.country-search__size-divider { color: #64748b; font-size: 18px; }

/* Modal footer buttons — also aligned */
.country-search__modal-clear,
.country-search__modal-apply {
  min-width: 140px;
  height: 48px;
  padding: 0 28px;
  border-radius: 0;
  font-family: Lato, Inter, sans-serif;
  font-size: 15px;
  line-height: 24px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s ease;
  text-transform: none;
}
.country-search__modal-clear {
  background: transparent;
  border: 2px solid #334155;
  color: #0f172a;
}
.country-search__modal-clear:hover { background: #0f172a; color: #fff; }
.country-search__modal-apply {
  background: #a17e3f;
  border: 2px solid #a17e3f;
  color: #fff;
}
.country-search__modal-apply:hover { background: #7c6131; border-color: #7c6131; }

.country-search__modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid #e2e8f0;
  padding-top: 20px;
  margin-top: 8px;
}

@media (max-width: 639px) {
  .country-search__modal { align-items: stretch; justify-content: stretch; }
  .country-search__modal-content {
    width: 100%;
    max-width: none;
    height: 100vh;
    max-height: 100vh;
    padding: 20px 16px 24px;
  }
  .country-search__modal-title { font-size: 22px; line-height: 26px; margin-right: 44px; }
  .country-search__amenities { grid-template-columns: repeat(2, 1fr); }
  .country-search__modal-footer { flex-direction: column-reverse; }
  .country-search__modal-clear, .country-search__modal-apply { width: 100%; }
}

body.country-search-modal-open { overflow: hidden; }
