/**
 * Rentals Search Page Styles
 */

/* ===========================
   HEADER REFACTOR - Modern Flexbox Layout
   Desktop only - mobile/tablet use standard header
   =========================== */

/* Desktop Navigation (above 1200px) */
@media (min-width: 1201px) {
    /* Full width header container */
    header.head {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        max-width: 100% !important;
        padding: 0 30px !important;
        gap: 20px;
    }

    /* Logo on the left */
    header.head .logolink {
        flex: 0 0 auto;
        order: 1;
    }

    header.head .logolink img {
        max-height: 80px;
        width: auto;
    }

    /* Main menu in the center */
    header.head .main-menu {
        flex: 1 1 auto;
        order: 2;
        margin-left: 0 !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center;
        background: transparent !important;
        position: static !important;
        height: auto !important;
        opacity: 1 !important;
        transform: none !important;
    }

    header.head .main-menu ul {
        display: flex !important;
        gap: 40px;
        margin: 0 !important;
        padding: 0 !important;
        position: static !important;
        height: auto !important;
        transform: none !important;
        border: none !important;
    }

    header.head .main-menu li {
        display: block !important;
        padding: 0 !important;
        height: auto !important;
    }

    header.head .main-menu li a {
        display: inline-block !important;
        line-height: 100px !important;
    }

    /* Woo menu (cart/account) on the right */
    header.head .woo-menu {
        flex: 0 0 auto;
        order: 3;
    }

    header.head .woo-menu ul {
        display: flex !important;
        gap: 20px;
        align-items: center;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Hide mobile menu toggle on desktop */
    header.head .menu-btn,
    header.head .menu-icon {
        display: none !important;
    }

    header.head .menu-btn:checked ~ .main-menu {
        position: static !important;
        height: auto !important;
        opacity: 1 !important;
    }
}

.rentals-search-page {
    padding: 0;
    margin: 0;
}

/* Hide footer and newsletter section on search page for full-screen map experience */
.rentals-search-page ~ footer,
.rentals-search-page ~ section,
body.page-template-page-rentals-search footer,
body.page-template-page-rentals-search section:not(.rentals-search-page section) {
    display: none !important;
}

/* Also hide any divs between map and footer */
.map-results-container ~ div:not(.rentals-search-page),
.map-results-container ~ section {
    display: none !important;
}

/* ===========================
   TOP SEARCH BAR
   =========================== */

.search-top-bar {
    background: #fff;
    border-bottom: 1px solid #e1e1e1;
    padding: 15px 0;
    position: fixed;
    top: 100px; /* Header is 100px tall */
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.top-bar-content {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    padding: 0 20px;
}

/* Unified Search Input */
.search-input-wrapper {
    position: relative;
    flex: 0 0 auto;
    width: 400px;
    max-width: 100%;
}

#unified-search {
    width: 100%;
}

#unified-search .ais-SearchBox {
    width: 100%;
}

#unified-search .ais-SearchBox-form {
    width: 100%;
    position: relative;
}

#unified-search .ais-SearchBox-form::before {
    display: none !important;
}

#unified-search .ais-SearchBox-input {
    width: 100%;
    padding: 14px 45px 14px 18px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    font-family: "azo-sans-web", sans-serif;
}

#unified-search .ais-SearchBox-input:focus {
    border-color: #cc0000;
    box-shadow: 0 2px 8px rgba(204, 0, 0, 0.15);
}

#unified-search .ais-SearchBox-submit,
#unified-search .ais-SearchBox-reset,
#unified-search .ais-SearchBox-loadingIndicator {
    display: none;
}

