/* heritage_map.css - 东北铁路遗产地图（金黑档案风 + 搜索悬停 + 分页 + Chips 标签云） */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-0: #0a0805;
    --bg-2: #16110c;
    --bg-3: #1d1711;
    --gold: #d4a24c;
    --gold-bright: #f0c674;
    --gold-deep: #b87333;
    --gold-glow: rgba(212, 162, 76, 0.25);
    --border: rgba(212, 162, 76, 0.15);
    --border-strong: rgba(212, 162, 76, 0.35);
    --text: #ede5d8;
    --text-dim: rgba(237, 229, 216, 0.7);
    --text-mute: rgba(237, 229, 216, 0.4);
    --font-mono: "SF Mono", "Consolas", "Monaco", monospace;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
    background: #eef2f5;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.app { display: flex; flex-direction: column; height: 100%; width: 100%; }

/* ========== 顶部导航 ========== */
.navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border-strong);
    padding: 0 1rem; height: 60px;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.logo-area h1 {
    font-size: 1rem; font-weight: 600;
    background: linear-gradient(135deg, var(--gold), var(--gold-bright));
    background-clip: text; -webkit-background-clip: text;
    color: transparent; cursor: pointer;
}
.search-box {
    display: flex; align-items: center;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 30px;
    padding: 4px 12px;
    border: 1px solid var(--border-strong);
    height: 36px; flex-shrink: 0; max-width: 200px;
}
.search-box i { color: var(--gold); margin-right: 6px; }
#searchInput { background: transparent; border: none; outline: none; color: var(--text); width: 110px; font-size: 0.8rem; }
.search-btn { background: transparent; border: none; color: var(--gold); cursor: pointer; }
.map-switch-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-strong);
    border-radius: 30px;
    color: var(--gold);
    font-size: 0.8rem;
    padding: 4px 12px; height: 36px;
    cursor: pointer;
    display: flex; align-items: center; gap: 4px;
    margin-left: 8px; transition: background 0.2s;
    white-space: nowrap;
}
.map-switch-btn:hover { background: rgba(212, 162, 76, 0.18); }

@media (min-width: 768px) {
    .navbar { padding: 0 2rem; height: 70px; }
    .logo-area h1 { font-size: 1.4rem; }
    .search-box { max-width: 260px; height: 40px; }
    #searchInput { width: 180px; font-size: 0.9rem; }
    .map-switch-btn { height: 40px; padding: 6px 16px; font-size: 0.9rem; }
}

