/**
 * HRW Restaurant Search — Refined Styles
 *
 * Design tokens derived from Figma exports:
 * - Brand green: #78C814
 * - Pill radius: 14.5px desktop / 9.5px mobile
 * - Card images: 206px desktop / 110px mobile
 * - Text: #333 primary, #555 secondary, #888 muted
 */

:root {
    --hrw-green: #78C814;
    --hrw-green-dark: #69ae10;
    --hrw-green-subtle: rgba(120, 200, 20, 0.08);
    --hrw-red: #c1272d;
    --hrw-bg: #f7f7f8;
    --hrw-card-bg: #ffffff;
    --hrw-text: #2d2d2d;
    --hrw-text-secondary: #555555;
    --hrw-text-muted: #888888;
    --hrw-border: #e2e2e2;
    --hrw-border-light: #efefef;
    --hrw-pill-inactive-border: #c0c0c0;
    --hrw-filter-panel-bg: rgba(217, 217, 217, 0.25);
    --hrw-radius: 8px;
    --hrw-radius-sm: 6px;
    --hrw-pill-radius: 14.5px;
    --hrw-card-image-w: 136px;
    --hrw-accent-bar: 3px;
    --hrw-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --hrw-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --hrw-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
    --hrw-transition: 0.2s ease;
}

/* ===== Reset ===== */

.hrw-search *,
.hrw-search *::before,
.hrw-search *::after {
    box-sizing: border-box;
}

/* Theme override: prevent parent theme from styling our buttons/inputs */
.hrw-search button,
.hrw-search .hrw-search__pill-toggle,
.hrw-search .hrw-search__toolbar-btn,
.hrw-search .hrw-search__load-more-btn {
    all: unset;
    box-sizing: border-box;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.hrw-search input[type="text"].hrw-search__input {
    all: unset;
    box-sizing: border-box;
    display: block;
    width: 100% !important;
}

.hrw-search {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--hrw-text);
    max-width: 100%;
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Page header (legacy search title / seasonal notice) ===== */

.hrw-search__page-header {
    margin: 28px 16px 12px;
    text-align: center;
}

.hrw-search__page-notice {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--hrw-text);
}

.hrw-search__page-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--hrw-text);
}

@media (max-width: 900px) {
    .hrw-search__page-header {
        margin: 20px 12px 8px;
    }

    .hrw-search__page-notice {
        font-size: 16px;
    }

    .hrw-search__page-title {
        font-size: 18px;
    }
}

/* ===== Desktop Split Layout ===== */

.hrw-search__body {
    display: flex;
    height: calc(100vh - var(--hrw-body-top, 60px));
    min-height: 400px;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
}

.hrw-search__results-panel {
    flex: 0 0 42%;
    max-width: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--hrw-bg);
}

.hrw-search__map-panel {
    flex: 1;
    position: sticky;
    top: 0;
    height: calc(100vh - var(--hrw-body-top, 60px));
    min-height: 400px;
}

.hrw-search__map {
    width: 100%;
    height: 100%;
}

.hrw-search__static-map {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    display: block;
}

.hrw-search__map .mapboxgl-canvas-container,
.hrw-search__map .mapboxgl-canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ===== Filter Bar ===== */

.hrw-search__filters {
    background: var(--hrw-card-bg);
    padding: 12px 16px 10px;
    border-bottom: 1px solid var(--hrw-border);
    flex-shrink: 0;
}

.hrw-search__filters-inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hrw-search__search-input-wrap {
    width: 100%;
}

