:root {
    --primary: #0D7377;
    --primary-dark: #095B5E;
    --primary-deep: #064245;
    --primary-bg: #E8F5F5;
    --primary-light: #D0EBEC;
    --blue: #1890FF;
    --accent: #00B894;
    --accent-bg: #E6FBF4;
    --tag: #E17055;
    --tag-bg: #FDF2EF;
    --card: #FFFFFF;
    --bg: #F4F6FA;
    --text-1: #1A1D29;
    --text-2: #5D6580;
    --text-3: #A0A7BD;
    --border: #E4E8F0;
    --radius: 16px;
    --radius-sm: 10px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text-2);
    min-height: 100dvh;
    padding-bottom: calc(24px + var(--safe-bottom));
    -webkit-font-smoothing: antialiased;
    /* 修复2: 微信WebView橡皮筋回弹 */
    overscroll-behavior: none;
    -ms-scroll-chaining: none;
    overscroll-behavior-y: contain;
}

/* ===== Header ===== */
.header {
    background: linear-gradient(165deg, #064245 0%, #0D7377 50%, #1890FF 100%);
    padding: calc(var(--safe-top) + 24px) 20px 28px;
    position: relative; overflow: hidden;
}
.header::before {
    content: ''; position: absolute; top: -40%; right: -15%;
    width: 260px; height: 260px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    pointer-events: none;
}
.header::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0;
    height: 20px; background: var(--bg);
    border-radius: 20px 20px 0 0;
}
.header-top {
    display: flex; align-items: center; justify-content: space-between;
    position: relative; z-index: 1;
}
.header-left {
    display: flex; align-items: center; gap: 10px;
}
.header-icon {
    width: 30px; height: 30px; color: #fff;
    flex-shrink: 0;
}
.header h1 { font-size: 24px; font-weight: 700; color: #fff; letter-spacing: 1px; }
.header-badge {
    font-size: 10px;
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.9);
    padding: 4px 12px; border-radius: 12px;
    font-weight: 500;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 0.5px solid rgba(255,255,255,0.2);
}

/* ===== 搜索栏 ===== */
.search-wrap { margin: -10px 14px 0; position: relative; z-index: 2; }
.search-bar {
    background: var(--card);
    border-radius: 12px; height: 46px;
    display: flex; align-items: center; gap: 8px;
    padding: 0 4px 0 14px;
    border: 1.5px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: border-color 0.25s, box-shadow 0.25s;
}
.search-bar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(13,115,119,0.08); }
.search-bar input {
    flex: 1; border: none; outline: none;
    font-size: 14px; background: transparent; color: var(--text-1);
    min-width: 0; font-weight: 500;
}
.search-bar input::placeholder { color: var(--text-3); font-weight: 400; }
.search-bar svg { color: var(--text-3); flex-shrink: 0; }
.search-bar:focus-within svg { color: var(--primary); }

/* ===== 搜索清空按钮 ===== */
.search-clear {
    width: 30px; height: 30px;
    border: none; border-radius: 50%;
    background: transparent; color: var(--text-3);
    cursor: pointer; display: none;
    align-items: center; justify-content: center;
    flex-shrink: 0; transition: background 0.15s;
}
.search-clear:active { background: var(--bg); }
.search-clear svg { width: 14px; height: 14px; }

/* ===== 筛选按钮 ===== */
.filters {
    display: flex; gap: 8px;
    padding: 10px 14px 8px;
}
.picker-btn {
    flex: 1; height: 40px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 4px;
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 10px 0 14px;
    font-size: 13px; font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
    transition: border-color 0.2s;
    white-space: nowrap;
}
.picker-btn:active { border-color: var(--primary); }
.picker-btn span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.picker-btn svg { flex-shrink: 0; color: var(--text-3); }

/* ===== 统计条 ===== */
.stat-bar {
    display: flex; align-items: center; gap: 6px;
    padding: 0 14px 12px; justify-content: center;
    flex-wrap: wrap;
}
.stat-tag { font-size: 12px; font-weight: 500; color: var(--text-3); white-space: nowrap; }
.stat-divider { width: 3px; height: 3px; border-radius: 50%; background: var(--border); flex-shrink: 0; }
.stat-tip { font-size: 11px; color: #E17055; white-space: nowrap; margin-left: 8px; }

/* ===== 已选条件标签 ===== */
.active-filters {
    display: none; gap: 8px; flex-wrap: wrap;
    padding: 0 14px 10px;
}
.filter-chip {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; font-weight: 500;
    background: var(--primary-bg); color: var(--primary);
    padding: 4px 10px; border-radius: 8px;
}
.filter-chip svg { width: 12px; height: 12px; cursor: pointer; }
.filter-prefix {
    display: inline-flex; align-items: center;
    font-size: 11px; color: var(--text-3);
    white-space: nowrap;
    line-height: 1;
}

/* ===== 列表 ===== */
.list { padding: 0 14px; }

/* ===== 卡片 ===== */
.card {
    background: var(--card);
    border-radius: var(--radius);
    margin-bottom: 14px;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    overflow: hidden;
}
.card:active { box-shadow: 0 4px 12px rgba(0,0,0,0.06); }

.card-main { padding: 16px 16px 12px; display: flex; gap: 14px; position: relative; }
.card-icon {
    width: 46px; height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary-bg), var(--primary-light));
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.card-icon svg { width: 22px; height: 22px; }
.card-icon-wrap { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; gap: 5px; }
.bdist {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 11px; font-weight: 700; color: #fff;
    background: var(--primary); padding: 3px 8px; border-radius: 6px;
    white-space: nowrap;
    z-index: 1;
}
.card-content { flex: 1; min-width: 0; }
.card h3 { font-size: 16px; font-weight: 700; color: var(--text-1); line-height: 1.4; margin-bottom: 6px; }
.card-content h3.has-dist { padding-right: 70px; }
.card-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 7px; }
.tag-badge { font-size: 10px; font-weight: 600; background: var(--tag-bg); color: var(--tag); padding: 2px 9px; border-radius: 7px; white-space: nowrap; }
.info { font-size: 12px; color: var(--text-2); line-height: 1.5; display: flex; align-items: flex-start; gap: 6px; margin-bottom: 4px; }
.info:last-of-type { margin-bottom: 0; }
.info svg { width: 13px; height: 13px; flex-shrink: 0; margin-top: 2px; color: var(--text-3); }
.info span { flex: 1; min-width: 0; word-break: break-all; overflow-wrap: break-word; }

