/* ═══════════════════════════════════════════════════════════════════════════
   GdzieCwiczyc.pl — Modern CSS with Glassmorphism
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --primary-dark: #3730A3;
    --accent: #10B981;
    --accent-light: #34D399;
    --warning: #F59E0B;
    --danger: #EF4444;
    --bg: #F0F2F5;
    --card-bg: rgba(255, 255, 255, 0.85);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --text: #1F2937;
    --text-muted: #6B7280;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --radius: 16px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
}

/* ─── Navbar ──────────────────────────────────────────────────────────────── */
.navbar {
    backdrop-filter: blur(20px);
    background: rgba(17, 24, 39, 0.9) !important;
    z-index: 1050;
    padding: 0.4rem 0.75rem;
    height: 48px;
}

.navbar-brand {
    font-size: 1.1rem;
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.navbar-actions {
    flex-shrink: 0;
    flex-wrap: nowrap !important;
}

/* ─── Search Bar + Controls ──────────────────────────────────────────────── */
.search-bar-container {
    position: fixed;
    top: 48px;
    left: 0;
    right: 0;
    z-index: 1040;
    padding: 0.25rem 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.3);
}

.search-input-group {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.search-input-group .form-control {
    border-radius: 50px;
    border: 2px solid transparent;
    padding: 0.5rem 1.25rem;
    font-size: 0.95rem;
    transition: var(--transition);
}

.search-input-group .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

/* Shared button style in search bar */
.btn-search-bar {
    border-radius: 50px;
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    transition: var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    height: 100%;
}

.btn-search-bar:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Filters toggle button */
.btn-filters-toggle {
    position: relative;
    padding-right: 30px;
}

.filter-toggle-label {
    font-size: 0.85rem;
}

#filtersCountBadge {
    font-size: 0.7rem;
    padding: 0.15em 0.4em;
    line-height: 1;
}

/* Sort select in search bar */
.sort-select-top {
    width: auto;
    min-width: 110px;
    max-width: 150px;
    border-radius: 50px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background-color: rgba(255, 255, 255, 0.2);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    color: white;
    font-size: 0.85rem;
    padding: 0.4rem 2rem 0.4rem 0.75rem;
    height: auto;
}

.sort-select-top option {
    color: #333;
    background: white;
}

/* Sort direction button */
.btn-sort-dir {
    font-size: 1.1rem;
    font-weight: bold;
    padding: 0.4rem 0.6rem;
    line-height: 1;
    min-width: 36px;
    justify-content: center;
}

.btn-sort-dir.sort-desc {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Visual separator between filters and sort */
.search-bar-divider {
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
    align-self: center;
}

@media (max-width: 768px) {
    .search-input-group {
        flex-wrap: wrap;
    }
    .search-input-group .position-relative {
        flex: 1 1 100%;
    }
    .sort-select-top {
        flex: 1;
        min-width: 0;
    }
    .btn-filters-toggle {
        flex: 1;
        min-width: 0;
    }
    .btn-sort-dir {
        flex: 0 0 auto;
    }
}

/* Suggestions dropdown */
.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1060;
    display: none;
    margin-top: 4px;
}

.suggestions-dropdown.active {
    display: block;
}

.suggestion-item {
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s;
    font-size: 0.9rem;
}

.suggestion-item:hover,
.suggestion-item.suggestion-active {
    background: #EEF2FF;
}

.suggestion-item:last-child {
    border-bottom: none;
}

/* ─── Main Content ────────────────────────────────────────────────────────── */
.main-content {
    margin-top: var(--search-bar-bottom, 140px);
    padding-bottom: 60px;
}

/* ─── Map ─────────────────────────────────────────────────────────────────── */
.map-container {
    position: sticky;
    top: var(--search-bar-bottom, 140px);
    height: calc(100vh - var(--search-bar-bottom, 140px) - 50px);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    z-index: 1;
}