.hrw-search input[type="text"].hrw-search__input {
    width: 100% !important;
    padding: 10px 14px 10px 42px !important;
    border: 1.5px solid var(--hrw-border) !important;
    border-radius: var(--hrw-pill-radius) !important;
    font-size: 13px !important;
    outline: none !important;
    transition: border-color var(--hrw-transition), box-shadow var(--hrw-transition);
    background: var(--hrw-card-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") 14px center no-repeat !important;
    color: var(--hrw-text) !important;
    line-height: 20px !important;
    height: 40px !important;
    min-height: 40px !important;
    margin: 0 !important;
    text-transform: none !important;
    vertical-align: middle !important;
}

.hrw-search__input:focus {
    border-color: var(--hrw-green);
    box-shadow: 0 0 0 3px rgba(120, 200, 20, 0.12);
}

.hrw-search__input::placeholder {
    color: var(--hrw-text-muted);
    line-height: 20px;
    opacity: 1;
}

/* ===== Quick dietary filters (cuisine shortcuts) ===== */

.hrw-search__quick-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.hrw-search .hrw-search__quick-filter {
    padding: 5px 12px !important;
    border: 1px solid var(--hrw-pill-inactive-border) !important;
    border-radius: var(--hrw-pill-radius) !important;
    background: var(--hrw-card-bg) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    color: var(--hrw-text-secondary) !important;
    line-height: 1.2 !important;
    letter-spacing: 0.01em !important;
    text-transform: none !important;
    min-height: 26px !important;
    height: auto !important;
    cursor: pointer;
    transition: border-color var(--hrw-transition), color var(--hrw-transition), background var(--hrw-transition);
}

.hrw-search .hrw-search__quick-filter:hover {
    border-color: var(--hrw-green) !important;
    color: var(--hrw-green-dark) !important;
}

.hrw-search .hrw-search__quick-filter.active {
    border-color: var(--hrw-green) !important;
    background: var(--hrw-green-subtle) !important;
    color: var(--hrw-green-dark) !important;
}

/* ===== Filter Pills Row ===== */

.hrw-search__pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.hrw-search__pill-group {
    position: relative;
}

.hrw-search .hrw-search__pill-toggle {
    gap: 5px !important;
    padding: 5px 10px !important;
    border: 1px solid var(--hrw-pill-inactive-border) !important;
    border-radius: var(--hrw-pill-radius) !important;
    background: var(--hrw-card-bg) !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    color: var(--hrw-text-secondary) !important;
    white-space: nowrap !important;
    transition: border-color var(--hrw-transition), color var(--hrw-transition), background var(--hrw-transition);
    line-height: 1.2 !important;
    letter-spacing: 0.01em !important;
    text-transform: none !important;
    min-height: 26px !important;
    height: auto !important;
    overflow: visible !important;
}

.hrw-search .hrw-search__pill-toggle:hover {
    border-color: var(--hrw-green) !important;
    color: var(--hrw-text) !important;
    background: var(--hrw-green-subtle) !important;
}

.hrw-search .hrw-search__pill-toggle.active {
    background: var(--hrw-green) !important;
    border-color: var(--hrw-green) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
}

.hrw-search__pill-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    opacity: 0.55;
    transition: transform var(--hrw-transition);
}

.hrw-search__pill-arrow svg {
    display: block;
    width: 10px;
    height: 10px;
}

.hrw-search__pill-toggle.open .hrw-search__pill-arrow {
    transform: rotate(180deg);
}

.hrw-search__pill-toggle.active .hrw-search__pill-arrow {
    opacity: 0.9;
}

/* ===== Filter Dropdown Panel ===== */

.hrw-search__pill-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 100;
    background: var(--hrw-card-bg);
    border: 1px solid var(--hrw-border);
    border-radius: var(--hrw-radius);
    box-shadow: var(--hrw-shadow-lg);
    padding: 10px;
    min-width: 220px;
    max-height: 280px;
    overflow-y: auto;
}

.hrw-search__pill-dropdown-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hrw-search__pill-option {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border: 1px solid var(--hrw-border);
    border-radius: var(--hrw-pill-radius);
    font-size: 12px;
    font-weight: 450;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--hrw-transition);
    background: var(--hrw-card-bg);
    color: var(--hrw-text-secondary);
}

.hrw-search__pill-option:hover {
    border-color: var(--hrw-green);
    background: var(--hrw-green-subtle);
    color: var(--hrw-text);
}

.hrw-search__pill-option.active {
    background: var(--hrw-green);
    border-color: var(--hrw-green);
    color: #ffffff;
    font-weight: 500;
}

