/* ── Community Type Grid — Homes Grid Style ─────────────────────────────── */

/* Wrapper */
.ctg-wrapper {
  width: 100%;
  box-sizing: border-box;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #333;
}

/* ── Filter wrapper ──────────────────────────────────────────────────────── */
.ctg-filter-wrap {
  margin-bottom: 8px;
}

/* ── Search bar container ────────────────────────────────────────────────── */
.ctg-search-bar {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 20px 14px;
  margin-bottom: 18px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}

/* Row 1: Sort By top bar */
.ctg-wrapper .ctg-sb-row1 {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  margin-bottom: 14px !important;
}
.ctg-sort {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ctg-sort label {
  font-size: 14px;
  font-weight: 500;
  color: #555;
  margin: 0;
  white-space: nowrap;
}
.ctg-sort-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.ctg-sort-select {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: none;
  padding: 0 20px 0 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  outline: none;
}
.ctg-sort-wrap > svg {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  color: #888;
  pointer-events: none;
}

/* Row 2: Filter table — no dividers, pill boxes per field */
.ctg-sb-row2 {
  border-top: none;
  padding-top: 0;
}
.ctg-wrapper .ctg-filter-table {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 8px 0 !important;
}
.ctg-wrapper .ctg-filter-table tr {
  display: table-row !important;
}
.ctg-wrapper .ctg-td {
  display: table-cell !important;
  vertical-align: bottom !important;
  padding: 0 !important;
  border: none !important;
}
.ctg-wrapper .ctg-td--search {
  width: 30% !important;
}
.ctg-wrapper .ctg-td--btn {
  width: 1px !important;
  white-space: nowrap !important;
}

/* Label above each pill */
.ctg-filter-label {
  font-size: 12px;
  font-weight: 600;
  color: #1a1a1a;
  white-space: nowrap;
  line-height: 1;
  margin-bottom: 6px;
}

/* Pill — the rounded bordered box containing each input/select */
.ctg-pill {
  display: flex;
  align-items: center;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 0 12px;
  height: 40px;
  gap: 6px;
  min-width: 0;
}
.ctg-pill:focus-within {
  border-color: #6c5ce7;
  background: #fff;
}

/* Text input inside pill */
.ctg-pill-input {
  flex: 1;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  font-family: inherit !important;
  font-size: 13px !important;
  color: #555 !important;
  min-width: 0;
  padding: 0 !important;
  line-height: 1;
  box-shadow: none !important;
  -webkit-appearance: none;
  appearance: none;
}
.ctg-pill-input::placeholder {
  color: #9ca3af !important;
}

/* Select inside pill */
.ctg-pill--select {
  cursor: pointer;
}
.ctg-pill-select {
  flex: 1;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  font-family: inherit !important;
  font-size: 13px !important;
  color: #555 !important;
  min-width: 0;
  padding: 0 !important;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  line-height: 1;
  box-shadow: none !important;
}

/* Icon span inside pill (wraps SVG to prevent font-icon injection) */
.ctg-pill-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  width: 16px !important;
  height: 16px !important;
  line-height: 1 !important;
  font-size: 0 !important;       /* kills any font icon character */
  letter-spacing: 0 !important;
}
.ctg-pill-icon svg {
  display: block !important;
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  overflow: visible !important;
}

/* Button group */
.ctg-btn-group {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  white-space: nowrap !important;
}

