/* LBS Map 前端样式 */

.lbs-map-wrap {
    margin: 1.5em 0;
}

/* 地图容器 */
.lbs-map-container {
    width: 100%;
    height: 420px;
    border-radius: 8px;
    overflow: hidden;
    background: #eef2f5;
}

/* 信息列表 */
.lbs-map-list {
    margin-top: 12px;
}

.lbs-map-list .lbs-map-empty {
    color: #777;
    font-size: 0.95em;
}

.lbs-map-items {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: lbs-item;
}

.lbs-map-items li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
}

.lbs-map-items li::before {
    counter-increment: lbs-item;
    content: counter(lbs-item) ". ";
    color: #999;
    margin-right: 6px;
}

.lbs-map-item-title {
    flex: 1;
}

.lbs-map-item-distance {
    color: #1a73e8;
    font-size: 0.9em;
    white-space: nowrap;
}

/* 我的位置标记 */
.lbs-map-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #1a73e8;
    border: 3px solid #fff;
    box-shadow: 0 0 6px rgba(26, 115, 232, 0.6);
}

.lbs-map-dot--me {
    background: #1a73e8;
}

/* 信息窗体 */
.lbs-map-infowindow {
    font-size: 14px;
    line-height: 1.5;
    max-width: 220px;
}

.lbs-map-infowindow p {
    margin: 4px 0;
    color: #666;
}

/* ===== 文章列表页地图卡 ===== */

/* 列表页/文章页：收紧主内容区与页面头部（hero/标题区）的间距
   主题默认 .site>.content{padding-top:6rem} ≈ 96px，过大。
   用 body.archive / body.single 限定作用范围（本样式表全站加载，不能影响其他页面），
   优先级 (0,3,1) 高于主题的 .site>.content (0,2,0) 与 .content.blog-page (0,2,0)。 */
body.archive .site > .content,
body.single .site > .content {
    padding-top: 24px;
}

/* 文章页（桌面端）：左侧正文因主题 .post-content-inner 自带 32px 上边距而偏下，
   侧栏白色卡片（.panel，带边框和阴影，widget 的父级容器）需整体下移。
   32px 可让边框上缘与正文严格平齐，但卡片内文字视觉偏低，故取折中值。 */
@media (min-width: 768px) {
    body.single .sidebar > .panel:first-child {
        margin-top: 22px;
    }
}

.lbs-archive-card {
    /* 卡片在主题的 .post-list.row（flex 布局）内，必须声明占满整行，
       否则作为无栅格类的 flex 子项会被内容宽度挤压 */
    flex: 0 0 100%;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    /* 顶部不留 padding：与右侧栏 widget 顶部水平平齐（侧栏盒顶 ≈ 主列顶） */
    padding: 0 15px 0;
    box-sizing: border-box;
}

/* 主题给所有 div 注入了 ::before/::after（content:""），在 flex 容器里
   会变成 0 宽 flex 项，被 gap 隔开导致两侧各多出 8px 空隙——
   清除工具栏相关 flex 容器上的伪元素 */
.lbs-archive-toolbar::before,
.lbs-archive-toolbar::after,
.lbs-archive-search::before,
.lbs-archive-search::after {
    content: none;
}

.lbs-archive-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.lbs-archive-search {
    display: flex;
    flex: 1 1 200px;
    max-width: 360px;
}

.lbs-archive-search-input {
    flex: 1;
    min-width: 0;
    padding: 5px 10px;
    font-size: 13px;
    border: 1px solid #d9d9de;
    border-right: none;
    border-radius: 4px 0 0 4px;
    outline: none;
    box-sizing: border-box;
}

.lbs-archive-search-input:focus {
    border-color: #1a73e8;
}

.lbs-archive-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 2.5rem;
    box-sizing: border-box;
    padding: 5px 12px;
    font-size: 13px;
    line-height: 1.6;
    border: 1px solid #d9d9de;
    background: #fff;
    border-radius: 4px;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
}

