/**
 * RM Map Direction Frontend Styles
 *
 * @package RM_Map_Direction
 * @since   1.0.0
 */

:root {
    /* Default Colors */
    --rm-map-primary-color: #0073aa;
    --rm-map-secondary-color: #333333;
    --rm-map-route-color: #3887be;
    --rm-map-tooltip-background-color: #ffffff;
    --rm-map-tooltip-text-color: #333333;
    --rm-map-button-background-color: transparent;
    --rm-map-button-text-color-normal: #0073aa;

    /* Typography */
    --rm-map-font-family-titles: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --rm-map-font-family-descriptions: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --rm-map-font-size-locations-list: 14px; /* Base for list items */
    --rm-map-font-size-tooltip: 13px;
    --rm-map-border-radius: 6px;

    /* List Item Specific - will be overridden by plugin options if set */
    --rm-map-list-item-name-color: #222222;
    --rm-map-list-item-name-size: 15px;
    --rm-map-list-item-number-color: #333333;
    --rm-map-list-item-meta-color: #555555;
    --rm-map-list-item-meta-size: 11px;
    --rm-map-list-item-category-tag-text-color: #ffffff;
    --rm-map-list-item-description-color: #555555;
    --rm-map-list-item-description-size: 13px;
}

.rm-map-direction-wrapper {
	display: flex;
    font-family: var(--rm-map-font-family-descriptions);
    margin-bottom: 20px;
    font-size: var(--rm-map-font-size-locations-list);
}

.rm-map-list-panel {
    width: 35%; 
    padding-right: 0px; 
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    max-height: 80vh; 
    background-color: #f4f2ee; 
    border-right: 1px solid #e0e0e0;
}
.rm-map-direction-wrapper.rm-map-layout-map-left .rm-map-list-panel {
    order: 2; 
    padding-right: 0;
    padding-left: 15px;
    border-right: none;
    border-left: 1px solid #e0e0e0;
}
.rm-map-direction-wrapper.rm-map-layout-map-right .rm-map-list-panel {
    order: 1; 
}

.rm-map-search-container {
    padding: 10px 15px;
    border-bottom: 1px solid #e0e0e0;
}

.rm-map-location-search {
    width: 100%;
    padding: 8px 15px 8px 40px !important;
    font-size: 14px !important;
    font-family: var(--rm-map-font-family-descriptions) !important;
    border: 1px solid #ccc;
    border-radius: var(--rm-map-border-radius); 
    box-sizing: border-box;
    font-size: 0.9em;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="%23777777" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>');
    background-repeat: no-repeat;
    background-position: 12px center; 
}
.rm-map-location-search:focus {
    border-color: var(--rm-map-primary-color);
    outline: none;
    box-shadow: 0 0 0 1px var(--rm-map-primary-color); 
}

.rm-map-category-filter-container { 
    padding: 10px 15px; 
}

.rm-map-location-count-container {
    padding: 8px 15px; 
    font-size: 0.85em;
    background-color: #edeae4;
    color: #555;
}

.rm-map-locations-list-container {
    flex-grow: 1;
	overflow-y: auto;
    padding: 10px 15px; 
}

.mapbox-map-container {
	width: 65%; 
	height: 80vh; 
	box-sizing: border-box;
}
.rm-map-direction-wrapper.rm-map-layout-map-left .mapbox-map-container { order: 1; }
.rm-map-direction-wrapper.rm-map-layout-map-right .mapbox-map-container { order: 2; }

.rm-map-category-filters {
    display: flex;
    gap: 6px; 
    overflow-x: auto; 
    white-space: nowrap; 
    padding-bottom: 5px; 
}

.rm-map-category-filter-button {
    display: flex; 
    flex-direction: column;
    align-items: center;
    justify-content: center; 
    padding: 5px 15px; 
    border: 1px solid #ddd; 
    border-radius: var(--rm-map-border-radius); 
    background-color: #fff; 
    color: #333; 
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    text-align: center;
    min-width: 95px;
    height: auto;
    min-height: 50px;
}