.map-container .leaflet-popup-content-wrapper {
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

/* Custom numbered pin markers — SVG teardrop */
.gym-marker {
    transition: transform 0.2s;
    line-height: 1;
}

.gym-marker svg {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.gym-marker:hover {
    transform: scale(1.2);
    z-index: 999 !important;
}

/* Fix #27b: Highlighted marker — smooth CSS class transition */
.gym-marker-highlighted svg .pin-bg {
    fill: #f59e0b;
}

.gym-marker-highlighted svg {
    filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.6));
}

.search-marker {
    background: var(--danger) !important;
    width: 16px;
    height: 16px;
    border: 3px solid white;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ─── Stats Bar — Fix #6: z-index above search bar ─────────────────────── */
.stats-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 10;
}

.stats-text {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
}

o/* ─── Results Grid ────────────────────────────────────────────────────────── */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

@media (max-width: 768px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── Result Card ─────────────────────────────────────────────────────────── */
.result-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--glass-border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 0.3s;
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.result-card:hover::before {
    opacity: 1;
}

/* Inline pin marker on cards — SVG teardrop, same shape as map markers */
.card-location {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 0.4rem;
}

.card-pin {
    flex-shrink: 0;
    margin-top: 1px;
    line-height: 1;
}

.card-pin svg {
    display: block;
}

.card-location-text {
    flex: 1;
    min-width: 0;
}

.card-class-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.3rem;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
}

.card-meta-item {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.card-meta-item i {
    margin-right: 0.25rem;
}

/* Time section */
.card-time-section {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
}

.card-time {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--primary);
}

.card-duration-inline {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
}

.card-date {
    font-size: 0.85rem;
    color: var(--text);
}

.card-day-of-week {
    font-weight: 600;
    color: var(--primary);
}

/* Location section — .card-location defined above with pin layout */