/* 按钮内联图标：stroke 跟随文字色，hover 时同步变色 */
.lbs-btn-icon {
    width: 14px;
    height: 14px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* 收起/展开图标随状态切换（aria-expanded 由 JS 维护） */
.lbs-archive-toggle .lbs-icon-expand {
    display: none;
}

.lbs-archive-toggle[aria-expanded="false"] .lbs-icon-collapse {
    display: none;
}

.lbs-archive-toggle[aria-expanded="false"] .lbs-icon-expand {
    display: block;
}

.lbs-archive-search-btn {
    border-right: none;
    border-radius: 0;
}

/* 当前定位：紧贴搜索按钮连成一组（末端圆角由它接棒，分隔线只留它自己的左边框一条） */
.lbs-archive-locate {
    border-radius: 0 4px 4px 0;
}

.lbs-archive-btn:hover {
    color: #1a73e8;
    border-color: #1a73e8;
}

.lbs-archive-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

/* 收起地图：始终右对齐（自动定位紧跟搜索框之后） */
.lbs-archive-toggle {
    margin-left: auto;
}

.lbs-archive-mapbox {
    height: 300px;
    border: 1px solid #e2e2e6;
    border-radius: 8px;
    overflow: hidden;
    background: #eef2f5;
}

.lbs-archive-mapbox.is-collapsed {
    display: none;
}

.lbs-archive-canvas {
    width: 100%;
    height: 100%;
}

/* 泡泡 Marker：定位 pin 图标为主体，上方对话泡泡（悬停/点击展开摘要） */
.lbs-pin {
    position: relative;
    cursor: pointer;
}

.lbs-pin-icon {
    display: block;
    width: 30px;
    height: 25px;
    fill: #1a73e8;
    stroke: #fff;
    stroke-width: 1.5;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
    transform-origin: bottom center;
    transition: transform 0.15s;
}

/* 对话泡泡：默认仅标题，悬停/点击固定时向下展开摘要 */
.lbs-pin-tip {
    position: absolute;
    left: 50%;
    bottom: calc(100% - 6px); /* 尾巴尖搭在 pin 头部 */
    transform: translateX(-50%);
    width: max-content; /* 标题态泡泡随标题自适应宽度 */
    max-width: 130px;
    padding: 7px 11px;
    background: #1558c0;
    border-radius: 14px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    cursor: default;
}

.lbs-pin-tip::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -4px;
    width: 10px;
    height: 10px;
    background: #1558c0;
    border-radius: 2px;
    transform: translateX(-50%) rotate(45deg);
}

/* 固定展开后的关闭叉：骑在泡泡右上角，点它才关闭固定态 */
.lbs-pin-tip-close {
    display: none;
    position: absolute;
    top: -8px;
    right: -8px;
    width: 18px;
    height: 18px;
    padding: 0;
    box-sizing: border-box;
    border: 1px solid #1558c0;
    border-radius: 50%;
    background: #fff;
    color: #1558c0;
    font-size: 12px;
    line-height: 1;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.lbs-pin.is-pinned .lbs-pin-tip-close {
    display: flex;
}

.lbs-pin-tip-close:hover {
    background: #1558c0;
    color: #fff;
}

.lbs-pin-tip-title {
    display: block;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    text-decoration: none;
    transition: font-size 0.2s ease;
}

.lbs-pin-tip-title:hover {
    text-decoration: underline;
}

/* 展开摘要时：标题字号稍大并加粗，与摘要正文区分 */
.lbs-pin:hover .lbs-pin-tip-title,
.lbs-pin.is-pinned .lbs-pin-tip-title {
    font-size: 13px;
    font-weight: 700;
}

/* 摘要区：默认收起，展开时高度/透明度过渡 */
.lbs-pin-tip-body {
    display: block;
    max-height: 0;
    max-width: 0; /* 收起时不参与泡泡 max-content 宽度计算，避免长摘要撑宽标题态 */
    opacity: 0;
    overflow: hidden;
    margin-top: 0;
    color: #fff;
    font-size: 12px;
    line-height: 1.6;
    text-decoration: none;
    transition: max-height 0.25s ease, opacity 0.2s ease, margin-top 0.25s ease;
}

/* 展开时泡泡固定宽度，保证 20 字摘要约两行 */
.lbs-pin:hover .lbs-pin-tip,
.lbs-pin.is-pinned .lbs-pin-tip {
    width: 150px;
}

.lbs-pin:hover .lbs-pin-tip-body,
.lbs-pin.is-pinned .lbs-pin-tip-body {
    max-height: 112px;
    max-width: 100%;
    opacity: 1;
    margin-top: 4px;
}

.lbs-pin:hover .lbs-pin-icon {
    transform: scale(1.12);
}

/* 搜索结果页：含搜索词的泡泡橙色突出（图标稍大 + 置顶由 JS 控制 zIndex） */
.lbs-pin--matched .lbs-pin-icon {
    fill: #e8710a;
    width: 34px;
    height: 28px;
}

.lbs-pin--matched .lbs-pin-tip,
.lbs-pin--matched .lbs-pin-tip::after {
    background: #e8710a;
}

/* 点击泡泡后列表项高亮 */
@keyframes lbs-archive-flash {
    0% {
        background: #fff3c4;
    }
    100% {
        background: transparent;
    }
}

.lbs-archive-flash {
    animation: lbs-archive-flash 2s ease;
}

/* 轻提示（toast）：底部居中浮层，淡入淡出，不打断用户 */
#lbs-map-toast {
    position: fixed;
    left: 50%;
    bottom: 40px;
    transform: translateX(-50%) translateY(8px);
    z-index: 99999;
    max-width: 86vw;
    padding: 8px 16px;
    border-radius: 6px;
    background: rgba(20, 20, 20, 0.78);
    color: #fff;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

#lbs-map-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 移动端 */
@media (max-width: 640px) {
    .lbs-archive-card {
        padding: 0 10px 0;
    }

    .lbs-archive-mapbox {
        height: 220px;
    }

    /* 输入框收窄，让三个图标按钮与它同处一行 */
    .lbs-archive-search {
        flex: 1 1 110px;
        max-width: 170px;
    }

    /* 按钮只保留图标以节省空间（文字仍保留供屏幕阅读器） */
    .lbs-btn-text {
        display: none;
    }

    .lbs-archive-btn {
        padding: 5px 8px;
    }
}