.rm-map-category-filter-button .rm-map-category-filter-icon-wrapper {
    height: 30px; 
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px; 
}

.rm-map-category-icon {
	height: 24px !important; 
    width: auto; 
    max-width: 50px; 
	display: block; 
}

.rm-map-category-filter-name {
    font-size: 10px; 
    line-height: 1.2; 
    display: block; 
    color: inherit; 
}

.rm-map-category-filter-button:hover,
.rm-map-category-filter-button.active {
	background-color: var(--rm-map-primary-color);
    color: #fff; 
    border-color: var(--rm-map-primary-color); 
}
.rm-map-category-filter-button.active .rm-map-category-filter-name,
.rm-map-category-filter-button:hover .rm-map-category-filter-name {
    color: #fff;
}

.rm-map-category-filter-button img.rm-map-category-icon {
	display: block; 
}

.rm-map-locations-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.rm-map-location-item {
    background-color: #fff;
    border-radius: var(--rm-map-border-radius); 
    margin-bottom: 15px; 
    transition: border-color 0.2s ease;
    overflow: hidden; 
    cursor: pointer; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); 
    transition: all 0.2s ease;
}
.rm-map-location-item:hover {
    box-shadow: 2px 6px 20px -8px rgba(0, 0, 0, 0.2);
    background-color: #f9f9f9;
    transform: translate(0px, -3px);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rm-map-location-item.active {
    border-color: var(--rm-map-primary-color); 
    box-shadow: 2px 6px 20px -8px rgba(0, 0, 0, 0.2); 
    transition: all 0.2s ease;
}

.rm-map-location-header {
    display: flex;
    flex-direction: column; /* Stack top and bottom rows */
    padding: 15px; 
    position: relative; 
}

.rm-map-location-header-top-row {
    display: flex;
    align-items: center; 
    width: 100%;
}

.rm-map-location-header-bottom-row {
    display: flex; 
    align-items: center;
    width: 100%; 
    margin-top: 4px; 
    font-size: var(--rm-map-list-item-meta-size, 0.8em); 
    color: var(--rm-map-list-item-meta-color, #555);
}

.rm-map-location-content { 
    padding: 0 10px 8px 10px; 
    display: none; 
}

.rm-map-location-item.active .rm-map-location-content {
    display: block;
    border-top: 1px solid #f0f0f0; 
    padding-top: 8px; 
}

.rm-map-location-category-tag {
    display: inline-block;
    background-color: var(--rm-map-primary-color); 
    color: var(--rm-map-list-item-category-tag-text-color, #fff); 
    padding: 3px 10px; 
    border-radius: 15px;
    font-size: 0.7em; 
    margin-left: 6px; 
    letter-spacing: 0.25px; 
    line-height: 1.2; 
    white-space: nowrap;
    align-self: center; 
}

.rm-map-location-description {
    font-size: var(--rm-map-list-item-description-size, 0.9em); 
    color: var(--rm-map-list-item-description-color, #555); 
    line-height: 1.5;
}

.rm-map-location-toggle-icon {
    margin-left: auto; 
    width: 18px; 
    height: 18px;
    background-color: #555555; 
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"/></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"/></svg>');
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
    transition: transform 0.3s ease, background-color 0.3s ease;
    flex-shrink: 0; 
}

.rm-map-location-item.active .rm-map-location-toggle-icon {
    transform: rotate(-180deg); 
    background-color: var(--rm-map-primary-color); 
}

.rm-map-location-number {
    font-weight: 400; 
    margin-right: 6px; 
    opacity: 0.8;
    color: var(--rm-map-list-item-number-color, #333);
    font-size: var(--rm-map-list-item-name-size, 0.95em);
    align-self: center; 
}

.rm-map-location-name {
    font-weight: 400;
    font-family: 'Chakra Petch' !important;
    color: var(--rm-map-list-item-name-color, #222);
    font-size: var(--rm-map-list-item-name-size, 0.95em);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
    min-width: 0;
    align-self: center;
}

.rm-map-location-meta {
    display: flex; 
    align-items: center;
    flex-wrap: nowrap; 
    white-space: nowrap;
    /* color and font-size are inherited from .rm-map-location-header-bottom-row */
}

.rm-map-location-walking-time,
.rm-map-location-distance {
    margin-right: 10px; 
    display: inline-flex; 
    align-items: center;
}
.rm-map-location-walking-time:last-child,
.rm-map-location-distance:last-child {
    margin-right: 0;
}

.rm-map-icon { 
    display: inline-block;
    width: 1em; 
    height: 1em;
    margin-right: 0.3em;
    vertical-align: -0.1em; 
}

.rm-map-icon svg { 
    width: 100%;
    height: 100%;
    fill: currentColor; 
}

.rm-map-external-link-icon {
    font-size: 0.8em; 
    margin-left: 0.3em;
    opacity: 0.7;
}

.mapboxgl-popup-content {
	padding: 15px;
    font-family: var(--rm-map-font-family-descriptions);
    font-size: var(--rm-map-font-size-tooltip);
    background-color: var(--rm-map-tooltip-background-color);
    color: var(--rm-map-tooltip-text-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-radius: var(--rm-map-border-radius); 
}

.mapboxgl-popup-content h4 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.4em;
    text-transform: uppercase;
    color: var(--rm-map-primary-color); 
    font-family: var(--rm-map-font-family-titles);
}

.mapboxgl-popup-content .rm-map-popup-meta {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}
.mapboxgl-popup-content .rm-map-popup-walking-time,
.mapboxgl-popup-content .rm-map-popup-distance {
    margin-right: 15px;
    display: inline-flex;
    align-items: center;
    color: #000000; 
    text-decoration: underline;
}
.mapboxgl-popup-content .rm-map-popup-walking-time .rm-map-icon svg,
.mapboxgl-popup-content .rm-map-popup-distance .rm-map-icon svg {
    stroke: #000000 !important; 
    fill: #000000 !important; 
}

.mapboxgl-popup-content p.rm-map-popup-description { 
 margin-bottom: 10px; 
    font-family: var(--rm-map-font-family-descriptions);
}

.mapboxgl-popup-close-button {
    color: var(--rm-map-tooltip-text-color);
    padding: 5px;
}
.mapboxgl-popup-close-button:hover {
    background-color: rgba(0,0,0,0.1);
}

.rm-map-popup-learn-more.button { 
    display: inline-block;
    margin-top: 10px;
    padding: 6px 12px;
    background-color: var(--rm-map-primary-color); 
    color: #fff; 
    text-decoration: none;
    border-radius: var(--rm-map-border-radius); 
    font-size: 0.9em;
}
.rm-map-popup-learn-more.button:hover {
    opacity: 0.9;
}

.rm-map-marker {
    background-size: cover;
    width: 30px; 
    height: 30px;
    border-radius: 50%; 
    cursor: pointer;
    border: 2px solid var(--rm-map-primary-color);
    background-color: var(--rm-map-tooltip-background-color); 
    display: flex;
    align-items: center;
    justify-content: center;
}

.rm-map-marker-primary {
    border-color: var(--rm-map-secondary-color); 
}

.rm-map-marker-secondary .rm-map-marker-number {
    font-size: 12px;
    font-weight: bold;
    color: var(--rm-map-primary-color);
}

@media (max-width: 768px) {
    .rm-map-direction-wrapper {
        flex-direction: column;
    }
    .rm-map-list-panel {
        width: 100%;
        order: 2; 
        max-height: 60vh; 
        border-right: none;
        padding-right: 0;
        padding-left: 0;
    }

    .mapbox-map-container {
        width: 100%;
        order: 1; 
        height: 40vh; 
        margin-bottom:15px;
    }

    .rm-map-locations-list-container {
        padding: 10px; 
    }
    .rm-map-search-container,
    .rm-map-category-filter-container,
    .rm-map-location-count-container {
        padding: 10px;
    }
}