/* ==========================================================================
   Domovita - search results page (view=properties, tmpl/properties/default.php)
   Design critique fix-up, 2026-11-16.

   Loaded only by the properties view, after domovita.css (registerAndUseStyle,
   asset name com_domovita.search). Every rule is scoped under .dv-search-page,
   the class on that view's .domovita-container, so nothing here can leak onto
   other pages that share the domovita.css class names.

   Tokens: the shared design tokens are being added to domovita.css as custom
   properties; each var() below carries the literal fallback, so this file works
   before and after that lands.

   Where a rule needs !important it is because domovita.css already uses
   !important on the same property (the gold "primary rank" button list, the
   navy .dv-card-badge contrast rule); the extra .dv-search-page class gives the
   specificity to win.
   ========================================================================== */

/* ── 1. Type: homepage fonts ──────────────────────────────────────────────── */
.dv-search-page {
    font-family: var(--dv-font-body, Inter, system-ui, sans-serif);
}

.dv-search-page .domovita-header h1 {
    font-family: var(--dv-font-display, Georgia, 'Times New Roman', serif);
    font-weight: 500;
}

.dv-search-page .property-title,
.dv-search-page .property-title a {
    font-family: var(--dv-font-display, Georgia, 'Times New Roman', serif);
}

/* ── 2. Form controls: one consistent field style ─────────────────────────── */
.dv-search-page .search-filters {
    padding: 16px;
    margin-bottom: 16px;
}

.dv-search-page .search-filters .filter-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--dv-deep-navy, #1F3A5F);
}

.dv-search-page .search-filters select,
.dv-search-page .search-filters input[type="text"],
.dv-search-page .search-filters input[type="search"] {
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #C4CCD8;
    border-radius: 8px;
    background-color: #fff;
    color: #1F2A37;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.3;
    box-sizing: border-box;
}

/* Browser-default selects replaced with a styled field and a stroke chevron.
   data: is allowed by the site CSP img-src (web.config). */
.dv-search-page .search-filters select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231F3A5F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
}

.dv-search-page .search-filters select:focus,
.dv-search-page .search-filters input[type="text"]:focus {
    outline: none;
    border-color: var(--dv-btn-primary, #2F6FCC);
    box-shadow: 0 0 0 3px rgba(47, 111, 204, 0.2);
}

.dv-search-page .search-filters .dv-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    font-size: 15px;
    cursor: pointer;
}

.dv-search-page .search-filters .dv-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--dv-btn-primary, #2F6FCC);
}