.hrw-search__pill-option input[type="checkbox"] {
    display: none;
}

.hrw-search__pill-option.unavailable {
    background: #f5f5f5;
    border-color: #ddd;
    color: #aaa;
    text-decoration: line-through;
    opacity: 0.65;
}

/* ===== Active Filter Chips ===== */

.hrw-search__active-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 20px 12px;
    background: var(--hrw-card-bg);
}

.hrw-search__active-chips:empty {
    display: none;
}

.hrw-search__chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px 4px 8px;
    background: var(--hrw-green);
    color: #ffffff;
    border-radius: var(--hrw-pill-radius);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--hrw-transition);
    letter-spacing: 0.01em;
}

.hrw-search__chip:hover {
    background: var(--hrw-green-dark);
}

.hrw-search__chip-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    transition: background var(--hrw-transition);
}

.hrw-search__chip:hover .hrw-search__chip-x {
    background: rgba(255, 255, 255, 0.4);
}

.hrw-search__chip--map {
    background: #2f5d8c;
}

.hrw-search__chip--map:hover {
    background: #244a70;
}

.hrw-search__card.is-active {
    outline: 2px solid var(--hrw-green);
    outline-offset: -2px;
}

.hrw-map-popup__loading {
    margin: 0 0 6px;
    font-size: 12px;
    color: #777;
    font-style: italic;
}

/* ===== Results Header ===== */

.hrw-search__results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 16px;
    border-bottom: 1px solid var(--hrw-border);
    background: var(--hrw-card-bg);
    flex-shrink: 0;
}

.hrw-search__count {
    font-size: 13px;
    font-weight: 600;
    color: var(--hrw-text-secondary);
    letter-spacing: 0.02em;
}

.hrw-search__sort select {
    border: 1px solid var(--hrw-border);
    border-radius: var(--hrw-radius-sm);
    padding: 5px 10px;
    font-size: 12px;
    background: var(--hrw-card-bg);
    color: var(--hrw-text-secondary);
    cursor: pointer;
    transition: border-color var(--hrw-transition);
}

.hrw-search__sort select:hover {
    border-color: var(--hrw-green);
}

/* ===== Scrollable Results List ===== */

.hrw-search__results-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    transition: filter 0.3s ease, opacity 0.3s ease;
}

@media (min-width: 1440px) {
    .hrw-search__results-panel {
        flex: 0 0 50%;
    }

    .hrw-search__results-list {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .hrw-search__card {
        flex: 0 0 calc(50% - 4px);
        margin-bottom: 0;
    }

    .hrw-search__card-img {
        flex: 0 0 104px !important;
        width: 104px !important;
    }

    .hrw-search__card-title {
        font-size: 13px;
    }

    .hrw-search__card-address,
    .hrw-search__card-city,
    .hrw-search__card-neighborhood,
    .hrw-search__card-phone {
        font-size: 11px;
    }

    .hrw-search__card-tags {
        display: none;
    }

    /* Solo match: full column + larger photo (not a stretched empty body) */
    .hrw-search__results-list--single .hrw-search__card,
    .hrw-search__results-list:has(> .hrw-search__card:only-of-type) .hrw-search__card {
        flex: 0 0 100%;
        min-height: 180px;
    }

    .hrw-search__results-list--single .hrw-search__card-img,
    .hrw-search__results-list:has(> .hrw-search__card:only-of-type) .hrw-search__card-img {
        flex: 0 0 42% !important;
        width: 42% !important;
        max-width: 340px;
        min-height: 180px;
        align-self: stretch;
    }

    .hrw-search__results-list--single .hrw-search__card-title,
    .hrw-search__results-list:has(> .hrw-search__card:only-of-type) .hrw-search__card-title {
        font-size: 16px;
    }

    .hrw-search__results-list--single .hrw-search__card-address,
    .hrw-search__results-list--single .hrw-search__card-city,
    .hrw-search__results-list--single .hrw-search__card-neighborhood,
    .hrw-search__results-list--single .hrw-search__card-phone,
    .hrw-search__results-list:has(> .hrw-search__card:only-of-type) .hrw-search__card-address,
    .hrw-search__results-list:has(> .hrw-search__card:only-of-type) .hrw-search__card-city,
    .hrw-search__results-list:has(> .hrw-search__card:only-of-type) .hrw-search__card-neighborhood,
    .hrw-search__results-list:has(> .hrw-search__card:only-of-type) .hrw-search__card-phone {
        font-size: 13px;
    }

    .hrw-search__results-list--single .hrw-search__card-tags,
    .hrw-search__results-list:has(> .hrw-search__card:only-of-type) .hrw-search__card-tags {
        display: flex;
    }

    .hrw-search__empty {
        flex: 0 0 100%;
    }
}

.hrw-search__results-list.is-loading {
    filter: blur(2px) grayscale(0.3);
    opacity: 0.5;
    pointer-events: none;
}

/* Map loading overlay */
.hrw-search__map-panel.is-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    background: rgba(255, 255, 255, 0.55);
    pointer-events: none;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

@keyframes hrw-map-pulse {
    from {
        opacity: 0.3;
    }

    to {
        opacity: 0.7;
    }
}

/* Mobile filter backdrop + portal (outside overflow ancestors) */
.hrw-search__pill-backdrop {
    display: none;
}

.hrw-search__pill-portal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
}

