/* ====================================================
   SEARCH RESULTS PAGE CSS — Pixel-perfect reference match
   ==================================================== */

/* ── Variables (greens from design-tokens.css, grays scoped here) ── */
#search-results-page {
    --green: var(--rs-green);
    --green-dark: var(--rs-green-dark);
    --green-light: var(--rs-green-light);
    --dark: var(--rs-text);
    --white: #ffffff;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #adb5bd;
    --gray-500: #6c757d;
    --gray-600: #495057;
    --gray-700: #343a40;
    --gray-800: #212529;
    --radius: 8px;
    --shadow-card: 0 1px 3px rgba(0,0,0,.06);
    font-family: var(--rs-font);
}

/* ── Page background: PURE WHITE everywhere ── */
body.search,
body.archive,
body.page-template-search-page,
body.geodir-page-search {
    background: #fff !important;
    background-color: #fff !important;
}
body.search .site,
body.search #page,
body.search #content,
body.search .site-content,
body.search .wrap,
body.search #wrapper,
body.archive .site,
body.archive #page,
body.archive #content,
body.archive .site-content,
body.archive .wrap,
body.archive #wrapper {
    background: #fff !important;
    background-color: #fff !important;
}
#search-results-page {
    background: #fff;
    padding-bottom: 60px;
}

/* ──────────────────────────────
   CATEGORY INFO BANNER
   ────────────────────────────── */