.unified-search-input {
    width: 100%;
    padding: 14px 45px 14px 18px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.unified-search-input:focus {
    border-color: #cc0000;
    box-shadow: 0 2px 8px rgba(204, 0, 0, 0.15);
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-clear-btn:hover {
    color: #333;
}

/* Filters Container */
.filters-stats-container {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    justify-content: flex-end;
}

/* Filter Dropdowns */
.filter-dropdowns {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap;
}

.clear-refinements-button {
    padding: 12px 18px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    font-family: "azo-sans-web", sans-serif;
}

.clear-refinements-button:hover:not(.clear-refinements-button--disabled) {
    background: #f9f9f9;
    border-color: #cc0000;
    box-shadow: 0 2px 6px rgba(204, 0, 0, 0.12);
}

.clear-refinements-button--disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.clear-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #333;
}

.clear-filters svg {
    flex-shrink: 0;
}

.filter-dropdown {
    position: relative;
}

.filter-btn {
    padding: 12px 18px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.filter-btn:hover {
    background: #f9f9f9;
    border-color: #006aff;
    box-shadow: 0 2px 6px rgba(0, 106, 255, 0.12);
}

.filter-btn.active {
    background: #006aff;
    color: #fff;
    border-color: #006aff;
    box-shadow: 0 2px 6px rgba(0, 106, 255, 0.25);
}

.filter-count {
    background: #006aff;
    color: #fff;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    display: none;
    min-width: 20px;
    text-align: center;
}

.filter-btn.active .filter-count {
    background: #fff;
    color: #006aff;
}

.filter-count.has-count {
    display: inline-block;
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

.filter-btn.open .dropdown-arrow {
    transform: rotate(180deg);
}

/* Filter Panel */
.filter-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 20px;
    min-width: 280px;
    max-height: 420px;
    overflow-y: auto;
    display: none;
    z-index: 1001;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-panel.open {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Ensure clicks work inside panels */
.filter-panel * {
    pointer-events: auto;
}

.clear-filters-btn {
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: #006aff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s;
}

.clear-filters-btn:hover {
    color: #0052cc;
    text-decoration: underline;
}

/* ===========================
   MAP AND RESULTS CONTAINER
   =========================== */

.map-results-container {
    display: flex;
    height: 100vh;
    padding-top: 170px; /* Reduced gap */
    position: relative;
}

/* Map Section (50%) - Fixed */
.map-section {
    flex: 0 0 50%;
    position: fixed;
    top: 174px; /* Match padding-top */
    left: 0;
    bottom: 0;
    width: 50%;
    background: #e5e3df;
}

#map {
    width: 100%;
    height: 100%;
}

/* Map Legend */
.map-legend {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-radius: 6px;
    padding: 8px 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-marker-green {
    background: #2e7d32;
}

.legend-marker-red {
    background: #d0161a;
}

.legend-marker-purple {
    background: #7e57c2;
}

.legend-label {
    font-size: 11px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

/* Map controls removed - using Google Maps defaults */

/* Results Section (50%) - Scrollable */
.results-section {
    flex: 0 0 50%;
    margin-left: 50%; /* Offset for fixed map */
    background: #f9f9f9;
    overflow-y: visible;
    height: auto;
    min-height: 100vh;
}

/* Results List */
.results-list-container {
    padding: 20px;
    min-height: calc(100vh - 140px); /* Prevent white space with few results */
}

/* Results Header */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.results-title-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.results-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.results-header #stats {
    color: #666;
    font-size: 14px;
    font-weight: 400;
}

.results-header #clear-refinements {
    flex: 0 0 auto;
    margin-left: 20px;
}

#hits {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px !important;
    margin-bottom: 40px;
    list-style: none !important;
    padding: 0 !important;
}

/* 3 columns above 1400px */
@media (min-width: 1400px) {
    #hits {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* Target Algolia's generated wrapper */
#hits > div,
#hits .ais-Hits,
#hits .ais-Hits-list {
    display: contents !important;
}

/* Target Algolia's list items */
#hits .ais-Hits-item {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0.5rem !important; /* Reduced from 1.5rem */
}

/* Hit Card */
.hit-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer !important;
    user-select: none;
}

.hit-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(-4px);
    border-color: #d0d0d0;
}

.hit-card.active {
    border-color: #006aff;
    box-shadow: 0 8px 24px rgba(0, 106, 255, 0.2);
}