.hrw-search__pill-portal:empty {
    display: none;
}

.hrw-search__pill-portal .hrw-search__pill-dropdown {
    pointer-events: auto;
}

@media (max-width: 900px) {
    .hrw-search__pill-backdrop.active {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 9998;
        background: rgba(0, 0, 0, 0.35);
    }

    body.hrw-search-sheet-open {
        overflow: hidden;
    }
}

.hrw-search__results-list::-webkit-scrollbar {
    width: 5px;
}

.hrw-search__results-list::-webkit-scrollbar-track {
    background: transparent;
}

.hrw-search__results-list::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 3px;
}

.hrw-search__results-list::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* ===== Search tier headings (text query results) ===== */

.hrw-search__tier-heading {
    flex: 0 0 100%;
    width: 100%;
    margin: 12px 0 6px;
    padding: 0 2px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--hrw-text-muted);
    line-height: 1.3;
}

.hrw-search__tier-heading:first-child {
    margin-top: 4px;
}

/* ===== Restaurant Cards ===== */

.hrw-search__card {
    display: flex;
    gap: 0;
    background: var(--hrw-card-bg);
    border-radius: var(--hrw-radius);
    margin-bottom: 8px;
    cursor: pointer;
    border: 1px solid var(--hrw-border-light);
    overflow: hidden;
    transition: border-color var(--hrw-transition), box-shadow var(--hrw-transition), transform var(--hrw-transition);
    box-shadow: var(--hrw-shadow-sm);
}

.hrw-search__card:hover {
    border-color: var(--hrw-green);
    box-shadow: 0 4px 16px rgba(120, 200, 20, 0.12);
    transform: translateY(-1px);
}

.hrw-search__card-img {
    flex: 0 0 var(--hrw-card-image-w);
    width: var(--hrw-card-image-w);
    min-height: 120px;
    overflow: hidden;
    background: var(--hrw-bg);
}

.hrw-search__card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hrw-search__card-body {
    flex: 1;
    min-width: 0;
    padding: 10px 12px 8px;
    position: relative;
    border-left: var(--hrw-accent-bar) solid var(--hrw-green);
}

.hrw-search__card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 8px;
    line-height: 1.35;
    padding-right: 20px;
    letter-spacing: -0.01em;
}

.hrw-search__card-title a {
    color: var(--hrw-text);
    text-decoration: none;
    transition: color var(--hrw-transition);
}

.hrw-search__card-title a:hover {
    color: var(--hrw-green-dark);
}

/* ===== Reservation Badges ===== */

.hrw-search__card-reservation {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 8px;
}

.hrw-search__card-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: background var(--hrw-transition);
}

.hrw-search__card-badge--walkins {
    background: rgba(120, 200, 20, 0.1);
    color: #4a8a0a;
}