.category-info-banner {
    padding: 24px 0 8px;
}
.category-title {
    font-size: 24px;
    font-weight: 700;
    color: #212529;
    margin: 0 0 8px;
    line-height: 1.3;
}
.category-desc {
    font-size: 14px;
    color: #555;
    margin: 0;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.category-desc .fa-check-circle {
    color: #08aa4e;
    font-size: 16px;
    margin-top: 2px;
    flex-shrink: 0;
}

/* ──────────────────────────────
   SEARCH BAR
   ────────────────────────────── */
.search-bar-section {
    background: #fff;
    padding: 16px 0 14px;
}
.search-bar-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.search-results-form .search-input-group {
    display: flex;
    align-items: stretch;
    gap: 10px;
}
.btn-category {
    display: flex; align-items: center; gap: 8px;
    background: var(--green); color: #fff;
    border: none; padding: 12px 20px;
    font-size: 14px; font-weight: 600;
    cursor: pointer; white-space: nowrap;
    border-radius: 6px;
    transition: background .2s;
}
.btn-category:hover { background: var(--green-dark); }
.btn-category .fa-bars { font-size: 13px; }
.btn-category .fa-chevron-down { font-size: 10px; opacity: .7; }

.search-input-group .search-input-wrap {
    flex: 1; position: relative;
}
.search-input-group .search-input-wrap input {
    width: 100%;
    border: 1px solid var(--gray-300);
    border-radius: 6px; outline: none;
    padding: 12px 16px; font-size: 14px;
    background: #fff; color: var(--gray-700);
    height: 100%; box-sizing: border-box;
}
.search-input-group .search-input-wrap input:focus {
    border-color: var(--green);
}
.search-input-group .search-input-wrap input::placeholder { color: var(--gray-400); }
.search-input-location .location-icon {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    color: var(--gray-400); font-size: 13px;
}
.btn-search-submit {
    background: var(--dark); color: #fff;
    border: none; padding: 12px 28px;
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    border-radius: 6px; white-space: nowrap;
    transition: background .2s;
}
.btn-search-submit:hover { background: #111; }

.btn-search-submit:hover { background: #111; }

/* ──────────────────────────────
   AUTOCOMPLETE DROPDOWN STYLES
   ────────────────────────────── */
.ui-autocomplete {
    position: absolute;
    top: 100%; left: 0; z-index: 9999;
    background-color: #ffffff;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 400px;
    overflow-y: auto;
    padding: 8px 0;
    margin-top: 5px;
    box-sizing: border-box;
}
.ui-autocomplete .ui-menu-item {
    margin: 0; padding: 0;
    list-style: none;
}
.ui-autocomplete .ui-menu-item-wrapper {
    display: block;
    padding: 12px 20px;
    font-size: 14px;
    color: var(--gray-800);
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
    transition: background-color 0.15s;
}
.ui-autocomplete .ui-menu-item:last-child .ui-menu-item-wrapper {
    border-bottom: none;
}
.ui-autocomplete .ui-menu-item-wrapper.ui-state-active,
.ui-autocomplete .ui-menu-item-wrapper:hover {
    background-color: var(--gray-100);
    color: var(--gray-800);
}
.ui-helper-hidden-accessible {
    display: none;
}

/* ──────────────────────────────
   RESULTS HEADER
   ────────────────────────────── */
.search-results-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.results-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 0 16px;
    border-top: 1px solid var(--gray-200);
}
.results-count { font-size: 15px; color: var(--gray-700); margin: 0; }
.results-count strong { font-weight: 700; }
.results-sort { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--gray-500); }
.results-sort select {
    border: 1px solid var(--gray-300); border-radius: 6px;
    padding: 7px 14px; font-size: 14px; cursor: pointer; background: #fff;
}

/* ──────────────────────────────
   LAYOUT
   ────────────────────────────── */
.search-results-layout { display: flex; gap: 24px; align-items: flex-start; }

/* ──────────────────────────────
   SIDEBAR — matches reference exactly
   ────────────────────────────── */
.search-sidebar {
    width: 280px; min-width: 280px;
}

/* ──────────────────────────────
   MAP SECTION (Sidebar)
   ────────────────────────────── */
.sidebar-map-section {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
}
.sidebar-map-placeholder {
    height: 160px;
    background: #f0f0f0;
    background-image: linear-gradient(90deg, #e5e5e5 1px, transparent 1px),
                      linear-gradient(180deg, #e5e5e5 1px, transparent 1px);
    background-size: 20px 20px;
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.map-placeholder-inner {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    color: var(--gray-500); font-size: 14px;
}
.map-placeholder-inner .fa-map-marked-alt { font-size: 32px; color: var(--gray-400); }
.btn-view-map {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%;
    background: #fff;
    border: none;
    border-top: 1px solid var(--gray-200);
    padding: 12px 16px;
    font-size: 14px; font-weight: 700;
    color: var(--gray-800);
    cursor: pointer;
    transition: background .15s;
}
.btn-view-map:hover { background: var(--gray-100); }
.btn-view-map .fa-map-marker-alt { color: var(--green); }

/* Sidebar Sections — stacked with shared borders */
.sidebar-section {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-top: none;
    padding: 24px;
}
.sidebar-section:last-child {
    border-radius: 0 0 var(--radius) var(--radius);
}

/* Compare Top button */
.sidebar-compare { text-align: center; padding: 24px; }
.btn-compare-top {
    width: 100%;
    background: #fff;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    padding: 10px 18px;
    font-size: 14px; font-weight: 700;
    color: var(--gray-800);
    cursor: pointer;
    transition: all .2s;
}
.btn-compare-top:hover { border-color: var(--gray-400); }

/* Sidebar title */
.sidebar-title {
    font-size: 16px; font-weight: 700;
    color: var(--gray-800); margin: 0 0 16px;
    line-height: 1.25;
}

/* Sidebar firm search box */
.sidebar-search-box {
    display: flex; align-items: center;
    border: 1px solid var(--gray-300); border-radius: 4px;
    overflow: hidden; background: #fff;
}
.sidebar-search-box > .fa-search {
    padding: 0 0 0 12px; color: var(--gray-400); font-size: 13px;
}
.sidebar-search-box input {
    flex: 1; border: none; outline: none;
    padding: 10px; font-size: 13px; color: var(--gray-700);
}
.sidebar-search-box input::placeholder { color: var(--gray-500); }
.sidebar-search-box button {
    background: #0A1317; border: none; color: #fff;
    padding: 11px 14px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.sidebar-search-box button:hover { background: #111; }

/* Star Rating Filter */
.rating-filter-list { display: flex; flex-direction: column; gap: 12px; }
.rating-filter-item {
    display: flex; align-items: center; gap: 10px;
    cursor: pointer; font-size: 14px;
    position: relative;
}
.rating-filter-item input[type="radio"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 22px; height: 22px; margin: 0;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    cursor: pointer; flex-shrink: 0;
    position: relative;
    background: #fff;
    transition: all .15s ease;
}
.rating-filter-item input[type="radio"]:checked {
    background: var(--green);
    border-color: var(--green);
}
.rating-filter-item input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 4px; left: 4px;
    width: 10px; height: 6px;
    border: 2px solid #fff;
    border-top: none; border-right: none;
    transform: rotate(-45deg);
}
.rating-filter-item input[type="radio"]:hover {
    border-color: var(--green);
}
.filter-stars {
    background: var(--green);
    padding: 4px 8px; border-radius: 4px;
    display: inline-flex; gap: 2px;
    align-items: center; line-height: 1;
}
.filter-stars i { color: #fff; font-size: 13px; }
.filter-label { font-weight: 700; color: #333; font-size: 14px; }

/* Review count filter */
.review-count-filter { display: flex; flex-direction: column; gap: 12px; }
.review-filter-item {
    display: flex; align-items: center; gap: 10px;
    font-size: 14px; cursor: pointer; color: #555;
    position: relative;
}
.review-filter-item input[type="radio"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 22px; height: 22px; margin: 0;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    cursor: pointer; flex-shrink: 0;
    position: relative;
    background: #fff;
    transition: all .15s ease;
}
.review-filter-item input[type="radio"]:checked {
    background: var(--green);
    border-color: var(--green);
}
.review-filter-item input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 4px; left: 4px;
    width: 10px; height: 6px;
    border: 2px solid #fff;
    border-top: none; border-right: none;
    transform: rotate(-45deg);
}
.review-filter-item input[type="radio"]:hover {
    border-color: var(--green);
}

/* ──────────────────────────────
   RECOMMENDED BANNER
   ────────────────────────────── */
.recommended-banner {
    display: flex; align-items: center; gap: 14px;
    background: #000; color: #fff;
    border-radius: 6px;
    padding: 16px 20px;
    margin-bottom: 24px;
    cursor: pointer;
    transition: background .15s;
}
.recommended-banner:hover { background: #111; }
.recommended-banner > .fa-check-circle {
    font-size: 32px; color: #08aa4e; flex-shrink: 0;
}
.recommended-text {
    flex: 1; font-size: 14px; color: #fff; line-height: 1.4;
}
.recommended-label { font-weight: 400; color: #aaa; font-size: 12px; display: block; margin-bottom: 2px; }
.recommended-desc { font-weight: 500; }
.recommended-arrow {
    color: #000; font-size: 14px; flex-shrink: 0;
    width: 28px; height: 28px; background: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

/* ──────────────────────────────
   FIRM CARDS
   ────────────────────────────── */
.search-results-main { flex: 1; min-width: 0; }

.firm-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0; margin-bottom: 18px;
    position: relative;
    box-shadow: var(--shadow-card);
    overflow: visible;
    transition: box-shadow .2s;
}
.firm-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.09); }

/* Rank Badge */
.firm-rank {
    position: absolute; top: -1px; left: -1px;
    width: 32px; height: 32px;
    background: #08aa4e; color: #fff;
    border-radius: var(--radius) 0 32px 0;
    display: flex; align-items: flex-start; justify-content: flex-start;
    padding-top: 4px; padding-left: 8px;
    font-size: 11px; font-weight: 700;
    z-index: 2;
}

/* Card body */
.firm-card-body {
    display: flex; gap: 18px;
    padding: 24px 24px 12px;
}

/* Logo */
.firm-logo {
    width: 85px; height: 85px; min-width: 85px;
    border-radius: 8px; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
}
.firm-logo img { width: 100%; height: 100%; object-fit: cover; }
.firm-logo-placeholder {
    color: var(--gray-400); font-size: 28px;
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 100%;
}

/* Firm details */
.firm-details { flex: 1; min-width: 0; }

/* Firm Name — black bold, NOT link-colored */
a.firm-name,
a.firm-name:link,
a.firm-name:visited,
a.firm-name:active,
.firm-name {
    font-size: 17px; font-weight: 700;
    color: #212529 !important;
    text-decoration: none !important;
    display: block; margin-bottom: 5px;
}
a.firm-name:hover, .firm-name:hover {
    color: #2b8a3e !important;
    text-decoration: underline !important;
}

/* Rating Row */
.firm-rating-row {
    display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.stars-badge {
    background: var(--green); color: #fff;
    padding: 4px 10px; border-radius: 4px;
    font-size: 12px;
    display: inline-flex; gap: 2px; align-items: center;
    line-height: 1;
}
.stars-badge .fa-star,
.stars-badge .fa-star-half-alt,
.stars-badge .far.fa-star { color: #fff; }
.rating-num { font-size: 15px; font-weight: 700; color: var(--gray-800); }
.divider { color: var(--gray-300); margin: 0 2px; }
.review-count { font-size: 14px; color: var(--gray-500); }

/* ── METRIC CIRCLES — Green outlined ring on white ── */
.firm-metrics { display: flex; gap: 16px; margin-bottom: 12px; }
.metric-item { display: flex; align-items: center; gap: 8px; }
.metric-circle {
    width: 44px; height: 44px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    line-height: 1.1;
    background: #fff;
    border: 3px solid #e0e0e0;
    color: var(--gray-500);
}
.metric-circle.has-data {
    border: 3px solid #08aa4e;
    color: #000;
}
.metric-label { font-size: 12px; color: #333; line-height: 1.25; font-weight: 500; }

/* Location */
.firm-location {
    font-size: 13px; color: var(--green);
    display: flex; align-items: center; gap: 5px;
}
.firm-location .fa-map-marker-alt { font-size: 11px; }

/* Compare */
.firm-compare {
    display: flex; align-items: center; justify-content: flex-end; gap: 8px;
    padding: 10px 24px;
    border-top: 1px solid var(--gray-200);
    font-size: 13px; color: var(--gray-500);
}
.firm-compare input[type="checkbox"] {
    width: 16px; height: 16px; cursor: pointer; accent-color: var(--green);
}

/* ── Loading ── */
.search-loading { text-align: center; padding: 60px 20px; color: var(--gray-500); }
.loading-spinner {
    width: 40px; height: 40px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── No Results ── */
.no-results-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 60px 40px;
    text-align: center;
    box-shadow: var(--shadow-card);
}
.no-results-card > .fa-search { font-size: 40px; color: var(--gray-300); margin-bottom: 16px; }
.no-results-card h3 { font-size: 22px; color: var(--gray-700); margin: 0 0 8px; }
.no-results-card p { font-size: 15px; color: var(--gray-500); margin: 0 0 20px; }
.btn-back-to-search {
    display: inline-block;
    background: var(--green); color: #fff;
    padding: 12px 32px; border-radius: 50px;
    text-decoration: none; font-weight: 600; font-size: 14px;
    transition: background .2s;
}
.btn-back-to-search:hover { background: var(--green-dark); color: #fff; }

/* ── RESPONSIVE ── */
/* --- Tablet (900px) --- */
@media (max-width: 900px) {
    .search-results-layout { flex-direction: column; }
    .search-sidebar { width: 100%; min-width: 0; }
    .search-results-form .search-input-group { flex-wrap: wrap; gap: 8px; }
    .btn-category { flex: 1 1 100%; justify-content: center; }
    .search-input-group .search-input-wrap { flex: 1 1 40%; }
    .btn-search-submit { flex: 1 1 100%; justify-content: center; }
    .results-header { flex-direction: column; gap: 8px; align-items: flex-start; }
}

/* --- Mobile (600px) --- */
@media (max-width: 600px) {
    .firm-card-body { flex-direction: column; gap: 12px; }
    .firm-logo { width: 60px; height: 60px; min-width: 60px; }
    .firm-metrics { flex-wrap: wrap; }

    .search-results-form .search-input-group {
        flex-direction: column;
        gap: 8px;
    }
    .search-input-group .search-input-wrap {
        flex: 1 1 100%;
        width: 100%;
    }
    .btn-category {
        width: 100%;
    }
    .btn-search-submit {
        width: 100%;
        height: 44px;
    }

    .firm-card {
        padding: 14px;
    }
    .firm-card-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    .firm-name {
        font-size: 16px;
    }
    .firm-card-actions {
        flex-direction: column;
        gap: 6px;
    }
    .firm-card-actions a,
    .firm-card-actions button {
        width: 100%;
        text-align: center;
    }

    .results-header {
        font-size: 14px;
    }
    .results-sort {
        width: 100%;
    }

    .search-pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* --- Small Mobile (480px) --- */
@media (max-width: 480px) {
    .firm-logo {
        width: 50px;
        height: 50px;
        min-width: 50px;
    }
    .firm-name {
        font-size: 15px;
    }
    .firm-metrics span {
        font-size: 12px;
    }
    .firm-card {
        padding: 12px;
    }
    .search-sidebar {
        padding: 12px;
    }
    .search-sidebar-title {
        font-size: 15px;
    }
}