.card-club {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.card-location-detail {
    display: flex;
    align-items: flex-start;
    gap: 0;
    margin-top: 0.15rem;
}

.card-distance {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
    margin-right: 0.4rem;
}

.card-address {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.card-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.6rem;
}

.card-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.badge-category {
    background: #EEF2FF;
    color: var(--primary);
}

.badge-dyscyplina {
    background: #F0FDF4;
    color: #166534;
}

.badge-intensity {
    background: #FFF7ED;
    color: #9A3412;
}

.badge-free {
    background: #ECFDF5;
    color: var(--accent);
}

.badge-card {
    background: #EFF6FF;
    color: #1D4ED8;
}

.badge-link {
    background: var(--primary);
    color: white;
}

.badge-link:hover {
    background: var(--primary-dark);
    color: white;
}

.card-trainer {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.card-duration {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ─── Card Action Menu ─────────────────────────────────────────────────────── */
.card-action-menu {
    position: fixed;
    z-index: 1100;
    background: #e4e7f2;
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(79, 70, 229, 0.25);
    min-width: 180px;
    max-width: min(280px, calc(100vw - 16px));
    overflow: hidden;
    animation: slideDown 0.15s ease-out;
}

.card-action-close {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    padding: 0;
}
.card-action-close:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.card-action-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s;
    overflow-wrap: break-word;
    word-break: break-word;
}

.card-action-menu-item:hover {
    background: rgba(79, 70, 229, 0.08);
}

.card-action-menu-item:first-child {
    padding-top: 0.7rem;
}

.card-action-menu-item:last-child {
    padding-bottom: 0.7rem;
}

.card-action-divider {
    height: 1px;
    background: rgba(79, 70, 229, 0.12);
    margin: 0.3rem 0.75rem;
}

.card-action-header {
    padding: 0.35rem 1rem 0.2rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
    opacity: 0.7;
}

/* ─── Mobile Map Overlay ──────────────────────────────────────────────────── */
.map-overlay-close {
    display: none;
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 1001;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-size: 36px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--text);
    transition: var(--transition);
}

.map-overlay-close:hover {
    background: #F3F4F6;
}

/* ─── Map Popup Actions ───────────────────────────────────────────────────── */
.popup-actions {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.popup-action-btn {
    display: block;
    padding: 4px 8px;
    font-size: 12px;
    color: var(--primary);
    background: #EEF2FF;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    text-align: left;
    width: 100%;
}

.popup-action-btn:hover {
    background: #E0E7FF;
}

/* ─── Filters Panel (dropdown from search bar) ──────────────────────────── */
.filters-panel {
    position: fixed;
    top: var(--search-bar-bottom, 108px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1035;
    width: min(420px, calc(100vw - 20px));
    max-height: calc(100vh - var(--search-bar-bottom, 140px) - 20px);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: 0 0 var(--radius) var(--radius);
    border: 1px solid var(--glass-border);
    border-top: none;
    box-shadow: var(--shadow);
    transition: opacity 0.2s, transform 0.2s;
    overflow: hidden;
}

.filters-panel.collapsed {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(-10px);
    max-height: 0;
}

.filters-body {
    padding: 0.5rem;
}

/* Clear filters inline button inside toggle */
.filter-clear-inline {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 0.7rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}

.filter-clear-inline:hover {
    background: rgba(255, 255, 255, 0.6);
}

.filters-scroll {
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    padding-right: 0.25rem;
}

.filters-scroll::-webkit-scrollbar {
    width: 4px;
}

.filters-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

/* ─── Filter Sections ─────────────────────────────────────────────────────── */
.filter-section {
    margin-bottom: 0.5rem;
    padding: 0.4rem 0.25rem 0.35rem;
    border: 1px solid rgba(79, 70, 229, 0.18);
    border-radius: 10px;
    background: rgba(79, 70, 229, 0.06);
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.06);
}

.filter-section:last-of-type {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.filter-section-title {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
    margin-bottom: 0.35rem;
    padding: 0 0.15rem;
}

/* ─── Filter Item (icon + control row) ─────────────────────────────────────── */
.filter-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0 0.25rem;
}

.filter-item-icon {
    font-size: 1rem;
    flex-shrink: 0;
    width: 1.5rem;
    text-align: center;
}

/* ─── Intensity Signal-Strength Pills ─────────────────────────────────────── */
.intensity-inline {
    display: flex;
    flex: 1;
    min-width: 0;
}

.intensity-pills {
    display: flex;
    gap: 4px;
    width: 100%;
}

.intensity-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 5px 2px 3px;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    flex: 1;
    min-width: 0;
}

.intensity-pill:hover:not(.intensity-disabled) {
    filter: brightness(0.95);
}

.intensity-pill.intensity-disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

.intensity-pill.intensity-selected {
    border-color: currentColor;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* Signal bars icon */
.signal-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
}

.signal-bar {
    width: 6px;
    border-radius: 1px;
    background: #bbb;
    transition: background 0.2s;
}

.signal-bar.bar-1 { height: 3px; }
.signal-bar.bar-2 { height: 7px; }
.signal-bar.bar-3 { height: 10px; }
.signal-bar.bar-4 { height: 14px; }

/* Active bars are black */
.signal-bars.bars-1 .signal-bar.bar-1 { background: #333; }
.signal-bars.bars-2 .signal-bar.bar-1,
.signal-bars.bars-2 .signal-bar.bar-2 { background: #333; }
.signal-bars.bars-3 .signal-bar.bar-1,
.signal-bars.bars-3 .signal-bar.bar-2,
.signal-bars.bars-3 .signal-bar.bar-3 { background: #333; }
.signal-bars.bars-4 .signal-bar.bar-1,
.signal-bars.bars-4 .signal-bar.bar-2,
.signal-bars.bars-4 .signal-bar.bar-3,
.signal-bars.bars-4 .signal-bar.bar-4 { background: #333; }

/* Unknown intensity — question mark over bars */
.signal-bars.bars-0 {
    position: relative;
}
.signal-bars.bars-0 .signal-bar { background: #ccc; }
.signal-bars.bars-0 .signal-question {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 20px;
    font-weight: 700;
    color: inherit;
    line-height: 1;
}

/* Intensity pill label */
.intensity-pill-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    line-height: 1.1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.intensity-pill.intensity-selected .intensity-pill-label {
    color: currentColor;
    font-weight: 600;
}

/* Intensity color variants — subtle background tint */
.intensity-pill[data-level="1"] { color: #4caf50; background: rgba(76, 175, 80, 0.12); }
.intensity-pill[data-level="2"] { color: #f9c805; background: rgba(249, 200, 5, 0.15); }
.intensity-pill[data-level="3"] { color: #f57c00; background: rgba(245, 124, 0, 0.15); }
.intensity-pill[data-level="4"] { color: #c62828; background: rgba(198, 40, 40, 0.14); }
.intensity-pill[data-level="0"] { color: var(--primary); background: rgba(79, 70, 229, 0.12); }

/* ─── Gender Silhouette Pills ──────────────────────────────────────────────── */
.gender-inline {
    display: flex;
    flex: 1;
    min-width: 0;
}

.gender-pills {
    display: flex;
    gap: 4px;
    width: 100%;
}

.gender-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 5px 4px 3px;
    border-radius: 8px;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    flex: 1;
    min-width: 0;
}

.gender-pill:hover:not(.gender-disabled) {
    background: rgba(255, 255, 255, 0.6);
}

.gender-pill.gender-disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

.gender-pill.gender-selected {
    border-color: currentColor;
    background: rgba(255, 255, 255, 0.55);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.gender-silhouettes {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 24px;
    position: relative;
}

.gender-silhouettes .gender-svg {
    display: inline-flex;
    align-items: flex-end;
}

.gender-silhouettes .gender-svg svg {
    height: 24px;
    width: auto;
}

.gender-silhouettes .silhouette-active {
    opacity: 1;
    filter: none;
}

.gender-silhouettes .silhouette-inactive {
    opacity: 0.4;
    filter: grayscale(1);
}

.gender-question-overlay {
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    pointer-events: none;
}

.gender-pill-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    line-height: 1.1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.gender-pill.gender-selected .gender-pill-label {
    color: currentColor;
    font-weight: 600;
}

/* Gender color variants */
.gender-pill[data-gender="K"] { color: #e91e8c; }
.gender-pill[data-gender="M"] { color: #2196F3; }
.gender-pill[data-gender="dowolna"] { color: #7c4dff; }
.gender-pill[data-gender="?"] { color: #999; }

/* ─── Segmented Control ────────────────────────────────────────────────────── */
.segmented-control {
    display: flex;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.segment-btn {
    flex: 1;
    padding: 0.4rem 0.5rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    position: relative;
    border-right: 1px solid rgba(0, 0, 0, 0.12);
}

.segment-btn:last-child {
    border-right: none;
}

.segment-btn:hover {
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary);
}

.segment-btn.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
    border-right-color: rgba(255, 255, 255, 0.3);
}

.segment-btn.active:hover {
    background: var(--primary-dark);
}

/* Custom date segment */
.segment-btn-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding-right: 0.4rem;
}

.segment-custom-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.segment-custom-clear {
    font-size: 0.65rem;
    opacity: 0.7;
    cursor: pointer;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: opacity 0.2s;
}

.segment-custom-clear:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.3);
}

.segment-btn.active .segment-custom-clear:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ─── Date Calendar Popup ──────────────────────────────────────────────────── */
/* Inline within filter panel — avoids clipping from filters-panel overflow:hidden
   and containing-block issues caused by transform/backdrop-filter on ancestors */
.date-calendar-popup {
    position: relative;
    z-index: 1060;
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    padding: 0.75rem;
    width: 100%;
    max-width: 320px;
    margin: 0.5rem auto 0;
}

/* Ensure the filter-item with date is positioned relatively for popup positioning ref */
.filter-item[data-filter="dates"] {
    position: relative;
    flex-wrap: wrap;
}

/* ─── Time Filter Inline ───────────────────────────────────────────────────── */
.time-filter-inline {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
    min-width: 0;
}

.time-filter-inline .time-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

.time-filter-inline .form-select {
    flex: 1;
    min-width: 0;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    background-color: rgba(255, 255, 255, 0.6);
}

.time-filter-inline .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* ─── Distance Slider Inline ───────────────────────────────────────────────── */
.distance-slider-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.distance-slider-inline .form-range {
    flex: 1;
    min-width: 60px;
}

.distance-slider-inline .distance-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
    min-width: 40px;
    text-align: right;
}

/* ─── Filter Groups ───────────────────────────────────────────────────────── */
.filter-group {
    margin-bottom: 0.5rem;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-sm);
    transition: background 0.2s;
    font-size: 0.85rem;
}

.filter-header:hover {
    background: rgba(255, 255, 255, 0.8);
}

.filter-label {
    font-weight: 600;
    color: var(--text);
}

.filter-summary {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 500;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
}

.filter-content {
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

/* ─── Checkbox list ───────────────────────────────────────────────────────── */
.checkbox-list {
    max-height: 200px;
    overflow-y: auto;
}

.checkbox-list label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0;
    font-size: 0.85rem;
    cursor: pointer;
}

.checkbox-list input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* ─── Filter search input (Fix #10) ───────────────────────────────────────── */
.filter-search {
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.6);
    transition: var(--transition);
}

.filter-search:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* ─── Filter option category label (Fix #28) ─────────────────────────────── */
.filter-category-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 0.4rem;
    opacity: 0.7;
}

/* ─── Filter search bold highlight (Fix #29) ─────────────────────────────── */
.filter-option-text strong,
.filter-category-label strong {
    color: var(--primary);
    font-weight: 700;
    background: rgba(79, 70, 229, 0.08);
    border-radius: 2px;
    padding: 0 1px;
}

/* ─── Date Calendar ───────────────────────────────────────────────────────── */
.date-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    text-align: center;
    font-size: 0.8rem;
}

.day-header {
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.3rem;
    font-size: 0.7rem;
}

.day-cell {
    padding: 0.4rem;
    border-radius: 4px;
    cursor: default;
    transition: var(--transition);
}

.day-cell.available {
    cursor: pointer;
    background: #EEF2FF;
    color: var(--primary);
    font-weight: 500;
}

.day-cell.available:hover {
    background: #C7D2FE;
}

.day-cell.selected {
    background: var(--primary) !important;
    color: white !important;
    font-weight: 700;
}

.day-cell.disabled {
    color: #D1D5DB;
    background: transparent;
}

/* ─── Range Slider ────────────────────────────────────────────────────────── */
.range-slider {
    padding: 0.5rem 0;
}

.range-slider .form-range {
    width: 100%;
}

/* ─── Pill buttons ────────────────────────────────────────────────────────── */
.pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.pill-btn {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text);
}

.pill-btn:hover {
    background: #EEF2FF;
    border-color: var(--primary-light);
}

.pill-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pill-btn-sm {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
}

/* ─── Age filter ──────────────────────────────────────────────────────────── */
.age-clear-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.2s;
}

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

/* ─── Footer ──────────────────────────────────────────────────────────────── */
.footer {
    background: rgba(17, 24, 39, 0.9);
    color: white;
    padding: 1rem;
    font-size: 0.85rem;
}

.footer a {
    color: white;
    transition: color 0.2s;
}

.footer a:hover {
    color: var(--primary-light);
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .filters-panel {
        width: calc(100% - 10px);
        top: var(--search-bar-bottom, 140px);
    }

    .filters-scroll {
        max-height: calc(100vh - var(--search-bar-bottom, 140px) - 40px);
    }

    .main-content {
        margin-top: var(--search-bar-bottom, 140px);
    }

    .map-container {
        aspect-ratio: 1;
        max-height: 50vh;
        min-height: 200px;
        height: auto;
        position: sticky;
        top: var(--search-bar-bottom, 140px);
        z-index: 10;
    }

    .stats-bar {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Mobile map overlay — full screen below search bar */
    .map-container.map-overlay-active {
        position: fixed;
        top: var(--search-bar-bottom, 140px);
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        height: auto !important;
        aspect-ratio: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        border-radius: 0;
    }

    .map-overlay-close.map-overlay-visible {
        display: flex;
    }
}