.hrw-search__card-badge--reserve {
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    text-decoration: none;
}

.hrw-search__card-badge--reserve:hover {
    background: rgba(37, 99, 235, 0.15);
}

.hrw-search__card-badge--email {
    background: rgba(217, 119, 6, 0.08);
    color: #b45309;
    text-decoration: none;
}

.hrw-search__card-badge--email:hover {
    background: rgba(217, 119, 6, 0.15);
}

/* ===== Card Tag Pills ===== */

.hrw-search__card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.hrw-search__card-tag {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid var(--hrw-border);
    border-radius: 10px;
    font-size: 10px;
    color: var(--hrw-text-muted);
    white-space: nowrap;
    letter-spacing: 0.02em;
    text-transform: capitalize;
}

.hrw-search__card-tag--more {
    border-style: dashed;
    color: var(--hrw-text-muted);
    font-weight: 500;
}

/* ===== Card Chevron ===== */

.hrw-search__card-chevron {
    position: absolute;
    right: 12px;
    top: 14px;
    color: var(--hrw-text-muted);
    font-size: 16px;
    opacity: 0.3;
    transition: opacity var(--hrw-transition), color var(--hrw-transition);
}

.hrw-search__card:hover .hrw-search__card-chevron {
    opacity: 0.7;
    color: var(--hrw-green);
}

/* ===== Card Address & Phone ===== */

.hrw-search__card-address,
.hrw-search__card-city,
.hrw-search__card-neighborhood {
    margin: 0;
    font-size: 12px;
    color: var(--hrw-text-muted);
    line-height: 1.5;
}

.hrw-search__card-neighborhood {
    font-style: italic;
}

.hrw-search__card-phone {
    margin: 4px 0 0;
    font-size: 12px;
}

.hrw-search__card-phone a {
    color: var(--hrw-green-dark);
    text-decoration: none;
    font-weight: 500;
}

.hrw-search__card-phone a:hover {
    text-decoration: underline;
}

/* ===== Card Image Placeholder ===== */

.hrw-search__card-img--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: var(--hrw-border-light);
    color: #ccc;
}

.hrw-search__card-img--placeholder img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* ===== Reset Button ===== */

.hrw-search__toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
}

.hrw-search .hrw-search__toolbar-btn {
    width: 28px !important;
    height: 28px !important;
    border: 1px solid var(--hrw-border) !important;
    border-radius: var(--hrw-radius-sm) !important;
    background: var(--hrw-card-bg) !important;
    color: var(--hrw-text-muted) !important;
    transition: all var(--hrw-transition);
    padding: 0 !important;
    min-height: 0 !important;
    font-size: 0 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}

.hrw-search .hrw-search__toolbar-btn:hover {
    border-color: var(--hrw-green) !important;
    color: var(--hrw-green) !important;
    background: var(--hrw-green-subtle) !important;
}

.hrw-search .hrw-search__toolbar-btn.active {
    background: var(--hrw-green) !important;
    border-color: var(--hrw-green) !important;
    color: #fff !important;
}

.hrw-search__toolbar-btn svg {
    flex-shrink: 0;
}

.hrw-search__toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--hrw-border);
    margin: 0 2px;
}

/* ===== Load More / Spinner ===== */

.hrw-search__load-more {
    text-align: center;
    padding: 16px 0;
    flex-shrink: 0;
}

.hrw-search .hrw-search__load-more-btn {
    padding: 8px 28px !important;
    background: var(--hrw-green) !important;
    color: #fff !important;
    border: none !important;
    border-radius: var(--hrw-pill-radius) !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    transition: background var(--hrw-transition), transform var(--hrw-transition);
    letter-spacing: 0.02em !important;
    text-transform: none !important;
    min-height: 0 !important;
    height: auto !important;
}

.hrw-search .hrw-search__load-more-btn:hover {
    background: var(--hrw-green-dark) !important;
    transform: translateY(-1px);
}

.hrw-search__spinner {
    width: 28px;
    height: 28px;
    border: 2.5px solid var(--hrw-border);
    border-top-color: var(--hrw-green);
    border-radius: 50%;
    animation: hrw-spin 0.7s linear infinite;
    margin: 16px auto;
}

