/**
 * Listing Results Page Styles
 * Redesigned filter popup, view switcher, and multi-view layout
 * Updated to match Figma design specifications
 */

/* ========================================
   CSS Variables - Figma Design Tokens
   ======================================== */

:root {
    /* Listing-specific Colors (supplements figma-design-system.css) */
    --color-dark-green: #174C1A;
    --color-darker-green: #0F3212;
    --color-darkest-green: #273518;

    /* Secondary/Accent Colors */
    --color-accent-green: #99CC66;
    --color-light-green: #C2E0A3;
    --color-medium-green: #519856;
    --color-medium-green-2: #00502f;

    /* Background Colors */
    --color-bg-pale-green: #F0FAF0;
    --color-bg-light-green-2: #EBF8EB;
    --color-bg-light-green-3: #BCD8BE;
    --color-bg-light-green-4: #A6CBA9;
    --color-bg-medium-green: #D1E4D2;

    /* Neutral Colors */
    --color-white: #FFFFFF;
    --color-light-gray: #F0F0F0;
    --color-gray: #E0E0E0;
    --color-medium-gray: #D9D9D9;

    /* Border Radius */
    --radius-button: 4px;
    --radius-card: 8px;
}

/* ========================================
   Filter Modal Styles
   ======================================== */

#filters_modal .modal-dialog {
    max-width: 800px;
}

#filters_modal .modal-content {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#filters_modal .modal-header {
    background-color: #f8f8f8;
    border-bottom: 1px solid #e0e0e0;
    padding: 20px 24px;
}

#filters_modal .modal-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

#filters_modal .modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

#filters_modal .modal-footer {
    padding: 15px 24px;
    border-top: 1px solid #e0e0e0;
}

/* Filter Sections */
.filter-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e8e8e8;
}

.filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.filter-section h4 {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 12px;
    margin-top: 0;
}

.filter-section h5 {
    font-size: 14px;
    font-weight: bold;
    color: #555;
    margin-bottom: 10px;
    margin-top: 16px;
}

/* Filter Form Groups */
.filterPlaces label,
.filterOfferings label,
.filterPayments label,
.openTimes label {
    display: block;
    margin-bottom: 8px;
    font-weight: normal;
    color: #333;
    cursor: pointer;
}

.filterPlaces input[type="checkbox"],
.filterOfferings input[type="checkbox"],
.filterPayments input[type="checkbox"],
.openTimes input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    vertical-align: middle;
}

/* Two-column layout for checkboxes on larger screens */
@media (min-width: 768px) {
    .filterPlaces,
    .filterOfferings,
    .filterPayments {
        column-count: 2;
        column-gap: 20px;
    }

    .filterPlaces label,
    .filterOfferings label,
    .filterPayments label {
        break-inside: avoid;
    }
}

/* Modal Buttons */
#filters_modal .modal-footer .btn {
    padding: 10px 24px;
    font-weight: bold;
    border-radius: 4px;
}

#apply_filters_btn {
    background-color: var(--color-primary-green);
    border-color: var(--color-primary-green);
    color: var(--color-white);
}

#apply_filters_btn:hover {
    background-color: var(--color-dark-green);
    border-color: var(--color-dark-green);
}

#reset_filters_btn {
    background-color: var(--color-white);
    border-color: var(--color-gray);
    color: #666;
}

#reset_filters_btn:hover {
    background-color: var(--color-light-gray);
}

/* ========================================
   FILTERS Button - Figma Design
   ======================================== */

#filters_toggle_btn {
    /* Primary Button Styling - Figma layout_OJYB60 */
    background-color: #00502f; /* fill_KICN11 - primary green */
    border: 1px solid #00502f;
    color: #FCFEFC; /* fill_6B8TKJ - off-white */

    /* Layout */
    padding: 10px 14px;
    border-radius: 4px;

    /* Typography - Figma style_4KJQ8K */
    font-family: var(--font-condensed); /* Roboto Condensed */
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3em;
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 0;

    /* Interaction */
    cursor: pointer;
    transition: all 0.2s ease;

    /* Flexbox for icon + text layout */
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#filters_toggle_btn:hover,
#filters_toggle_btn:focus {
    background-color: #174C1A; /* Darker green on hover */
    border-color: #174C1A;
    color: #FCFEFC;
}