/* ── 3. Natural-language search bar: the main edit control ────────────────── */
.dv-search-page .dv-ai-search-results-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 12px;
    align-items: start;
    margin-bottom: 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.dv-search-page .dv-ai-search-results-wrap .dv-ai-search-wrap label {
    font-size: 14px;
    line-height: 20px;
    margin-bottom: 4px;
    color: var(--dv-deep-navy, #1F3A5F);
}

.dv-search-page .dv-ai-search-results-wrap .dv-ai-input {
    min-height: 48px;
    font-family: inherit;
    font-size: 16px;
    border-radius: 8px;
}

/* "Filters (N)" - secondary button beside the search box. Its top margin is the
   label's fixed height (20px + 4px) so it lines up with the input. */
.dv-search-page .search-filters .dv-filters-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    margin-top: 24px;
    padding: 0 18px;
    background: #fff;
    color: var(--dv-deep-navy, #1F3A5F);
    border: 1px solid var(--dv-deep-navy, #1F3A5F);
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
}

.dv-search-page .search-filters .dv-filters-btn:hover {
    background: #F1F5FB;
    text-decoration: none;
}

.dv-search-page .search-filters .dv-filters-btn:focus-visible {
    outline: 3px solid rgba(47, 111, 204, 0.45);
    outline-offset: 2px;
}

.dv-search-page .search-filters .dv-filters-btn[aria-expanded="true"] {
    background: var(--dv-deep-navy, #1F3A5F);
    color: #fff;
}

/* The hidden attribute must win over the display set above (and the
   inline-flex in domovita.css): without JS the button stays out of the way. */
.dv-search-page .search-filters .dv-filters-btn[hidden] {
    display: none !important;
}

/* ── 4. The filter panel ──────────────────────────────────────────────────────
   domovita.css collapses .dv-traditional-filters with max-height:0 for everyone,
   which left the filters unreachable without JS. Here the panel is OPEN by
   default; the inline script in the template adds .dv-js-collapsible straight
   after the panel opens, and only then is it closed until the button opens it. */
.dv-search-page .search-filters .dv-traditional-filters {
    max-height: none;
    opacity: 1;
    overflow: visible;
    transition: none;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #E2E6EA;
}

.dv-search-page .search-filters .dv-traditional-filters.dv-js-collapsible:not(.visible) {
    display: none;
}

.dv-search-page .search-filters .dv-traditional-filters .filter-row {
    gap: 12px 16px;
    margin-bottom: 12px;
}

/* ── 5. Buttons: primary search, secondary Surprise Me ────────────────────── */
.dv-search-page .search-filters .dv-filter-actions {
    gap: 10px;
    flex-wrap: wrap;
}

.dv-search-page .search-filters .btn-search {
    min-height: 44px;
    padding: 0 24px;
    background: var(--dv-btn-primary, #2F6FCC) !important;
    color: #fff !important;
    border: 1px solid var(--dv-btn-primary, #2F6FCC) !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    transform: none;
}

.dv-search-page .search-filters .btn-search:hover,
.dv-search-page .search-filters .btn-search:focus-visible {
    background: var(--dv-btn-primary-hover, #255BA8) !important;
    border-color: var(--dv-btn-primary-hover, #255BA8) !important;
    color: #fff !important;
    transform: none;
}

.dv-search-page .search-filters .dv-btn-surprise {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    background: #fff;
    color: var(--dv-deep-navy, #1F3A5F);
    border: 1px solid var(--dv-deep-navy, #1F3A5F);
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    box-shadow: none;
    transform: none;
}

.dv-search-page .search-filters .dv-btn-surprise:hover,
.dv-search-page .search-filters .dv-btn-surprise:focus-visible {
    background: #F1F5FB;
    color: var(--dv-deep-navy, #1F3A5F);
    box-shadow: none;
    transform: none;
    text-decoration: none;
}

/* ── 6. Save-search bar: drop the card chrome domovita.css gives it ───────── */
.dv-search-page .dv-save-search-bar {
    max-width: none;
    margin: 0 0 12px !important;
    padding: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

/* ── 7. Result cards: data badges first, feature chips demoted ────────────── */
.dv-search-page .dv-card-data {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.dv-search-page .dv-card-data .dv-card-badge,
.dv-search-page .dv-card-extras .dv-card-badge {
    font-size: 12px;
    line-height: 1.4;
    padding: 3px 8px;
    border-radius: 6px;
}

/* Data badge: light ground, navy text (about 11:1). Beats the global navy
   .dv-card-badge !important rule on specificity. */
.dv-search-page .dv-card-badge.dv-card-badge-data {
    background: #EEF3FA !important;
    color: var(--dv-deep-navy, #1F3A5F) !important;
    border: 1px solid #C9D6E8;
}

.dv-search-page .dv-card-features {
    margin-top: 8px;
}

.dv-search-page .dv-card-features .dv-smart-tag {
    padding: 2px 8px;
    background: transparent;
    border: 1px solid #E2E6EA;
    color: #4A5565;
    font-size: 12px;
}

.dv-search-page .property-image.dv-property-image--empty {
    color: rgba(255, 255, 255, 0.75);
}

/* Ofcom attribution under the grid (shown only when a broadband badge is). */
.dv-search-page .dv-search-ofcom {
    margin: 20px 0 8px;
    padding: 12px 16px;
    background: #F8FAFC;
    border: 1px solid #E2E6EA;
    border-radius: 8px;
}

.dv-search-page .dv-search-ofcom-note {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #374151;
}

/* ── 8. Small screens ─────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .dv-search-page .dv-ai-search-results-wrap {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 8px;
    }

    .dv-search-page .search-filters .dv-filters-btn {
        margin-top: 0;
        width: 100%;
    }

    .dv-search-page .search-filters .btn-search,
    .dv-search-page .search-filters .dv-btn-surprise {
        width: 100%;
        justify-content: center;
    }
}