@keyframes hrw-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Empty State ===== */

.hrw-search__empty {
    text-align: center;
    padding: 56px 24px;
    color: var(--hrw-text-muted);
}

.hrw-search__empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    opacity: 0.35;
    color: var(--hrw-text-muted);
}

.hrw-search__empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--hrw-text-secondary);
    margin-bottom: 6px;
}

.hrw-search__empty-text {
    font-size: 13px;
    color: var(--hrw-text-muted);
    font-weight: 400;
}

/* ===== Map Popup ===== */

.hrw-mapbox-popup .mapboxgl-popup-content {
    padding: 16px 20px 14px 16px;
    border-radius: var(--hrw-radius);
    box-shadow: var(--hrw-shadow-lg);
    min-width: 200px;
}

.hrw-mapbox-popup .mapboxgl-popup-close-button {
    font-size: 18px;
    padding: 4px 8px;
    color: var(--hrw-text-muted);
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    right: 4px;
    top: 4px;
}

.hrw-mapbox-popup .mapboxgl-popup-close-button:hover {
    color: var(--hrw-text);
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.hrw-map-popup {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.hrw-map-popup__image {
    width: 100%;
    max-height: 120px;
    object-fit: cover;
    display: block;
    border-radius: 4px;
    margin-bottom: 8px;
}

.hrw-map-popup__title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 2px;
    color: var(--hrw-text);
    line-height: 1.3;
}

.hrw-map-popup__neighborhood {
    font-size: 12px;
    color: var(--hrw-text-muted);
    margin: 0 0 6px;
}

.hrw-map-popup__cuisine {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: 8px;
}

.hrw-map-popup__cuisine span {
    display: inline-block;
    padding: 1px 6px;
    border: 1px solid var(--hrw-border);
    border-radius: 8px;
    font-size: 10px;
    color: var(--hrw-text-secondary);
}

.hrw-map-popup__badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    margin-bottom: 8px;
}

.hrw-map-popup__badge--walkin {
    background: rgba(120, 200, 20, 0.1);
    color: #4a8a0a;
}

.hrw-map-popup__link {
    display: inline-block;
    padding: 5px 14px;
    background: var(--hrw-green);
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    transition: background var(--hrw-transition);
}

.hrw-map-popup__link:hover {
    background: var(--hrw-green-dark);
}

.hrw-map-popup__actions {
    display: flex;
    gap: 6px;
}

.hrw-map-popup__link--directions {
    background: var(--hrw-card-bg);
    color: var(--hrw-green);
    border: 1px solid var(--hrw-green);
}

.hrw-map-popup__link--directions:hover {
    background: var(--hrw-green-subtle);
    color: var(--hrw-green-dark);
}

/* ===== List View Mode ===== */

.hrw-search__results-list--list .hrw-search__card {
    flex-direction: row;
}

.hrw-search__results-list--list .hrw-search__card-img {
    flex: 0 0 60px;
    width: 60px;
    min-height: 60px;
}

.hrw-search__results-list--list .hrw-search__card-tags,
.hrw-search__results-list--list .hrw-search__card-chevron {
    display: none;
}

.hrw-search__results-list--list .hrw-search__card-body {
    padding: 8px 12px;
}

.hrw-search__results-list--list .hrw-search__card-title {
    font-size: 13px;
    margin: 0 0 4px;
}

.hrw-search__results-list--list .hrw-search__card-reservation {
    margin-bottom: 2px;
}

/* ===== Card Logo Placeholder ===== */

.hrw-search__card-logo {
    max-width: 88%;
    max-height: 72%;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    opacity: 0.35;
}

/* ===== Sort select (hidden, replaced by buttons) ===== */

.hrw-search__sort {
    display: none;
}

/* ===== Map Cluster Toggle ===== */