#filters_toggle_btn i {
    /* Icon sizing - Figma 16x16px */
    font-size: 16px;
    width: 16px;
    height: 16px;
    display: inline-block;
}


/* Mobile responsive view switcher */
@media (max-width: 767px) {
    .view-switcher-bar {
        flex-wrap: wrap;
    }

    .view-switcher-btn {
        flex: 1 1 calc(50% - 5px);
        max-width: none;
        font-size: 12px;
        padding: 10px 12px;
    }
}

/* Small phones: stack the filter bar into two rows so the view buttons never
   collapse into a single column. Row 1 = Refine Search + results count,
   row 2 = the three view buttons in one equal-width line. */
@media (max-width: 480px) {
    .resultsFilterBar {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    .resultsFilterBar .filtersToggles,
    .resultsFilterBar .results_filter_right {
        float: none !important;
        width: 100% !important;
        text-align: left !important;
        padding-left: 0;
        margin-top: 12px;
    }
    .view-switcher-bar {
        display: flex !important;
        width: 100%;
        gap: 6px;
    }
    .view-switcher-btn {
        flex: 1 1 0;
        max-width: none;
        font-size: 11px;
        padding: 9px 4px;
        gap: 5px;
        white-space: nowrap;
    }
}

/* ========================================
   View Containers
   ======================================== */

.results-view-container {
    display: none;
}

.results-view-container.active {
    display: block;
}

/* List View */
#results-list-view {
    /* Inherits existing card styles */
}

/* Map View - Figma Design */
#results-map-view {
    width: 100%;
}

#results-map-view div div.col-lg-12 {
    padding: 0;
}

#results-map-container {
    width: 100%;
    height: 648px;
    border-radius: 0;
    overflow: hidden;
    margin: 0 auto;
}

/* ========================================
   Calendar View - Figma Design
   ======================================== */

#results-calendar-view {
    width: 100%;
}

/* Calendar Week View - Column Layout */
.calendar-week-view {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-self: stretch;
    padding: 0 0 32px;
    width: 100%;
}

/* Calendar Day Row - Alternating Backgrounds */
.calendar-day {
    display: flex;
    flex-direction: row;
    justify-content: stretch;
    align-items: stretch;
    gap: 12px;
    width: 100%;
    margin: 0 auto;
}

/* Alternating row backgrounds */
.calendar-day:nth-child(odd) {
    background: #E7F1E7; /* Light green */
}

.calendar-day:nth-child(even) {
    background: #D1E4D2; /* Darker green */
}

/* Date Section (Left Side) */
.calendar-day-date {
    display: flex;
    flex-direction: column;
    padding: 4px 0;
    flex-shrink: 0;
}

.calendar-day-of-week {
    font-family: var(--font-primary);
    font-weight: 800;
    font-size: 14px;
    line-height: 1.1em;
    letter-spacing: 0.02em;
    color: #00502f;
    margin: 0;
}

.calendar-day-number {
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: 32px;
    line-height: 1.2em;
    color: #333333;
    margin: 0;
}