/* Search button */
.ctg-search-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  height: 40px !important;
  padding: 0 22px !important;
  background: #6c5ce7 !important;
  color: #fff !important;
  border: none !important;
  border-radius: 999px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  font-family: inherit !important;
  white-space: nowrap !important;
  line-height: 1 !important;
  transition: background 0.2s, transform 0.1s;
}
.ctg-search-btn:hover { background: #5a4bd1 !important; }
.ctg-search-btn:active { transform: scale(0.97); }

/* Clear button */
.ctg-clear-btn {
  display: inline-flex !important;
  align-items: center !important;
  height: 40px !important;
  padding: 0 18px !important;
  background: transparent !important;
  color: #6b7280 !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 999px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  font-family: inherit !important;
  white-space: nowrap !important;
  transition: border-color 0.2s, color 0.2s;
}
.ctg-clear-btn:hover {
  border-color: #6c5ce7 !important;
  color: #6c5ce7 !important;
}

/* Row 3: Showing count */
.ctg-sb-row3 {
  padding-top: 8px;
  border-top: none;
  margin-top: 8px;
}
.ctg-results-meta {
  font-size: 13px;
  color: #777;
  margin: 0;
}
.ctg-results-meta strong { color: #333; }
.ctg-results-meta--standalone {
  text-align: center;
  margin-bottom: 22px;
}

/* ── Grid ────────────────────────────────────────────────────────────────── */
.ctg-grid {
  display: grid;
  gap: 24px;
  transition: opacity 0.2s ease;
}
.ctg-grid--cols-1 {
  grid-template-columns: 1fr;
}
.ctg-grid--cols-2 {
  grid-template-columns: repeat(2, 1fr);
}
.ctg-grid--cols-3 {
  grid-template-columns: repeat(3, 1fr);
}
.ctg-grid--cols-4 {
  grid-template-columns: repeat(4, 1fr);
}
.ctg-grid.ctg-loading {
  opacity: 0.45;
  pointer-events: none;
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.ctg-card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
  height: 100%;
}
.ctg-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.13);
}

/* Image */
.ctg-card__img-wrap {
  display: block;
  width: 100%;
  height: 500px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  text-decoration: none;
  background: #e5e7eb;
  border-radius: 16px 16px 0 0;
}
.ctg-card__img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
  object-position: center !important;
  display: block !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  transition: transform 0.4s ease;
}
.ctg-card:hover .ctg-card__img { transform: scale(1.03); }
.ctg-card__img-ph {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #e5e7eb, #d1d5db);
}

/* Body */
.ctg-card__body {
  padding: 20px 20px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0;
}

/* Title */
.ctg-card__name {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 12px;
  line-height: 1.2;
}
.ctg-card__name a {
  color: #6c5ce7;
  text-decoration: none;
}
.ctg-card__name a:hover { text-decoration: underline; }

/* Divider */
.ctg-card__divider {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 0 0 14px;
}

/* Meta rows — each row is icon + text on one line, stacked vertically */
.ctg-card__meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.ctg-card__meta-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #374151;
  line-height: 1.3;
  width: 100%;
}
.ctg-card__meta-row span {
  flex: 1;
  min-width: 0;
}
.ctg-card__meta-row svg {
  flex-shrink: 0;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  max-width: 20px !important;
  display: block !important;
}
.ctg-card__meta-row svg::before,
.ctg-card__meta-row svg::after { content: none !important; display: none !important; }

