:root {
    /* Color variables */
    --primary-color: #cd1e7d;
    --primary-color-light: #e91e63;
    --primary-color-dark: #ad1457;
    --accent-color: #ff8a00;
    --accent-color-light: #fe8a00;
    --accent-color-opacity: rgba(255, 138, 0, 0.51);
    --purple-color: #5c2d91;
    --purple-dark: #512481;
    --text-color: #333;
    --text-color-light: #666;
    --text-color-lighter: #6c757d;
    --border-color: #e0e0e0;
    --border-color-light: #f0f0f0;
    --background-light: #f8f9fa;
    --background-lighter: #f5f5f5;
    --background-gradient: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-color-medium: rgba(0, 0, 0, 0.12);
    --shadow-color-dark: rgba(124, 124, 124, 0.4);

    /* Spacing variables */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Border radius */
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    --border-radius-circle: 50%;

    /* Font sizes */
    --font-size-xs: 0.9rem;
    --font-size-sm: 0.95rem;
    --font-size-md: 1rem;
    --font-size-lg: 1.1rem;
    --font-size-xl: 1.5rem;
    --font-size-xxl: 1.6em;

    /* Transitions */
    --transition-speed: 0.3s ease;
}

.radius-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 5px;
}

.radius-slider-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

#radius-input {
    flex-grow: 1;
    height: 8px;
    border-radius: var(--border-radius-sm);
    -webkit-appearance: none;
    appearance: none;
    background: #ddd;
    outline: none;
}

#radius-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: var(--border-radius-circle);
    background: var(--primary-color-light);
    cursor: pointer;
}

#radius-input::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: var(--border-radius-circle);
    background: var(--primary-color-light);
    cursor: pointer;
    border: none;
}

#radius-value {
    font-weight: 600;
    color: var(--primary-color-light);
    min-width: 40px;
}

.distance-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary-color-light);
    color: white;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

#map {
    height: calc(100vh + 30px)!important;
    min-height: 700px !important;
    width: 100% !important;
    border: 1px solid #ccc;
    background-color: var(--background-lighter);
    border-radius: var(--border-radius-md);
    box-shadow: 0 4px 6px var(--shadow-color);
}

@media screen and (max-width: 650px){
    #map {
        height: calc(100% - 400px) !important;
        min-height: 800px !important;
    }
}

.organization-card {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: none;
    transition: var(--transition-speed);
    margin-bottom: var(--spacing-lg);
    cursor: pointer;
    background: white;
}

.organization-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--shadow-color);
    border-color: var(--primary-color-light);
}

.card-header {
    color: var(--accent-color-light);
    border-radius: 10px 10px 0 0 !important;
    padding: var(--spacing-md) 1.25rem;
    border: none;
    display: flex;
    align-items: center;
    background-color: #fff;
}

.card-title {
    color: var(--primary-color);
    font-size: var(--font-size-xl);
}

.btn-view-map {
    background: var(--primary-color-dark);
    font-size: var(--font-size-lg)!important;
    color: white;
    border: none;
    border-radius: var(--border-radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    font-weight: 500;
    transition: var(--transition-speed);
}

.btn-view-map:hover {
    background: var(--primary-color);
    transform: translateY(-1px);
}

.btn-events {
    background: var(--accent-color-light);
    border: none;
    border-radius: var(--border-radius-md);
    padding: var(--spacing-xs) var(--spacing-md);
    font-weight: 500;
    transition: var(--transition-speed);
}

.btn-events:hover {
    background: var(--accent-color);
    transform: translateY(-1px);
}

.btn-events.active {
    background: var(--accent-color-opacity);
}

.event-marker {
    background: transparent;
    color: white;
    border-radius: var(--border-radius-circle);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 3px solid white;
    font-size: 16px;
}

.btn, .button {
    font-size: 14px !important;
}

.sidebar {
    height: calc(100vh + 100px);
    overflow-y: auto;
    padding-right: var(--spacing-md);
}

@media screen and (max-width: 650px) {
    .sidebar {
        height: 100% !important;
    }
}

.status-badge {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 1000;
    max-width: 300px;
}

/* Map controls */
.map-controls-row {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius-md);
    padding: 15px;
    box-shadow: 0 2px 8px var(--shadow-color);
    margin-bottom: 15px;
}