/* Events Section (Right Side) */
.calendar-day-events {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

/* Single Event (Business with grouped time slots) */
.calendar-event {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.calendar-event-title {
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 20px;
    line-height: 1.1em;
    letter-spacing: -0.01em;
    color: #666666;
    margin: 0;
}

.calendar-event-title a {
    color: #0F3212;
    text-decoration: none;
}

.calendar-event-title a:hover {
    color: #00502f;
    text-decoration: underline;
}

/* Container for multiple time slots */
.calendar-event-times {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-left: 12px;
}

.calendar-event-time {
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: 14px;
    color: #1E6523;
    margin: 0;
}

/* No Events Message */
.calendar-no-events {
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 20px;
    line-height: 1.1em;
    letter-spacing: -0.01em;
    color: #666666;
    font-style: italic;
    margin: 0;
}

/* Category Filter Tabs */
.calendar-category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    padding: 16px;
    background-color: #F0F0F0;
    border-radius: 4px;
}

.calendar-category-tab {
    background-color: #E7F1E7;
    border: 1px solid rgba(30, 101, 35, 0.6);
    color: #00502f;
    padding: 8px 16px;
    border-radius: 4px;
    font-family: var(--font-condensed);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calendar-category-tab:hover {
    background-color: #D1E4D2;
    border-color: rgba(30, 101, 35, 0.8);
}

.calendar-category-tab.active {
    background-color: #00502f;
    color: #FFFFFF;
    border-color: #00502f;
}

.calendar-category-tab.active:hover {
    background-color: #174C1A;
    border-color: #174C1A;
}

/* Sort Controls */
.calendar-sort-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.calendar-sort-label {
    font-family: var(--font-condensed);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    color: #00502f;
    margin: 0;
}

.calendar-sort-select {
    background-color: #FFFFFF;
    border: 1px solid rgba(30, 101, 35, 0.6);
    color: #00502f;
    padding: 6px 28px 6px 12px;
    border-radius: 4px;
    font-family: var(--font-condensed);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.calendar-sort-select:hover {
    border-color: rgba(30, 101, 35, 0.9);
}

.calendar-sort-select:focus {
    outline: 2px solid #00502f;
    outline-offset: 1px;
}

/* Collapsible Day Styles */
.calendar-day {
    flex-direction: column;
    cursor: default;
}

.calendar-day-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 32px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.calendar-day-header:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.calendar-day-summary {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    justify-content: flex-end;
}

.calendar-day-count {
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 16px;
    color: #333333;
}

.calendar-category-breakdown {
    font-weight: 400;
    font-size: 14px;
    color: #666666;
}

.calendar-expand-icon {
    font-size: 20px;
    color: #00502f;
    transition: transform 0.3s ease;
}

/* Collapsed state */
.calendar-day.collapsed .calendar-day-events {
    display: none;
}

.calendar-day.collapsed .calendar-expand-icon {
    transform: rotate(0deg);
}

/* Expanded state */
.calendar-day:not(.collapsed) .calendar-expand-icon {
    transform: rotate(180deg);
}

/* Update day events to not have flex when inside collapsible structure */
.calendar-day .calendar-day-events {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    padding: 0 16px 12px 16px;
}

.calendar-fallback-message {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
}

.calendar-fallback-message i {
    margin-right: 8px;
}

.calendar-error,
.calendar-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.calendar-error i,
.calendar-no-results i {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 15px;
    display: block;
}

.calendar-error p,
.calendar-no-results p {
    margin: 8px 0;
    font-size: 16px;
}

/* ========================================
   Updated Card Styles (List View)
   ======================================== */

.listing-card {
    background-color: var(--color-bg-pale-green);
    border: 1px solid var(--color-gray);
    border-radius: var(--radius-card);
    padding: 0;
    margin-bottom: 30px;
    transition: box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.listing-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.listing-card-inner {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
}

.listing-card-image-wrapper {
    width: 100%;
    position: relative;
}

.listing-card-image {
    width: 100%;
    height: 220px;
    object-fit: contain;
    border-radius: 0;
    display: block;
}

/* Open Today overlay - positioned on top of the image */
.listing-card-open-today {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background-color: rgba(0, 80, 47, 0.95);
    color: #fff;
    text-align: center;
    padding: 4px 0;
    margin: 0;
    font-family: var(--font-primary);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
}

.listing-card-open-today p {
    color: #fff;
    margin: 1px 0 3px 0;
    font-weight: 700;
}

.listing-card-open-today strong {
    color: #fff;
    font-weight: 700;
}

.listing-card-content {
    flex: 1;
    min-width: 0;
    padding: 16px;
    background-color: var(--color-white);
}

.listing-card-content p,
.listing-card-description {
    font-family: var(--font-primary);
    font-weight: 400;
    color: #000;
}

.listing-card-title {
    font-family: var(--font-primary);
    font-size: 2.5rem;
    font-weight: var(--font-weight-bold, 700);
    margin: 0 0 4px 0;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--color-primary-green);
}

.listing-card-title a {
    color: var(--color-primary-green);
    text-decoration: none;
}

.listing-card-title a:hover {
    text-decoration: underline;
    color: var(--color-dark-green);
}

.listing-card-location {
    color: var(--color-darker-green);
    font-family: var(--font-primary);
    font-size: 14px;
    margin-bottom: 12px;
    font-weight: 400;
    line-height: 1.2;
}

.listing-card-phone {
    color: var(--color-darker-green);
    font-family: var(--font-primary);
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 400;
    line-height: 1.2;
}

.listing-card-phone i {
    margin-right: 6px;
    color: var(--color-primary-green);
    width: 14px;
    text-align: center;
}

.listing-card-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.listing-card-link {
    display: inline-flex;
    align-items: center;
    color: var(--color-primary-green);
    text-decoration: none;
    font-family: var(--font-primary);
    font-size: 14px;
    line-height: 1.2;
}

.listing-card-link:hover {
    text-decoration: underline;
    color: var(--color-dark-green);
}

.listing-card-link i {
    margin-right: 4px;
}

/* Bullet separator between links */
.listing-card-link:not(:first-child)::before {
    content: "•";
    margin-right: 8px;
    color: var(--color-darker-green);
}

/* Market schedule styling for farmers markets */
.listing-card-market-schedule {
    background-color: var(--color-light-gray);
    padding: 8px 12px;
    border-radius: var(--radius-button);
    margin-bottom: 14px;
    border-top: 1px solid var(--color-gray);
    font-family: var(--font-primary);
    font-size: 14px;
    line-height: 1.6;
}
.listing-card-market-schedule strong {
    display: block;
    margin-bottom: 8px;
    color: var(--color-darker-green);
    font-size: 16px;
    font-weight: 600;
}
.listing-card-market-schedule p {
    font-size: 14px;
}


.listing-card-tags {
    margin-top: 12px;
    margin-bottom: 12px;
}

.listing-card-tags ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.listing-card-tags ul li {
    display: inline-block;
}

.listing-card-tags ul li a,
.listing-card-tags ul li span {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 3px;
    font-family: var(--font-primary);
    font-size: 12px;
    text-decoration: none;
    background-color: var(--color-bg-medium-green);
    color: var(--color-dark-green);
}

.listing-card-tags ul li a:hover {
    background-color: var(--color-bg-light-green-3);
}

/* Different colors for different tag types */
.listing-card-tags ul.placesColor li a,
.listing-card-tags ul.placesColor li span {
    background-color: var(--color-accent-green);
    color: var(--color-darkest-green);
}

.listing-card-tags ul.offeringsColor li a,
.listing-card-tags ul.offeringsColor li span {
    background-color: var(--color-accent-green);
    color: var(--color-darkest-green);
}

/* Category display at bottom of card */
.listing-card-categories {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0;
    padding: 8px 10px;
    margin: 0;
    width: 100%;
    border-top: 1px solid var(--color-bg-light-green-3);
    background-color: var(--color-bg-medium-green);
    text-align: center;
}

.listing-card-category {
    color: var(--color-darker-green);
    font-family: var(--font-primary);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Add comma separator between categories */
.listing-card-category:not(:last-child)::after {
    content: ",";
    margin-right: 5px;
}

/* Wholesale type badge (Buyer/Seller) */
.listing-card-category-wholesale {
    color: var(--color-darker-green);
}



/* ========================================
   Breadcrumbs Styling - Figma Design
   ======================================== */

/* Breadcrumbs Container */
.breadcrumbs-container {
    background-color: var(--color-light-gray);
    display: flex;
    flex-direction: column;
    align-items: left;
    gap: 8px;
    width: 100%;
}

/* Breadcrumbs Inner */
.breadcrumb {
    background-color: transparent;
    padding: 8px 32px;
    margin-bottom: 0;
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.2em;
    letter-spacing: 0.01em;
    border-radius: 0;
    width: 100%;
    display: flex;
    align-items: center;
}
.breadcrumb a {
    font-weight: 400;
}

.breadcrumb > li {
    color: #666666;
}

.breadcrumb > li + li:before {
    content: "/";
    padding: 0;
    color: #666666;
}

.breadcrumb > li > a {
    color: #666666;
    text-decoration: none;
}

.breadcrumb > li > a:hover {
    color: #666666;
    text-decoration: underline;
}

.breadcrumb > .active {
    color: #666666;
    font-weight: bold;
}

/* ========================================
   Results Filter Bar Updates
   ======================================== */
/* Remove shadow from filter bar to match Figma */
.resultsFilterBar { box-shadow: none !important; }


/* Global fixed-header offset is now handled sitewide in styles.css */

.resultsFilterBar {
    margin-top: 0;
    margin-bottom: 0;
    padding: 20px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-gray);
}

.filtersToggles {
    display: flex;
    gap: 15px;
    padding-left: 0;
}

/* Override legacy button margin within results subheader */
.resultsFilterBar .unround {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}


.results-count {
    font-family: var(--font-primary);
    font-size: 14px;
    color: var(--color-darker-green);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    min-height: 38px;
}

/* Active Filters Bar - Figma Design */
.resultsFilters {
    background-color: #F0F0F0;
    padding: 10px 12px;
    margin-bottom: 20px;
    border-radius: 0;
    margin-top: 0;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    float: left;
    width: 100%;
    min-height: 41px;
    height: auto;
}

.resultsFilters .active-filters-content {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 6px 0;
    flex: 1;
    line-height: 1.5em;
    padding-top: 4px;
}

.resultsFilters .search_filter_label {
    font-family: var(--font-primary);
    font-weight: 800;
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--color-darker-green);
    margin: 0;
    margin-right: 8px;
    flex-shrink: 0;
}

.resultsFilters strong {
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 14px;
    line-height: 1.5;
    color: #3D3D3D;
    margin-right: 4px;
}

/* Filter Groups - Combined filter display */
.resultsFilters .filter-group {
    display: inline;
    padding: 0 10px;
    line-height: 1.5;
    font-size: 14px;
}

.resultsFilters .filter-group:first-of-type {
    border-left: none;
    padding-left: 0;
}

.resultsFilters .filter-group-more {
    display: inline;
    padding-left: 10px;
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 13px;
    color: #666666;
    font-style: italic;
    line-height: 1.5;
}

/* Filter value toggle links */
.resultsFilters .filter-toggle-more,
.resultsFilters .filter-toggle-less {
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-primary-green);
    text-decoration: none;
    margin-left: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.resultsFilters .filter-toggle-more:hover,
.resultsFilters .filter-toggle-less:hover {
    text-decoration: underline;
    color: var(--color-darker-green);
}

.resultsFilters .filter-values-hidden {
    /* Initially hidden via inline style, shown via JS */
}

/* Clear Filters Button - Figma Design */
.clear-filters-btn {
    font-family: var(--font-condensed);
    font-weight: 500;
    font-size: 14px;
    line-height: 1em;
    text-transform: uppercase;
    text-align: center;
    color: var(--color-primary-green);
    background-color: #E7F1E7;
    border: 1px solid rgba(30, 101, 35, 0.6);
    border-radius: 4px;
    padding: 4px 14px;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 0;
}

.clear-filters-btn:hover {
    background-color: #D8E8D8;
    border-color: var(--color-primary-green);
    color: var(--color-primary-green);
    text-decoration: none;
}

/* Listing Cards Container - Base Styles */
.listing-cards-container {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    margin-left: -15px;
    margin-right: -15px;
}

/* Card Column Wrapper */
.listing-cards-container > [class*="col-"] {
    display: flex;
    flex-direction: column;
}

/* Mobile (< 768px): Single column layout */
@media (max-width: 767px) {
    .listing-cards-container {
        margin-left: -15px;
        margin-right: -15px;
    }

    .listing-cards-container > .listing-card-column {
        padding-left: 15px !important;
        padding-right: 15px !important;
        flex: 0 0 100%;
        max-width: 100%;
        width: 100%;
    }

    .listing-cards-container > .ads-column {
        padding-left: 15px !important;
        padding-right: 15px !important;
        flex: 0 0 100%;
        max-width: 100%;
        width: 100%;
        order: 999; /* Ads appear at bottom on mobile */
    }

    .listing-cards-container > .results-pagination-center {
        order: 1000;
        flex: 0 0 100%;
        max-width: 100%;
        width: 100%;
    }
}

/* Tablet (768px - 991px): Two column layout */
@media (min-width: 768px) and (max-width: 991px) {
    .listing-cards-container {
        margin-left: -16px;
        margin-right: -16px;
        align-items: flex-start;
    }

    .listing-cards-container > .listing-card-column {
        padding-left: 16px !important;
        padding-right: 16px !important;
        flex: 0 0 50%;
        max-width: 50%;
        width: 50%;
    }

    .listing-cards-container > .ads-column {
        padding-left: 16px !important;
        padding-right: 16px !important;
        flex: 0 0 100%;
        max-width: 100%;
        width: 100%;
        order: 999; /* Ads appear at bottom on tablet */
    }

    .listing-cards-container > .results-pagination-center {
        order: 1000;
        flex: 0 0 100%;
        max-width: 100%;
        width: 100%;
    }
}

/* Desktop (≥ 992px): Three column layout with ads in third column */
@media (min-width: 992px) {
    .listing-cards-container {
        display: flex;
        flex-wrap: wrap;
        margin-left: -16px;
        margin-right: -16px;
        align-items: flex-start;
    }

    /* Listing cards take 1/3 width (33.333%) */
    .listing-cards-container > .listing-card-column {
        padding-left: 16px !important;
        padding-right: 16px !important;
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
        width: 33.333333%;
    }

    /* Ads column takes 1/3 width and is ordered to appear in the third column position */
    .listing-cards-container > .ads-column {
        padding-left: 16px !important;
        padding-right: 16px !important;
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
        width: 33.333333%;
        order: 3; /* Position ads to appear after first 2 listing cards */
        align-self: flex-start; /* Keep ads at top */
        position: sticky;
        top: 20px;
    }

    /* Order listing cards to wrap around ads - first two cards appear before ads */
    .listing-cards-container > .listing-card-column:nth-child(1) { order: 1; }
    .listing-cards-container > .listing-card-column:nth-child(2) { order: 2; }
    /* All subsequent cards appear after ads */
    .listing-cards-container > .listing-card-column:nth-child(n+3) { order: 4; }

    /* Pagination takes full width and appears at the end */
    .listing-cards-container > .results-pagination-center {
        order: 999;
        flex: 0 0 100%;
        max-width: 100%;
        width: 100%;
    }
}

/* Override ordering for pages without ads (e.g., wholesale) */
@media (min-width: 992px) {
    .listing-cards-container.no-ads > .listing-card-column {
        order: initial !important;
    }
}

/* Ads Column Styling */
.ads-column {
    position: relative;
}
.ads-column .ad-label {
    text-align: center;
    font-size: .75em;
}

.gpt-sidebar-ad {
    margin-bottom: 30px;
}

/* View Switcher Buttons - Figma Design
   ======================================== */

.results_filter_right {
    padding-right: 0;
}

.view-switcher-bar {
    vertical-align: middle;
    display: inline-flex !important;
    gap: 8px;
}

.view-switcher-btn {
    /* Secondary (Inactive) Button Styling */
    background-color: #E7F1E7; /* fill_NW86KC - very light green */
    border: 1px solid rgba(30, 101, 35, 0.6); /* stroke_UWE6Y0 - semi-transparent green */
    color: #00502f; /* fill_FVP9BR - primary green */

    /* Layout - Figma layout_MGAGCP */
    padding: 10px 14px;

    /* Typography - Figma style_3C9G2F */
    font-family: var(--font-condensed); /* Roboto Condensed */
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3em;
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 0;

    /* Border radius */
    border-radius: 4px;

    /* Interaction */
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-switcher-btn:hover {
    background-color: #D1E4D2; /* Slightly darker green on hover */
    border-color: rgba(30, 101, 35, 0.8);
}

.view-switcher-btn.active {
    /* Primary (Active) Button Styling */
    background-color: #00502f; /* fill_FVP9BR - primary green */
    color: #FFFFFF; /* Text/Nav Item - white */
    border-color: #00502f;
}

.view-switcher-btn.active:hover {
    background-color: #174C1A; /* Slightly darker green on hover */
    border-color: #174C1A;
}

/* Hide old slide-out wrapper */
#search_wrapper {
    display: none !important;
}

/* ========================================
   Map View Styles - Figma Design
   ======================================== */

#results-map-view {
    width: 100%;
}

#results-map-container {
    width: 100%;
    height: 648px;
    border-radius: 0;
    overflow: hidden;
    margin: 0 auto;
    position: relative;
}