/* Description */
.ctg-card__desc-block { margin-bottom: 16px; flex: 1; }
.ctg-card__desc-label {
  font-size: 14px;
  font-weight: 800;
  color: #1a1a2e;
  margin-bottom: 4px;
  letter-spacing: -0.1px;
}
.ctg-card__desc {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.6;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Footer */
.ctg-card__footer {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  margin-top: auto;
  padding-top: 8px;
}


/* Button */
.ctg-card__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #6c5ce7;
  color: #fff !important;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none !important;
  transition: background 0.2s, transform 0.1s;
  line-height: 1;
  border: none;
}
.ctg-card__btn:hover { background: #5a4bd1; transform: translateY(-1px); }
.ctg-card__btn svg {
  width: 16px !important;
  height: 16px !important;
  flex-shrink: 0;
  display: block !important;
}
.ctg-card__btn svg::before,
.ctg-card__btn svg::after { content: none !important; display: none !important; }

/* Share button — positioned absolute bottom-right of footer */
.ctg-card__share-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  height: 36px !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  color: #9ca3af !important;
  border-radius: 50% !important;
  transition: color 0.2s, background 0.2s !important;
  padding: 0 !important;
  position: absolute !important;
  bottom: 0 !important;
  right: 0 !important;
}
.ctg-card__share-btn:hover { color: #6c5ce7 !important; background: #f5f3ff !important; }
.ctg-card__share-btn svg {
  width: 18px !important;
  height: 18px !important;
  display: block !important;
}
.ctg-card__share-btn svg::before,
.ctg-card__share-btn svg::after { content: none !important; display: none !important; }

.ctg-grid--cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .ctg-grid--cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  .ctg-wrapper .ctg-filter-table,
  .ctg-wrapper .ctg-filter-table tbody,
  .ctg-wrapper .ctg-filter-table tr {
    display: block !important;
    width: 100% !important;
  }
  .ctg-wrapper .ctg-td {
    display: block !important;
    width: 100% !important;
    padding: 0 0 12px 0 !important;
    border-right: none !important;
    border-bottom: none !important;
    margin-bottom: 8px !important;
  }
  .ctg-wrapper .ctg-td--btn {
    border-bottom: none !important;
    padding: 4px 0 0 0 !important;
  }
  .ctg-btn-group {
    width: 100% !important;
  }
}
@media (max-width: 768px) {
  .ctg-grid--cols-2,
  .ctg-grid--cols-3,
  .ctg-grid--cols-4 {
    grid-template-columns: 1fr;
  }
}

/* ── Additional theme override protection ─────────────────────────────────── */
/* Prevent theme font icons overriding our SVGs */
.ctg-wrapper .ctg-field svg,
.ctg-wrapper .ctg-search-btn svg,
.ctg-wrapper .ctg-sort-wrap svg {
  font-family: inherit !important;
  speak: never !important;
  font-style: normal !important;
  font-variant: normal !important;
  text-transform: none !important;
  display: inline-block !important;
  width: 15px !important;
  height: 15px !important;
  max-width: 15px !important;
  max-height: 15px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  overflow: visible !important;
  vertical-align: middle;
}
/* Hide any ::before / ::after pseudo content injected by theme icon fonts */
.ctg-wrapper .ctg-field svg::before,
.ctg-wrapper .ctg-field svg::after {
  content: none !important;
  display: none !important;
}
/* Ensure the filter bar itself is a proper block */
.ctg-wrapper .ctg-search-bar {
  display: block !important;
}

/* ══ CTG Self-contained Filter Bar ══════════════════════════════════════════ */

.ctg-search-bar {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 20px 12px;
  margin-bottom: 18px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.04);
  box-sizing: border-box;
  width: 100%;
}