.hit-image {
    width: 100%;
    height: 240px;
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.hit-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hit-card:hover .hit-image img {
    transform: scale(1.05);
}

.hit-content {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.hit-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 800;
    line-height: 1.4;
    color: #1a1a1a;
}

.hit-title a {
    color: #1a1a1a;
    text-decoration: none;
}

.hit-title a:hover {
    color: #006aff;
}

.hit-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.hit-price {
    font-weight: 600;
    color: #1a1a1a;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
}

.hit-availability {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.813rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.hit-availability-spaces_available {
    background: #e8f5e9;
    color: #2e7d32;
}

.hit-availability-join_waitlist {
    background: #fff3e0;
    color: #e65100;
}

.hit-availability-external_management {
    background: #efe7fb;
    color: #5c2ca0;
}

.hit-external-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f0f7ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
    font-size: 0.813rem;
    color: #0066cc;
    font-weight: 600;
    margin-top: 8px;
}

.hit-external-badge svg {
    flex-shrink: 0;
}

.hit-categories {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.hit-category {
    padding: 3px 8px; /* Reduced from 6px 12px for badge-like appearance */
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 0.75rem; /* Smaller font */
    color: #666;
    font-weight: 500;
}

.hit-postcode-chip {
    background: #f1f1f1;
    color: #555;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.hit-cta {
    color: #c62828;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.938rem;
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.hit-cta:hover {
    color: #000000;
}

/* No Results */
.no-results {
    padding: 60px 20px;
    text-align: center;
    color: #666;
}

.no-results p {
    margin: 10px 0;
    font-size: 1.1rem;
}

.no-results-clear-btn {
    margin-top: 20px;
    padding: 14px 32px;
    background: #cc0000;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: "azo-sans-web", sans-serif;
}

.no-results-clear-btn:hover {
    background: #a00000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(204, 0, 0, 0.3);
}

/* Pagination - Hidden since we show all results */
#pagination {
    display: none;
}

/* ===========================
   RESPONSIVE DESIGN
   =========================== */

/* Tablet Layout */
@media (max-width: 1200px) {
    .search-top-bar {
        top: 100px;
    }

    .map-results-container {
        flex-direction: column;
        padding-top: 170px; /* Header 100px + Search bar ~70px */
    }

    .map-section {
        position: relative;
        top: 0;
        left: 0;
        width: 100%;
        height: 60vh;
        flex: none;
        margin-bottom: 0;
    }

    .results-section {
        margin-left: 0;
        margin-top: 0;
        flex: 1;
        overflow-y: visible;
        height: auto;
    }

    #hits,
    #hits > div,
    #hits .ais-Hits-list {
        grid-template-columns: repeat(3, 1fr) !important; /* 3 columns at tablet breakpoint */
    }

    .filter-panel {
        max-height: 300px;
    }
}

/* Mobile Layout */
@media (max-width: 768px) {
    .search-top-bar {
        padding: 10px 0;
    }

    .map-results-container {
        padding-top: 208px; /* Header 100px + taller stacked search bar ~108px */
    }

    .top-bar-content {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .search-input-wrapper {
        width: 100%;
        min-width: auto;
        max-width: 100%;
    }

    .unified-search-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .filters-stats-container {
        justify-content: flex-start;
    }

    .filter-dropdowns {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    .filter-dropdown {
        flex: 1 1 auto;
        min-width: 0;
    }

    .filter-btn {
        padding: 10px 14px;
        font-size: 13px;
        justify-content: center;
        width: 100%;
    }

    /* Mobile results header - side by side */
    .results-header {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }

    .results-title-container {
        flex: 1 1 50%;
    }

    .results-header #clear-refinements {
        flex: 1 1 50%;
        margin-left: 0;
        display: flex;
        justify-content: flex-end;
    }

    .clear-refinements-button {
        width: auto;
        justify-content: center;
    }

    .map-section {
        height: 40vh;
    }

    /* Results header on mobile */
    .results-title {
        font-size: 1.25rem;
    }

    #hits,
    #hits > div,
    #hits .ais-Hits-list {
        grid-template-columns: repeat(2, 1fr) !important; 
        gap: 16px;
    }

    .hit-image {
        height: 200px;
    }

    .hit-content {
        padding: 15px;
    }

    .hit-title {
        font-size: 1rem;
    }

    .hit-price {
        font-size: 1.1rem;
    }

    .filter-panel {
        min-width: 260px;
        max-height: 280px;
        padding: 16px;
    }

    .clear-filters-btn {
        width: 100%;
        text-align: center;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .map-results-container {
        padding-top: 260px; /* Header 100px + extra tall stacked search bar ~160px */
    }




    .filter-btn {
        width: 100%;
    }


    .hit-image {
        height: 180px;
    }
}

/* ===========================
   ALGOLIA WIDGET OVERRIDES
   =========================== */

/* Highlight Colors - Brand Red */
.ais-Highlight-highlighted,
.ais-Snippet-highlighted {
    background-color: rgba(208, 19, 23, 0.1);
    color: #d01317;
    font-style: normal;
}

/* Refinement Lists */
.ais-RefinementList-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ais-RefinementList-item {
    padding: 8px 0;
}

.ais-RefinementList-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.ais-RefinementList-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.ais-RefinementList-labelText {
    flex: 1;
    font-size: 14px;
    text-transform: capitalize; /* Transform spaces_available → Spaces Available */
}

.ais-RefinementList-count {
    background: #e0e0e0;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}

/* Range Slider */
.ais-RangeSlider {
    padding: 20px 10px;
}

/* Stats */
.ais-Stats-text {
    font-size: 14px;
    color: #666;
}

/* Pagination */
.ais-Pagination-list {
    display: flex;
    gap: 5px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.ais-Pagination-item {
    display: inline-block;
}

.ais-Pagination-link {
    display: block;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s;
}

.ais-Pagination-link:hover {
    background: #f5f5f5;
    border-color: #c62828;
    color: #c62828;
}

.ais-Pagination-item--selected .ais-Pagination-link {
    background: #c62828;
    color: #fff;
    border-color: #c62828;
}

/* Map Info Window */
.map-info-window {
    padding: 10px;
    max-width: 250px;
    display: flex;
    flex-direction: column;
}

.map-info-window h4 {
    margin: 0 0 8px 0;
    font-size: 1rem;
}

.map-info-window .info-price {
    font-weight: 600;
    color: #000000;
    margin: 4px 0;
}

.map-info-window .info-availability {
    margin: 4px 0;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

.map-info-window .info-availability-spaces_available {
    background: #e8f5e9;
    color: #2e7d32;
}

.map-info-window .info-availability-join_waitlist {
    background: #fff3e0;
    color: #e65100;
}

.map-info-window .info-availability-external_management {
    background: #efe7fb;
    color: #5c2ca0;
}

.map-info-window .info-link {
    display: inline-block;
    margin-top: 8px;
    color: #c62828;
    text-decoration: none;
    font-weight: 500;
}

.map-info-window .info-link:hover {
    text-decoration: underline;
}

/* Hide "Clear the map refinement" button */
.ais-GeoSearch-reset {
    display: none !important;
}

/* ===========================
   POSTCODE LOCATION MARKER
   Subtle pulsing blue dot
   =========================== */

.postcode-pulse-marker {
    position: absolute;
    width: 0;
    height: 0;
    pointer-events: none;
}

.pulse-dot {
    position: absolute;
    width: 16px;
    height: 16px;
    transform: translate(-50%, -50%);
    background: #006aff;
    border: 3px solid rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    box-shadow:
        0 0 0 2px rgba(0, 106, 255, 0.3),
        0 3px 10px rgba(0, 106, 255, 0.3);
    z-index: 2;
}

.pulse-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(0, 106, 255, 0.45);
    border-radius: 50%;
    animation: postcode-pulse 2.4s ease-out infinite;
    z-index: 1;
}

@keyframes postcode-pulse {
    0% {
        width: 20px;
        height: 20px;
        opacity: 0.55;
    }
    100% {
        width: 72px;
        height: 72px;
        opacity: 0;
    }
}