/* Map state overlay (loading / empty / error) */
.map-state-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: none;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--spacing-800, 32px);
    background: rgba(255, 255, 255, 0.92);
    color: var(--color-dark-green);
    font-family: var(--font-primary);
    font-weight: var(--font-weight-semibold, 600);
    font-size: 16px;
    z-index: 2;
}

/* Map Info Window Card Styles */
.map-info-card {
    max-width: 300px;
    font-family: Arial, sans-serif;
}

.map-info-image-wrapper {
    width: 100%;
    margin-bottom: 10px;
}

.map-info-image {
    width: 100%;
    height: auto;
    max-height: 150px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.map-info-content {
    padding: 0;
}

.map-info-title {
    font-family: var(--font-primary);
    font-size: 16px;
    font-weight: bold;
    margin: 0 0 6px 0;
}

.map-info-title a {
    color: var(--color-primary-green);
    text-decoration: none;
}

.map-info-title a:hover {
    text-decoration: underline;
}

.map-info-address {
    color: var(--color-darker-green);
    font-family: var(--font-primary);
    font-size: 13px;
    margin-bottom: 10px;
}

.map-info-link {
    display: inline-block;
    color: var(--color-primary-green);
    text-decoration: none;
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 500;
}

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

/* Map Legend Styles */
.map-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 20px;
    padding: 12px 15px;
    margin-top: 10px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-family: var(--font-primary);
    font-size: 13px;
    color: #333;
}