.control-group-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.radius-control-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .control-group-row, .radius-control-row {
        margin-bottom: 10px;
        width: 100%;
    }

    .map-controls-row {
        padding: 10px;
    }
}

.control-group {
    margin-bottom: 10px;
}

.radius-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-label {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
    display: block;
    font-size: 14px;
}

.btn-control {
    background: var(--primary-color);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: var(--border-radius-md);
    font-size: 13px;
    margin-right: 8px;
    margin-bottom: 5px;
    transition: var(--transition-speed);
}

.btn-control:hover {
    background: var(--accent-color);
    transform: translateY(-1px);
}

.btn-control.active {
    background: var(--purple-dark);
    box-shadow: 0 4px 15px var(--shadow-color-dark);
}

.legend {
    margin-top: 10px;
    font-size: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    margin-right: 8px;
    border: 1px solid #ccc;
}

.maplibregl-popup-content {
    padding: 15px;
    border-radius: var(--border-radius-md);
    box-shadow: 0 4px 15px var(--shadow-color);
    min-width: 300px;
}

.custom-marker {
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    width: auto !important;
    height: auto !important;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none !important;
    padding: 0 !important;
}

.events-section {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
    background: var(--background-gradient);
    border-top: 1px solid var(--border-color);
}

.events-section.expanded {
    max-height: 800px;
    overflow-y: scroll;
}

.events-content {
    padding: var(--spacing-lg);
}

.event-item {
    background: white;
    padding: 1.25rem;
    border-left: 4px solid var(--primary-color);
    transition: var(--transition-speed);
    border: 1px solid var(--border-color-light);
}

.event-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px var(--shadow-color-medium);
    border-left-color: var(--primary-color-dark);
}

.event-item:last-child {
    margin-bottom: 0;
}

.event-title {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: var(--spacing-xs);
    font-size: var(--font-size-lg);
    display: flex;
    align-items: center;
}

.event-title-icon {
    margin-right: 8px;
    font-size: 1.2rem;
}

.event-time {
    font-size: var(--font-size-xs);
    color: var(--text-color-light);
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
}

.event-description {
    color: #555;
    line-height: 1.6;
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-sm);
}

.event-map-link {
    color: #7c4dff;
    text-decoration: none;
    font-weight: 500;
    font-size: var(--font-size-xs);
    display: flex;
    align-items: center;
}

.event-map-link:hover {
    text-decoration: underline;
    color: #651fff;
}

.event-map-link::before {
    margin-right: 6px;
}

.events-header {
    background: var(--accent-color);
    color: white;
    padding: var(--spacing-md) var(--spacing-lg);
    margin: 0;
    font-weight: 600;
    border-radius: 0;
}

.maplibregl-marker svg {
    display: none !important;
}

.hidden-by-radius {
    display: none !important;
}

/* Filter form styles */
.filter-section {
    background: #f9f9f9;
    padding: 20px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.filter-title {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--text-color);
    font-weight: 600;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: var(--border-radius-sm);
    background-color: white;
    font-size: 14px;
}

.form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: var(--border-radius-sm);
    background-color: white;
    font-size: 14px;
}