/* Top row: Rent/Sale + Sort */
.ctg-sb-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.ctg-rent-toggle { display: flex; align-items: center; gap: 6px; }
.ctg-toggle {
  background: none; border: none; padding: 4px 2px;
  font-size: 14px; font-weight: 500; color: #9ca3af;
  cursor: pointer; font-family: inherit; line-height: 1;
}
.ctg-toggle.chub-toggle--active { color: #6c5ce7; font-weight: 700; }
.ctg-toggle:hover { color: #6c5ce7; }
.ctg-divider { color: #d1d5db; font-size: 16px; }
.ctg-sort-wrap { display: flex; align-items: center; gap: 8px; }
.ctg-sort-wrap label { font-size: 14px; font-weight: 500; color: #555; margin: 0; white-space: nowrap; }
.ctg-sort-inner { position: relative; display: inline-flex; align-items: center; }
.ctg-sort-select {
  -webkit-appearance: none; appearance: none;
  background: transparent; border: none;
  padding: 0 20px 0 0; font-family: inherit;
  font-size: 14px; font-weight: 500; color: #333;
  cursor: pointer; outline: none;
}
.ctg-sort-inner > svg {
  position: absolute; right: 0; top: 50%;
  transform: translateY(-50%); pointer-events: none;
}

/* Filter row — flex, controlled widths, NO overflow hidden */
.ctg-filter-row {
  display: flex;
  align-items: flex-end;
  gap: 0;
  width: 100%;
  flex-wrap: nowrap;
}

.ctg-fcol {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 0;
  min-width: 0;
  padding-right: 12px;
  border-right: 1px solid #e5e7eb;
  box-sizing: border-box;
}
.ctg-fcol + .ctg-fcol { padding-left: 12px; }
.ctg-fcol--search { flex: 2 1 0; }
.ctg-fcol--divider { flex: 1.5 1 0; }
.ctg-fcol--btn {
  flex: 0 0 auto;
  border-right: none;
  padding-right: 0;
  padding-left: 16px;
  align-items: flex-end;
}

.ctg-flabel {
  font-size: 13px; font-weight: 600;
  color: #1a1a1a; white-space: nowrap;
  line-height: 1; display: block;
}

.ctg-finput-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  padding: 0 12px;
  height: 42px;
  box-sizing: border-box;
  width: 100%;
}
.ctg-finput-wrap:focus-within {
  border-color: #6c5ce7;
  box-shadow: 0 0 0 2px rgba(108,92,231,0.12);
}
.ctg-finput-wrap--select { cursor: pointer; }

.ctg-finput {
  flex: 1; border: none; outline: none;
  background: transparent; font-family: inherit;
  font-size: 14px; color: #333; min-width: 0;
  padding: 0;
}
.ctg-finput::placeholder { color: #9ca3af; }

.ctg-fselect {
  flex: 1; border: none; outline: none;
  background: transparent; font-family: inherit;
  font-size: 14px; color: #333; min-width: 0;
  padding: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}

/* Buttons */
.ctg-btn-group {
  display: flex; align-items: center;
  gap: 8px; white-space: nowrap;
}
.ctg-search-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 22px;
  background: #6c5ce7; color: #fff;
  border: none; border-radius: 8px;
  font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  white-space: nowrap; flex-shrink: 0;
  transition: background 0.2s;
}
.ctg-search-btn:hover { background: #5a4bd1; }

.ctg-adv-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 42px; padding: 0 16px;
  background: transparent; color: #374151;
  border: 1px solid #d1d5db; border-radius: 8px;
  font-size: 14px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  white-space: nowrap; flex-shrink: 0;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.ctg-adv-btn:hover,
.ctg-adv-btn--active {
  background: #6c5ce7; color: #fff; border-color: #6c5ce7;
}

/* Advanced panel */
.ctg-adv-panel {
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  margin-top: 14px; padding: 16px 0 8px;
}
.ctg-adv-label {
  display: block; font-size: 13px; font-weight: 600;
  color: #374151; margin-bottom: 10px;
}
.ctg-amenity-grid {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.ctg-amenity-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: #f3f4f6; border: 1px solid #e5e7eb;
  border-radius: 6px; cursor: pointer;
  font-size: 13px; color: #374151;
  transition: background 0.15s, border-color 0.15s;
}
.ctg-amenity-tag:has(input:checked) {
  background: #ede9fe; border-color: #6c5ce7; color: #4c3d9e;
}
.ctg-amenity-tag input { display: none; }

.ctg-adv-footer { margin-top: 12px; }
.ctg-adv-clear-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: #6b7280;
  border: 1px solid #d1d5db; border-radius: 6px;
  padding: 6px 14px; font-size: 13px;
  cursor: pointer; font-family: inherit;
  transition: color 0.2s, border-color 0.2s;
}
.ctg-adv-clear-btn:hover { color: #ef4444; border-color: #ef4444; }

/* Showing count */
.ctg-meta-row { margin-top: 10px; }
.ctg-results-meta { font-size: 14px; color: #6b7280; }
.ctg-results-meta strong { color: #374151; }

/* Responsive */
@media (max-width: 900px) {
  .ctg-filter-row { flex-wrap: wrap; }
  .ctg-fcol { flex: 1 1 140px; padding-right: 0; border-right: none; padding-left: 0; margin-bottom: 10px; }
  .ctg-fcol--btn { padding-left: 0; }
}