.map-legend-label {
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.map-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.map-legend-icon {
    width: 14px;
    height: 18px;
    flex-shrink: 0;
}

/* ========================================
   Pagination Styling
   ======================================== */

.pagination {
    margin: 30px 0;
}

.pagination > li > a,
.pagination > li > span {
    font-family: var(--font-primary);
    color: var(--color-primary-green);
    background-color: var(--color-white);
    border: 1px solid var(--color-gray);
    padding: 8px 14px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.pagination > li > a:hover,
.pagination > li > a:focus {
    color: var(--color-white);
    background-color: var(--color-primary-green);
    border-color: var(--color-primary-green);
}

.pagination > .active > a,
.pagination > .active > span,
.pagination > .active > a:hover,
.pagination > .active > span:hover,
.pagination > .active > a:focus,
.pagination > .active > span:focus {
    color: var(--color-white);
    background-color: var(--color-primary-green);
    border-color: var(--color-primary-green);
}

.pagination > .disabled > a,
.pagination > .disabled > span,
.pagination > .disabled > a:hover,
.pagination > .disabled > span:hover,
.pagination > .disabled > a:focus,
.pagination > .disabled > span:focus {
    color: var(--color-gray);
    background-color: var(--color-white);
    border-color: var(--color-gray);
    cursor: not-allowed;
}

/* ========================================
   Responsive Adjustments
   ======================================== */

/* Center pagination in list view to match Figma */
.results-pagination-center { text-align: center; }
.results-pagination-center .pagination { display: inline-block; }

@media (max-width: 767px) {
    #filters_modal .modal-dialog {
        margin: 10px;
    }

    #filters_modal .modal-body {
        padding: 16px;
    }

    .listing-card {
        padding: 15px;
    }

    .listing-card-inner {
        flex-direction: column;
        gap: 15px;
    }

    .listing-card-image-wrapper {
        width: 100%;
    }

    .listing-card-image {
        width: 100%;
        height: auto;
        max-height: 250px;
    }

    .listing-card-title {
        font-size: 18px;
    }

    .listing-card-links {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .listing-card-link {
        margin-right: 0;
    }

    #results-map-container {
        height: 450px;
    }

    /* Calendar responsive */
    .calendar-day {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }

    .calendar-day-number {
        font-size: 24px;
    }

    .calendar-event-title {
        font-size: 18px;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .listing-card-image {
        height: 150px;
    }

    .listing-card-title {
        font-size: 18px;
    }
}



/* ========================================
   Accessibility Focus Outlines
   ======================================== */
.view-switcher-btn:focus {
    outline: 2px solid var(--color-accent-light-green);
    outline-offset: 2px;
}

#filters_toggle_btn:focus,
.clear-filters-btn:focus,
.listing-card-link:focus {
    outline: 2px solid var(--color-accent-light-green);
    outline-offset: 2px;
}


/* Map View Text Below Map */
.map-view-text {
    margin-top: 20px;
    padding: 15px 20px;
    background-color: var(--color-bg-pale-green);
    border-radius: 4px;
}

.map-view-text p {
    margin: 0;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .view-switcher-btn,
    .listing-card,
    .map-state-overlay {
        transition: none !important;
        animation: none !important;
    }
}
