/**
 * Yandex Store Locator - 前端样式
 */

.ysl-store-locator-wrapper {
    width: 100%;
    margin: 0;
    padding: 0;
}

.ysl-search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
}

.ysl-search-box input[type="text"] {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.ysl-search-box input[type="text"]:focus {
    border-color: #ff6b35;
    outline: none;
}

.ysl-search-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    background: #ff6b35;
    color: white;
}

.ysl-search-btn:hover {
    background: #e55a2b;
}

.ysl-content {
    display: flex;
    gap: 20px;
    height: 600px;
}

.ysl-sidebar {
    width: var(--sidebar-width, 350px);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.ysl-filters {
    padding: 15px;
    background: #f9f9f9;
    border-bottom: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ysl-city-filter-hint {
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
    color: #555;
}

.ysl-city-filter-empty {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    color: #888;
}

.ysl-city-filter-list {
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
}

.ysl-city-filter-select {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 0;
    height: auto;
    padding: 10px 36px 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.35;
    color: #333;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 12px;
    box-sizing: border-box;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.ysl-city-filter-select::-ms-expand {
    display: none;
}

.ysl-city-filter-select:focus {
    outline: none;
    border-color: #ff6b35;
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.2);
}

.ysl-city-filter-select option {
    padding: 6px 4px;
}

.ysl-store-city {
    margin: 0 0 4px 0;
    font-size: 12px;
    color: #888;
    font-weight: 500;
}

.ysl-store-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.ysl-store-item {
    padding: 15px;
    margin-bottom: 10px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    border-left: 4px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
}

.ysl-store-item:hover {
    border-left-color: #ff6b35;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.ysl-store-item h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #333;
}

.ysl-store-address {
    margin: 0 0 5px 0;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.ysl-store-phone {
    margin: 5px 0 0 0;
    font-size: 13px;
    color: #ff6b35;
}

.ysl-store-category {
    display: inline-block;
    padding: 3px 8px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 4px;
    font-size: 11px;
    margin-top: 5px;
}

.ysl-map {
    flex: 1 1 0;
    min-width: 0;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #ddd;
    position: relative;
    background: #e8e8e8;
}

/* 标记样式
 * 坐标对齐在 .ysl-marker 的 (0,0) 锚点（针尖/底部中心）。子级用 absolute，不要用与地图同级的 translateX(-50%)，
 * 否则与 ymaps3 的 transform 叠加后缩放时易出现亚像素漂移。水平居中改用 left:50% + 负 margin。
 */
.ysl-marker {
    cursor: pointer;
    position: relative;
    width: 0;
    height: 0;
    overflow: visible;
    /* 避免主题 img{max-width:100%} 在 0 宽父级下把自定义指针压成 0 宽 */
    max-width: none;
}

/* Yandex 3 默认 marker 宿主常为 z-index:0，易被后续图层盖住 */
.ysl-map ymaps3.ymaps3--marker {
    z-index: 650 !important;
    overflow: visible !important;
}

.ysl-marker-icon {
    position: absolute;
    left: 50%;
    bottom: 0;
    margin-left: -16px;
    width: 32px;
    height: 32px;
    background: #ff6b35;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    transform-origin: 50% 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* 后台 / Elementor 上传的自定义图片指针（无旋转，底部中心对准坐标；尺寸与 @2x 资源在页面上显示一致） */
.ysl-marker-icon--image {
    display: block;
    position: absolute;
    left: 50%;
    bottom: 0;
    margin-left: -13.5px;
    width: 27px;
    height: 43px;
    min-width: 27px;
    min-height: 43px;
    max-width: none !important;
    max-height: none;
    padding: 0;
    background: transparent !important;
    border-radius: 0;
    transform: rotate(0deg);
    object-fit: contain;
    box-shadow: none;
    font-size: 0;
    line-height: 0;
    z-index: 2;
}

.ysl-marker:has(.ysl-marker-icon--image) .ysl-marker-popup {
    bottom: 51px;
}

/* 标记上方详情气泡 */
.ysl-marker-popup {
    position: absolute;
    left: 50%;
    bottom: 44px;
    transform: translate3d(-50%, 0, 0);
    z-index: 1000;
    min-width: 220px;
    max-width: min(280px, calc(100vw - 32px));
    padding: 0;
    margin: 0;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    text-align: left;
    pointer-events: auto;
}

.ysl-marker-popup::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -8px;
    width: 14px;
    height: 14px;
    margin-left: -7px;
    background: #fff;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    transform: rotate(45deg);
}

.ysl-marker-popup-inner {
    position: relative;
    padding: 12px;
    max-height: 320px;
    overflow-y: auto;
}

.ysl-marker-popup-close {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 28px;
    height: 28px;
    padding: 0;
    margin: 0;
    border: none !important;
    padding: 0px !important;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
    color: #666 !important;
    font-size: 0;
    line-height: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
}

/* 旋转作用在内部方块上，几何中心与 × 对齐，避免整颗按钮因字体内边距导致“绕偏” */
.ysl-marker-popup-close-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    font-size: 22px;
    line-height: 1;
    color: inherit;
    transform: rotate(0deg);
    transform-origin: 50% 50%;
    transition: transform 0.2s ease;
}

.ysl-marker-popup-close:hover,
.ysl-marker-popup-close:focus,
.ysl-marker-popup-close:focus-visible {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #FF7E00 !important;
    outline: none;
}

.ysl-marker-popup-close:active .ysl-marker-popup-close-icon {
    transform: rotate(45deg);
}

.ysl-marker-popup-close:active {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #666 !important;
}

.ysl-popup-title {
    margin: 0 0 8px 0;
    padding-right: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #222;
    line-height: 1.3;
}

.ysl-popup-meta {
    margin: 0 0 6px 0;
    font-size: 12px;
    color: #888;
}

.ysl-popup-address {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #444;
    line-height: 1.45;
}

.ysl-popup-line {
    margin: 4px 0;
    font-size: 13px;
    color: #555;
    line-height: 1.4;
}

.ysl-popup-line a {
    color: #1976d2;
    word-break: break-all;
}

.ysl-popup-cat {
    display: inline-block;
    padding: 2px 8px;
    background: #e3f2fd;
    color: #1565c0;
    border-radius: 4px;
    font-size: 12px;
}

.ysl-popup-desc {
    margin: 8px 0 0 0;
    font-size: 12px;
    color: #666;
    line-height: 1.5;
    white-space: pre-wrap;
}

.ysl-popup-distance {
    margin: 8px 0 0 0;
    font-size: 12px;
    color: #ff6b35;
    font-weight: 600;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .ysl-content {
        flex-direction: column;
        height: auto;
    }
    
    .ysl-sidebar {
        width: 100%;
        max-height: 300px;
    }
    
    .ysl-map {
        height: 400px !important;
    }
    
    .ysl-search-box {
        flex-direction: column;
    }
}

/* 信息窗口样式 */
.ysl-info-window {
    padding: 10px;
    min-width: 200px;
}

.ysl-info-window h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
}

.ysl-info-window p {
    margin: 5px 0;
    font-size: 13px;
    color: #666;
}

/* 加载动画 */
.ysl-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #999;
}

.ysl-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid #ddd;
    border-top-color: #ff6b35;
    border-radius: 50%;
    animation: ysl-spin 1s linear infinite;
}

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

/* 无结果提示 */
.ysl-no-results {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}