/* ===== 卡片底部按钮 ===== */
.card-actions { display: flex; border-top: 1px solid var(--border); }
.cbtn {
    flex: 1; display: flex; align-items: center; justify-content: center;
    gap: 5px; padding: 13px 0;
    font-size: 13px; font-weight: 600; text-decoration: none;
    color: var(--text-3); transition: background 0.15s;
}
.cbtn:active { background: rgba(0,0,0,0.03); }
.cbtn svg { width: 16px; height: 16px; }
.cbtn + .cbtn { border-left: 1px solid var(--border); }
.cbtn.tel { color: var(--primary); font-weight: 700; }
.cbtn.tel:active { background: var(--primary-bg); }
.cbtn.tel svg { color: var(--primary); }
.cbtn.nav { color: var(--primary); font-weight: 700; }
.cbtn.nav:active { background: var(--primary-bg); }
.cbtn.nav svg { color: var(--primary); }

/* ===== 底部 ===== */
.footer { text-align: center; padding: 28px 16px 16px; font-size: 12px; color: var(--text-3); }

/* ===== 修复8: 错误/空状态 — 使用 CSS 变量适配暗黑模式 ===== */
.state-empty { text-align: center; padding: 60px 20px; }
.state-icon { font-size: 40px; margin-bottom: 12px; }
.state-title { font-size: 15px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.state-desc { font-size: 12px; color: var(--text-3); margin-bottom: 20px; }
.state-btn {
    padding: 8px 28px;
    border: 1.5px solid var(--primary);
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.state-btn:active { opacity: 0.8; }

/* ===== 定位按钮 ===== */
.location-btn {
    position: fixed;
    bottom: calc(32px + var(--safe-bottom)); right: 16px;
    width: 48px; height: 48px;
    border-radius: 50%;
    background: var(--card); color: var(--primary);
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    z-index: 10; transition: transform 0.2s;
}
.location-btn:active { transform: scale(0.88); }
.location-btn svg { width: 20px; height: 20px; }

/* ===== 底部弹出选择器 ===== */
/* 修复6: visibility + opacity 替代 display 切换，让过渡动画生效 */
.picker-mask {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(0,0,0,0.4);
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.25s, visibility 0.25s;
}
.picker-mask.show { visibility: visible; opacity: 1; }

.picker-panel {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--card);
    border-radius: 16px 16px 0 0;
    z-index: 101;
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.32,0.72,0,1), opacity 0.3s ease;
    padding-bottom: calc(12px + var(--safe-bottom));
}
.picker-panel.show { transform: translateY(0); opacity: 1; }

.picker-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.picker-action { font-size: 14px; color: var(--text-3); cursor: pointer; padding: 4px; }
.picker-title { font-size: 15px; font-weight: 600; color: var(--text-1); }

.picker-panel-body {
    max-height: 300px; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.picker-option {
    padding: 14px 20px;
    font-size: 15px; color: var(--text-2);
    text-align: center;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
    position: relative;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.picker-option:active { background: var(--primary-bg); }
.picker-option.on { color: var(--primary); font-weight: 600; }
.picker-option.on::after {
    content: '✓';
    position: absolute;
    right: 20px;
    font-weight: 700;
    font-size: 16px;
}

/* ===== 骨架屏 ===== */
.skeleton { background: var(--card); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; border: 1px solid rgba(0,0,0,0.04); }
.skeleton-line { height: 12px; border-radius: 6px; background: linear-gradient(90deg,#eee 25%,#e4e6ed 50%,#eee 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; margin-bottom: 10px; }
.skeleton-title { width: 55%; height: 18px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

@keyframes cardIn {
    0% { opacity: 0; transform: translateY(16px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ===== 加载更多 ===== */
.load-more { text-align: center; padding: 16px; color: var(--text-3); font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.load-spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 定位按钮加载 ===== */
.location-btn.loc-loading svg { animation: spin 0.8s linear infinite; }

/* ===== 暗黑模式 ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --primary: #1FB5BA;
        --primary-dark: #178E92;
        --primary-deep: #0F6A6D;
        --primary-bg: #1A3A3C;
        --primary-light: #1F4E51;
        --bg: #0F111A;
        --card: #1E2030;
        --text-1: #E8E9F0;
        --text-2: #A8ADC0;
        --text-3: #6B7190;
        --border: #2A2D3E;
        --tag-bg: #3D2222;
        --accent-bg: #1A3830;
    }
    .header { background: linear-gradient(165deg, #021A1C 0%, #063C40 50%, #0A5080 100%); }
    .search-bar { background: var(--card); }
    .picker-btn { background: var(--card); }
    .card { border-color: var(--border); }
    .location-btn { background: var(--card); }
    .skeleton { background: var(--card); }
    .skeleton-line { background: linear-gradient(90deg,#2A2D3E 25%,#35384A 50%,#2A2D3E 75%); background-size: 200% 100%; }
}