.btn-primary {
    background: var(--primary-color-dark);
    font-size: var(--font-size-lg)!important;
    color: white;
    border: none;
    border-radius: var(--border-radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    font-weight: 500;
    transition: var(--transition-speed);
}

.btn-secondary {
    background: var(--text-color-lighter);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    cursor: pointer;
}

.filter-results-info {
    background: #e8f4f8;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    color: #0c5460;
    border: 1px solid #bee5eb;
    display: flex;
    align-items: center;
}

/* Filter components */
.filters-section {
    padding: 20px;
}

.filters-section h3 {
    color: var(--purple-color);
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 500;
}

.filter-group {
    margin-bottom: 25px;
}

.filter-group h5 {
    color: var(--text-color)!important;
    font-size: var(--font-size-lg)!important;
    font-weight: 600;
    margin-bottom: 10px;
}

/* FacetWP input styles */
.facetwp-facet input.facetwp-search,
.facetwp-type-search input,
.facetwp-type-fselect .fs-wrap,
.facetwp-facet input[type="text"], .postcode-field {
    border: 3px solid #cdcdcd;
    background-color: white;
    font-family: "Lato", sans-serif;
    color: #2b2b2b;
    font-size: 1.125em;
    padding: 8px 10px;
    width: 100%;
    -webkit-appearance: none;
    border-radius: 9px;
    min-height: 46px;
}
.fs-label-wrap {
    border: none !important;
}

.fs-dropdown {
    margin-left: -10px;
}

/* FacetWP dropdown styles */
.facetwp-facet select,
.facetwp-type-dropdown select {
    border: 3px solid #cdcdcd;
    background-color: white;
    font-family: "Lato", sans-serif;
    color: #2b2b2b;
    font-size: 1.125em;
    padding: 8px 10px;
    width: 100%;
    -webkit-appearance: none;
    border-radius: 9px;
    min-height: 46px;
}

/* FacetWP slider styles */
.facetwp-type-slider .facetwp-slider-wrap {
    margin-bottom: 10px;
}

.facetwp-slider-label {
    font-size: 14px;
    color: var(--text-color);
}

/* Reset button styles */
button.btn-secondary {
    background-color: var(--text-color-lighter);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
}

.btn-reset-filters {
    background-color: var(--text-color-lighter);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    display: inline-block;
    margin-top: 10px;
}

.result-count {
    font-size: 14px;
    color: var(--text-color);
    margin-top: 15px;
    margin-bottom: 15px;
}

/* FacetWP checkbox styles */
.facetwp-checkbox,
.facetwp-type-checkboxes .facetwp-checkbox {
    display: block;
    margin-bottom: 5px;
    padding-left: 25px;
    position: relative;
}

/* FacetWP slider styles */
.facetwp-type-slider .noUi-connect {
    background-color: #007bff;
}

.facetwp-slider-reset {
    color: #007bff;
    cursor: pointer;
}

.facetwp-input-wrap {
    width: 100%;
}

/* Filters container */
.filters-container {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    margin-bottom: 20px;
    overflow: hidden;
}

/* Filters header */
.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: var(--background-light);
    border-bottom: 1px solid var(--border-color);
}

.filters-header h2 {
    margin: 0;
    font-size: var(--font-size-xl);
    display: flex;
    align-items: center;
}

.filter-toggle {
    cursor: pointer;
    margin-left: 10px;
    transition: transform 0.3s ease;
    display: inline-block;
}

.filter-toggle.active {
    transform: rotate(180deg);
}

.result-count-header {
    font-size: 14px;
    color: var(--text-color-lighter);
}

/* Filters content animation */
.filters-section {
    display: none;
    padding: 0;
    overflow: hidden;
    transition: height 0.5s ease, padding 0.5s ease;
    border-top: 0;
}

.filters-section.expanded {
    height: auto;
    display: block;
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

/* Hide content when collapsed */
.filters-section:not(.expanded) > * {
    display: none;
}

/* Show content when expanded */
.filters-section.expanded > * {
    display: block;
}

.filters-section.expanded > .row {
    display: flex;
}

/* Filter group */
.filter-group {
    margin-bottom: 20px;
}
.filter-group h5 {
    color: var(--purple-color);
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 10px;
}
#search-form-toggle, .toggle-box a {
    font-size: 20px!important;
    font-weight: 700!important;
}
.toggle-box {
    text-align: end;
}
.view-events {
    background-color: var(--accent-color);
}
.facetwp-selections li {
    display: inline-block;
    line-height: 1;
    border: 2px solid #ad1457;
    padding: 15px;
    border-radius: 5px;
    background-color: #ad1457fc;
    color: #fff;
    margin-left: 2px;
    margin-top: 10px;
}
.facetwp-selection-label {
    font-weight: 700!important;
}