#map { flex: 1; background: #dce3e8; margin-top: 60px; z-index: 1; }
@media (min-width: 768px) { #map { margin-top: 70px; } }

/* ========== 信息卡片 ========== */
.heritage-card {
    position: fixed;
    top: calc(60px + env(safe-area-inset-top, 0px));
    left: 10px; right: 10px;
    width: auto; max-width: calc(100% - 20px);
    background: rgba(22, 17, 12, 0.94);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    color: var(--text);
    box-shadow: 0 25px 40px -12px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border-strong);
    overflow-y: auto;
    max-height: calc(100vh - 70px - env(safe-area-inset-top, 0px));
    z-index: 101;
    transition: all 0.3s ease;
}
@media (min-width: 768px) {
    .heritage-card {
        top: 90px; left: 24px; right: auto;
        width: 420px; max-width: calc(100% - 48px);
    }
}
.card-grade-bar { height: 5px; width: 100%; }
.grade-national    { background: linear-gradient(90deg, #c0392b, #e67e22); }
.grade-provincial  { background: linear-gradient(90deg, #2980b9, #3498db); }
.grade-other       { background: linear-gradient(90deg, #666, #999); }
.grade-station     { background: linear-gradient(90deg, #2c3e50, #d4a24c); }

.card-header { padding: 14px 16px 6px 16px; }
.card-header h3 { font-size: 1.2rem; font-weight: 700; color: var(--gold-bright); }
.card-details { padding: 12px 16px 16px 16px; font-size: 0.8rem; line-height: 1.4; }
.detail-row { display: flex; margin-bottom: 8px; align-items: flex-start; gap: 10px; }
.detail-icon { width: 24px; font-size: 0.85rem; color: var(--gold); text-align: center; flex-shrink: 0; }
.detail-content { flex: 1; color: var(--text-dim); }
.detail-label { font-weight: 600; color: var(--gold); margin-right: 6px; }
.name-sub-row {
    display: flex; flex-wrap: wrap; gap: 10px;
    font-size: 0.75rem; color: var(--text-dim);
    margin-top: 4px;
    border-bottom: 1px dashed var(--border-strong);
    padding-bottom: 6px;
}
.card-photo { width: 100%; height: 150px; object-fit: cover; background: var(--bg-3); }
.close-card {
    position: absolute; top: 12px; right: 12px;
    background: rgba(0, 0, 0, 0.4);
    border: none; color: var(--gold);
    width: 28px; height: 28px; border-radius: 30px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem;
}
@media (min-width: 768px) {
    .card-header h3 { font-size: 1.3rem; }
    .name-sub-row { font-size: 0.85rem; }
    .card-details { font-size: 0.85rem; }
    .detail-icon { width: 26px; font-size: 0.9rem; }
    .card-photo { height: 150px; }
}

/* ========== Marker ========== */
.city-marker {
    background: rgba(22, 17, 12, 0.88);
    backdrop-filter: blur(4px);
    border-radius: 30px;
    padding: 4px 12px;
    font-size: 0.75rem;
    border: 1px solid var(--gold);
    white-space: nowrap;
    cursor: pointer;
    color: var(--text);
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    display: inline-flex; align-items: center; gap: 4px;
}
.city-marker:hover { background: #c0392b; border-color: var(--gold-bright); color: white; }
.marker-cluster-custom {
    background: rgba(22, 17, 12, 0.88);
    border: 2px solid var(--gold);
    border-radius: 50%;
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text); font-weight: bold; font-size: 12px;
    backdrop-filter: blur(4px);
}

/* ========== 卡片内元素 ========== */
.detail-link {
    display: inline-block;
    color: var(--gold); text-decoration: none;
    border-bottom: 1px solid rgba(212, 162, 76, 0.4);
    font-weight: 600; margin-top: 6px; font-size: 0.8rem;
}
.list-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; margin-bottom: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    cursor: pointer; transition: all 0.2s;
    border: 1px solid transparent;
}
.list-item:hover {
    background: rgba(212, 162, 76, 0.15);
    border-color: var(--border-strong);
    transform: translateX(4px);
}
.list-item-icon { font-size: 1rem; width: 28px; text-align: center; flex-shrink: 0; color: var(--gold); }
.list-item-title { font-weight: 500; font-size: 0.85rem; color: var(--gold-bright); }
.list-item-count { font-size: 0.7rem; color: var(--text-dim); margin-left: auto; }
.back-btn {
    display: inline-block; margin-bottom: 10px;
    background: rgba(212, 162, 76, 0.15);
    border: 1px solid var(--gold);
    border-radius: 30px;
    padding: 4px 12px;
    font-size: 0.7rem;
    cursor: pointer; transition: 0.2s;
    color: var(--gold);
}
.back-btn:hover { background: var(--gold); color: var(--bg-2); }
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.page-btn {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.7rem;
    cursor: pointer; transition: 0.2s;
    color: var(--gold);
}
.page-btn.active { background: var(--gold); color: var(--bg-2); border-color: var(--gold); }
.page-btn:hover:not(.active) { background: rgba(212, 162, 76, 0.25); }
.category-item { cursor: pointer; transition: all 0.2s; border-radius: 8px; padding: 2px 0; }
.category-item:hover { background: rgba(212, 162, 76, 0.12); transform: translateX(5px); }
.status-tip-content {
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* ========== 卡片顶部 Chips 标签行 ========== */
.card-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 16px 4px 16px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    background: rgba(212, 162, 76, 0.08);
    border: 1px solid rgba(212, 162, 76, 0.28);
    color: var(--text-dim);
    white-space: nowrap;
    line-height: 1.45;
    transition: all 0.15s;
}
.chip i { font-size: 0.75em; opacity: 0.9; }

.chip-number {
    font-family: var(--font-mono);
    color: var(--gold-bright);
    border-color: rgba(212, 162, 76, 0.35);
    background: rgba(212, 162, 76, 0.1);
}
.chip-station {
    color: var(--gold-bright);
    border-color: rgba(240, 198, 116, 0.45);
    background: rgba(212, 162, 76, 0.14);
}
.chip-status {
    color: color-mix(in srgb, var(--c, #999) 92%, #fff 8%);
    border-color: color-mix(in srgb, var(--c, #999) 45%, transparent);
    background: color-mix(in srgb, var(--c, #999) 12%, transparent);
    cursor: pointer;
}
.chip-status:hover {
    background: color-mix(in srgb, var(--c, #999) 22%, transparent);
    border-color: color-mix(in srgb, var(--c, #999) 70%, transparent);
}
.chip-visit {
    color: color-mix(in srgb, var(--c, #999) 92%, #fff 8%);
    border-color: color-mix(in srgb, var(--c, #999) 45%, transparent);
    background: color-mix(in srgb, var(--c, #999) 12%, transparent);
}

@media (max-width: 767px) {
    .card-chips {
        padding: 8px 12px 4px 12px;
        gap: 5px;
    }
    .chip {
        font-size: 0.66rem;
        padding: 2px 8px;
    }
}

/* ========== 搜索结果分页 ========== */
.search-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding: 8px 0 4px;
    border-top: 1px dashed var(--border-strong);
}
.search-page-btn {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    padding: 5px 14px;
    color: var(--gold);
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
}
.search-page-btn:hover:not(:disabled) {
    background: rgba(212, 162, 76, 0.25);
    border-color: var(--gold);
    color: var(--gold-bright);
}
.search-page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.search-page-info {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    color: var(--text-dim);
    letter-spacing: 1px;
    min-width: 52px;
    text-align: center;
}

/* ========== 图层面板 ========== */
.layer-panel {
    display: none;
    position: fixed;
    top: 75px; right: 20px;
    width: 320px;
    max-height: calc(100vh - 90px);
    background: rgba(22, 17, 12, 0.94);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 20px;
    border: 1px solid var(--border-strong);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    color: var(--text);
    z-index: 200;
    overflow-y: auto;
    padding: 16px;
    font-size: 0.8rem;
    transition: opacity 0.2s, transform 0.2s;
    transform-origin: top right;
}
.layer-panel.visible { display: block; animation: panelIn 0.2s ease; }
@keyframes panelIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.panel-header h4 { font-size: 1rem; font-weight: 600; color: var(--gold); margin: 0; display: flex; align-items: center; gap: 6px; }
.panel-close-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none; color: var(--text-dim);
    width: 28px; height: 28px; border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
}
.panel-close-btn:hover { background: rgba(212, 162, 76, 0.3); color: #fff; }
.layer-section details {
    border: 1px solid rgba(212, 162, 76, 0.18);
    border-radius: 12px;
    margin-bottom: 8px;
    overflow: hidden;
}
.layer-section details[open] {
    border-color: var(--border-strong);
    background: rgba(255, 255, 255, 0.02);
}
.layer-section summary {
    padding: 10px 14px;
    font-weight: 600; color: var(--gold);
    cursor: pointer; user-select: none;
    display: flex; justify-content: space-between; align-items: center;
    outline: none; font-size: 0.85rem;
}
.layer-section summary::-webkit-details-marker { display: none; }
.layer-section summary::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.7rem;
    color: var(--gold);
    transition: transform 0.2s;
}
.layer-section details[open] summary::after { transform: rotate(180deg); }
.layer-title-text { display: flex; align-items: center; gap: 6px; }
.toggle-group-btn {
    background: none;
    border: 1px solid var(--border-strong);
    color: var(--gold);
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 0.65rem;
    cursor: pointer; transition: 0.2s;
    font-weight: 400; margin-left: 8px;
}
.toggle-group-btn:hover { background: rgba(212, 162, 76, 0.18); }
.filter-list {
    padding: 8px 10px 12px 10px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
}
@media (min-width: 768px) { .filter-list { grid-template-columns: 1fr 1fr; } }
.filter-item {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 6px; border-radius: 8px;
    cursor: pointer; transition: background 0.15s;
    font-size: 0.75rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    color: var(--text-dim);
}
.filter-item:hover { background: rgba(212, 162, 76, 0.1); }
.filter-item .check-icon {
    width: 16px; height: 16px; border-radius: 4px;
    border: 2px solid rgba(212, 162, 76, 0.55);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.55rem; color: transparent;
    transition: 0.2s; flex-shrink: 0;
}
.filter-item.active .check-icon {
    background: var(--gold); border-color: var(--gold);
    color: var(--bg-2); font-weight: bold;
}
.filter-item .item-label { flex: 1; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; }
.filter-item.active .item-label { color: var(--text); font-weight: 500; }
.filter-item .item-count { color: var(--text-mute); font-size: 0.65rem; margin-left: auto; flex-shrink: 0; }

.basemap-section { margin-bottom: 12px; }
.basemap-section .basemap-options { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.basemap-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    padding: 6px 12px;
    color: var(--text-dim);
    font-size: 0.7rem;
    cursor: pointer; transition: 0.2s;
    display: flex; align-items: center; gap: 4px;
}
.basemap-btn:hover { background: rgba(212, 162, 76, 0.15); color: var(--text); }
.basemap-btn.active {
    background: linear-gradient(135deg, var(--gold), var(--gold-deep));
    border-color: var(--gold);
    color: var(--bg-2);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(212, 162, 76, 0.3);
}
.layer-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.layer-actions button {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    padding: 8px 0;
    color: var(--gold);
    font-size: 0.75rem;
    cursor: pointer; transition: 0.2s;
    display: flex; align-items: center; justify-content: center;
    gap: 4px; font-weight: 500;
}
.layer-actions button:hover { background: rgba(212, 162, 76, 0.18); color: #fff; }

@media (max-width: 767px) {
    .layer-panel {
        top: 65px; right: 5px; left: 5px; width: auto;
        max-height: calc(100vh - 80px);
        border-radius: 16px;
        padding: 12px;
    }
    .filter-list { grid-template-columns: repeat(3, 1fr); }
}

/* ========== 加载动画 ========== */
.loading-overlay {
    position: fixed;
    top: 60px; left: 0; right: 0; bottom: 0;
    display: flex; align-items: center; justify-content: center;
    gap: 10px;
    background: rgba(10, 8, 5, 0.6);
    color: var(--gold);
    font-size: 0.9rem;
    letter-spacing: 1px;
    z-index: 90;
    pointer-events: none;
}
.loading-overlay i { font-size: 1.4rem; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (min-width: 768px) { .loading-overlay { top: 70px; } }

/* ========== 附近建筑呼吸动画 ========== */
.poi-div-icon.breath-animation {
    animation: softBreath 2s ease-in-out infinite;
    z-index: 1000 !important;
}
@keyframes softBreath {
    0%   { transform: scale(1); filter: drop-shadow(0 0 3px rgba(240, 198, 116, 0.6)); }
    50%  { transform: scale(1.15); filter: drop-shadow(0 0 8px rgba(212, 162, 76, 0.85)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 3px rgba(240, 198, 116, 0.6)); }
}

/* ========== 悬停脉冲环（保留原样式，兼容） ========== */
.poi-div-icon.search-hover-highlight {
    z-index: 9999 !important;
}
.poi-div-icon.search-hover-highlight .poi-marker-inner {
    animation: searchHoverBreath 1.6s ease-in-out infinite;
    transform-origin: center center;
    will-change: transform, filter;
}
@keyframes searchHoverBreath {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 4px rgba(240, 198, 116, 0.55));
    }
    50% {
        transform: scale(1.22);
        filter: drop-shadow(0 0 16px rgba(240, 198, 116, 1));
    }
}
@media (hover: none) {
    .poi-div-icon.search-hover-highlight .poi-marker-inner {
        animation: none;
    }
}