.hrw-map-cluster-toggle {
    all: unset;
    box-sizing: border-box;
    position: absolute !important;
    top: 10px !important;
    left: 10px !important;
    z-index: 100;
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
    padding: 6px 10px !important;
    background: #fff !important;
    color: var(--hrw-text) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    border: none !important;
    border-radius: 4px !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    line-height: 1 !important;
}

.hrw-map-cluster-toggle[aria-pressed="true"] {
    background: #78C814 !important;
    color: #fff !important;
}

.hrw-map-heatmap-toggle {
    position: absolute;
    top: 96px;
    right: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.hrw-map-heatmap-toggle[aria-pressed="true"] {
    background: #78C814;
    border-color: #78C814;
    color: #fff;
}

.hrw-map-heatmap-toggle.off {
    opacity: 0.9;
}

.hrw-map-cluster-toggle.off {
    opacity: 0.7;
}

/* ===== Image Markers ===== */

.hrw-map-marker {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid #78C814;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    background: #fff;
    transition: transform 0.15s ease;
}

.hrw-map-marker:hover {
    transform: scale(1.2);
    z-index: 10;
}

.hrw-map-marker img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ===== Mobile Map Toggle Button ===== */

.hrw-search__map-toggle {
    all: unset;
    box-sizing: border-box;
    display: none !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px 16px !important;
    background: #78C814 !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border: none !important;
    border-radius: 0 !important;
    cursor: pointer;
    text-align: center;
    line-height: 1.2 !important;
}

.hrw-search__map-toggle svg {
    flex-shrink: 0;
}

.hrw-search__map-toggle[aria-expanded="true"] {
    background: #555 !important;
}

/* ===== Mobile Responsive ===== */

@media (max-width: 900px) {
    :root {
        --hrw-pill-radius: 9.5px;
        --hrw-card-image-w: 110px;
    }

    .hrw-search__body {
        flex-direction: column;
        height: auto;
    }

    .hrw-search__map-toggle {
        display: flex !important;
    }

    .hrw-search__map-panel {
        position: relative;
        height: 50vh;
        min-height: 280px;
        order: -1;
        display: none;
    }

    .hrw-search__map-panel--mobile-visible {
        display: block;
    }

    .hrw-search__map-panel--mobile-visible .hrw-search__map {
        height: 100%;
        min-height: 280px;
    }

    .hrw-search__results-panel {
        flex: none;
        max-width: 100%;
        height: auto;
        max-height: none;
        overflow: visible;
    }

    .hrw-search__results-list {
        overflow-y: visible;
        max-height: none;
    }

    .hrw-search__filters {
        position: sticky;
        top: 0;
        z-index: 50;
        overflow: visible;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    }

    /* iOS Safari zooms focused inputs under 16px — keep visual scale, block zoom. */
    .hrw-search input[type="text"].hrw-search__input {
        font-size: 16px !important;
        line-height: 22px !important;
        height: 44px !important;
        min-height: 44px !important;
        padding: 11px 14px 11px 42px !important;
    }

    .hrw-search__input::placeholder {
        line-height: 22px;
    }

    .hrw-search__filters-inner {
        overflow: visible;
    }

    .hrw-search__pills {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    /* Sheet styles apply when portaled; absolute fallback if still in-tree */
    .hrw-search__pill-dropdown,
    .hrw-search__pill-portal .hrw-search__pill-dropdown {
        position: fixed;
        top: auto;
        left: 8px;
        right: 8px;
        bottom: 0;
        z-index: 10000;
        min-width: 0;
        max-height: min(55vh, 55dvh);
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
        padding: 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        -webkit-overflow-scrolling: touch;
    }

    .hrw-search__pills::-webkit-scrollbar {
        display: none;
    }

    .hrw-search__card-body {
        padding: 10px 12px;
    }

    .hrw-search__card-title {
        font-size: 14px;
        margin: 0 0 6px;
    }

    .hrw-search__card-img {
        min-height: 120px;
    }
}

@media (max-width: 480px) {
    .hrw-search__filters {
        padding: 10px 12px 8px;
    }

    .hrw-search__results-list {
        padding: 8px 12px;
    }

    .hrw-search__card {
        margin-bottom: 8px;
    }
}