/**
 * Listings redesign (helper B) — Communities page + State page.
 * Layout from the approved mockup (Communities.dc.html / Community.dc.html "Available Homes").
 * Loaded AFTER theme.css on available-homes/index.php and state/index.php only.
 * Accent = var(--primary-color) (operator brand); navy / cream / greys as in the mockup.
 */

.rb-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
    box-sizing: border-box;
}

/* ===== Cream hero: H1 left, state pills right ===== */
.rb-hero { background: var(--lt-cream, #FFF7ED); }
.rb-hero > .rb-wrap { padding-top: 48px; padding-bottom: 40px; }
.rb-hero-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
}
.rb-hero .rb-h1,
.rb-h1 {
    margin: 0;
    font-family: var(--lt-head, 'Plus Jakarta Sans', sans-serif);
    font-weight: 800;
    font-size: 46px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--lt-navy, #0D1B2A);
}
.rb-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
    font-size: 14px;
    color: var(--lt-muted, #4B5563);
}
.rb-breadcrumb a { color: var(--lt-link, #B45309); text-decoration: none; }
.rb-breadcrumb a:hover { text-decoration: underline; }
.rb-breadcrumb [aria-current] { color: var(--lt-navy, #0D1B2A); font-weight: 600; }

.rb-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.rb-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid var(--lt-line, #E5E7EB);
    background: #FFFFFF;
    color: #374151;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
    box-sizing: border-box;
}
.rb-pill:hover { border-color: var(--lt-navy, #0D1B2A); color: var(--lt-navy, #0D1B2A); }
.rb-pill.active {
    border-color: var(--lt-navy, #0D1B2A);
    background: var(--lt-navy, #0D1B2A);
    color: #FFFFFF;
    font-weight: 600;
}
.rb-pill:focus-visible { outline: 3px solid var(--primary-color, #FEA327); outline-offset: 2px; }

/* State switcher dropdown (replaces one pill per state; scales to 30+ states) */
.rb-state-menu { position: relative; }
.rb-state-toggle {
    display: inline-flex; align-items: center; gap: 10px;
    min-height: 44px; padding: 0 16px;
    border: 1.5px solid var(--lt-line, #E5E7EB); border-radius: 8px;
    background: #FFFFFF; color: var(--lt-navy, #0D1B2A);
    font-size: 14px; font-weight: 600; cursor: pointer; list-style: none;
}
.rb-state-toggle::-webkit-details-marker { display: none; }
.rb-state-toggle:hover { border-color: var(--primary-color, #FEA327); }
.rb-state-toggle:focus-visible { outline: 3px solid var(--primary-color, #FEA327); outline-offset: 2px; }
.rb-state-arrow { color: var(--lt-muted, #4B5563); transition: transform .2s ease; }
.rb-state-menu[open] .rb-state-arrow { transform: rotate(180deg); }
.rb-state-panel {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
    width: 260px; max-width: calc(100vw - 32px);
    background: #FFFFFF; border: 1px solid var(--lt-line, #E5E7EB); border-radius: 10px;
    box-shadow: 0 12px 32px rgba(13, 27, 42, .12); padding: 8px;
}
.rb-state-search {
    width: 100%; box-sizing: border-box; height: 40px; margin-bottom: 6px; padding: 0 12px;
    border: 1px solid var(--lt-line, #E5E7EB); border-radius: 8px; font: inherit; font-size: 14px;
}
.rb-state-list { display: flex; flex-direction: column; max-height: 320px; overflow-y: auto; }
.rb-state-item {
    display: block; padding: 10px 12px; border-radius: 6px;
    color: #374151; font-size: 14px; text-decoration: none;
}
.rb-state-item:hover { background: var(--lt-cream, #FFF7ED); color: var(--lt-navy, #0D1B2A); }
.rb-state-item.active { font-weight: 700; color: var(--lt-navy, #0D1B2A); background: var(--lt-cream, #FFF7ED); }
.rb-state-item[hidden] { display: none; }
@media (max-width: 768px) { .rb-state-panel { left: 0; right: auto; } }

/* ===== Community card grid ===== */
.rb-main { padding-top: 40px; padding-bottom: 80px; }
.rb-comm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: 24px;
}
/* .comm-card (kept for the map JS hooks) carries sidebar styles in available-homes.css — reset them. */
.rb-comm-card,
.rb-comm-card.comm-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    border: 1px solid var(--lt-line, #E5E7EB);
    border-radius: 18px;
    overflow: hidden;
    background: #FFFFFF;
    cursor: default;
    transition: box-shadow .2s ease, transform .2s ease;
}
.rb-comm-card.comm-card:last-child { border-bottom: 1px solid var(--lt-line, #E5E7EB); }
.rb-comm-card:hover,
.rb-comm-card.comm-card:hover {
    background: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(13, 27, 42, 0.10);
}
.rb-comm-card.comm-card.active { box-shadow: 0 0 0 3px var(--primary-color, #FEA327); }
.rb-comm-card.comm-card.hidden { display: none; }

.rb-comm-link {
    display: flex;
    flex-direction: column;
    flex: 1;
    color: #111827;
    text-decoration: none;
}
.rb-comm-link:hover, .rb-comm-link:focus { color: #111827; text-decoration: none; }
.rb-comm-link:focus-visible { outline: 3px solid var(--primary-color, #FEA327); outline-offset: -3px; }

.rb-comm-photo {
    position: relative;
    height: 200px;
    background: #F3F4F6;
    overflow: hidden;
}
.rb-comm-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rb-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    padding: 6px 10px;
    border-radius: 8px;
    background: #FFFFFF;
    color: var(--lt-navy, #0D1B2A);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    box-shadow: 0 1px 3px rgba(13, 27, 42, 0.08);
}
.rb-share-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: #FFFFFF;
    color: #374151;
    box-shadow: 0 2px 8px rgba(13, 27, 42, 0.12);
    cursor: pointer;
}
.rb-share-btn:hover { color: var(--lt-navy, #0D1B2A); }

.rb-comm-body {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}
.rb-comm-name {
    margin: 0;
    font-family: var(--lt-head, 'Plus Jakarta Sans', sans-serif);
    font-weight: 700;
    font-size: 20px;
    line-height: 1.3;
    color: var(--lt-navy, #0D1B2A);
}
.rb-comm-loc { font-size: 14px; color: #4B5563; }
.rb-comm-foot {
    margin-top: auto;
    padding-top: 8px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.rb-count-pill {
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--lt-cream, #FFF7ED);
    color: #92400E;
    font-size: 13px;
    font-weight: 600;
}
.rb-view-link { font-size: 14px; font-weight: 600; color: var(--lt-link, #B45309); }
.rb-comm-link:hover .rb-view-link { text-decoration: underline; }

/* ===== Map card (below the grid) ===== */
.rb-map-section { margin-top: 48px; }
.rb-map-card.communities-layout {
    display: block;
    height: 460px;
    min-height: 0;
    margin: 0;
    border: 1px solid var(--lt-line, #E5E7EB);
    border-radius: 18px;
    overflow: hidden;
}
.rb-map-card .communities-map.rb-map { height: 100%; width: 100%; }
.rb-map-card.communities-layout.fullscreen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    border: 0;
    border-radius: 0;
}

/* ===== State page sections ===== */
.rb-section { padding-top: 56px; }
.rb-section-first { padding-top: 40px; }
.rb-section-last { padding-bottom: 80px; }
.state-units.rb-section { padding-bottom: 0; }
.rb-h2 {
    margin: 0;
    font-family: var(--lt-head, 'Plus Jakarta Sans', sans-serif);
    font-weight: 800;
    font-size: 34px;
    line-height: 1.2;
    color: var(--lt-navy, #0D1B2A);
}
.rb-h2-gap { margin-bottom: 20px; }
.rb-section-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 20px;
}
.rb-section-count { margin: 4px 0 0; font-size: 14px; color: #4B5563; }

/* Filter row: labeled selects + range in a row, "Clear All" text button */
.rb-filter-row.units-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    padding: 0;
    margin: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
}
.rb-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}
.rb-filter-row.units-filter-bar select {
    min-height: 44px;
    min-width: 110px;
    padding: 0 32px 0 10px;
    border: 1px solid #D1D5DB !important;
    border-radius: 10px !important;
    font-family: inherit;
    font-size: 14px;
    color: #111827;
    background-color: #FFFFFF;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}
.rb-filter-row.units-filter-bar select:focus {
    outline: none;
    border-color: var(--primary-color, #FEA327) !important;
    box-shadow: 0 0 0 3px rgba(254, 163, 39, 0.20);
}
.rb-field-range input[type="range"] {
    width: 160px;
    min-height: 44px;
    margin: 0;
    accent-color: var(--primary-color, #FEA327);
    background: transparent;
}
.rb-filter-row .rb-clear.filter-clear {
    min-height: 44px;
    padding: 0 14px;
    border: 0;
    background: transparent;
    color: var(--lt-link, #B45309);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.rb-filter-row .rb-clear.filter-clear:hover { text-decoration: underline; }

.rb-units-grid.units-listing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: 20px;
}
.state-units .pagination-nav { margin-top: 32px; }

/* Testimonials ("What They Say") */
.rb-review-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 20px;
}
.rb-review {
    margin: 0;
    padding: 24px;
    border-radius: 18px;
    background: var(--lt-soft, #F9FAFB);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.rb-review blockquote { margin: 0; padding: 0; border: 0; font-size: 16px; line-height: 1.6; color: #374151; font-style: normal; }
.rb-review figcaption { display: flex; flex-direction: column; gap: 2px; }
.rb-review-name { font-weight: 600; font-size: 15px; color: #111827; }
.rb-review-prop { font-size: 13px; color: #4B5563; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .rb-wrap { padding-left: 16px; padding-right: 16px; }
    .rb-hero > .rb-wrap { padding-top: 32px; padding-bottom: 28px; }
    .rb-h1, .rb-hero .rb-h1 { font-size: 34px; }
    .rb-h2 { font-size: 28px; }
    .rb-hero-row { align-items: flex-start; flex-direction: column; gap: 16px; }
    .rb-main { padding-top: 28px; padding-bottom: 56px; }
    .rb-map-card.communities-layout { height: 340px; }
    .rb-section-head { flex-direction: column; align-items: stretch; }
    .rb-filter-row.units-filter-bar { display: grid; grid-template-columns: 1fr 1fr; flex-direction: row; align-items: end; }
    .rb-filter-row.units-filter-bar select { width: 100%; min-width: 0; }
    .rb-field-range { grid-column: 1 / -1; }
    .rb-field-range input[type="range"] { width: 100%; }
    .rb-filter-row .rb-clear.filter-clear { grid-column: 1 / -1; justify-self: start; padding-left: 0; }
    .rb-section-last { padding-bottom: 56px; }
}
