/* ===== 红色地图页面根容器 - 移动端APP适配 ===== */
.red-map-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: #fff;
    position: relative;
    /* 关键：禁止页面级滚动，让地图接管所有手势（缩放、平移） */
    overflow: hidden !important;
    /* 防止移动端长按弹出菜单 */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.red-map-header {
    background-color: #C41E3A;
    padding: 0 15px;
    padding-bottom: 12px;
    flex-shrink: 0;
    position: relative;
    z-index: 100;
}

.header-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
}

.nav-back {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff !important;
    font-size: 17px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    z-index: 999;
    position: relative;
    pointer-events: auto;
    margin-top: 10px;
}

.nav-back i {
    color: #fff !important;
    font-size: 17px;
}

.nav-back:active {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.header-actions {
    width: 44px; /* iOS推荐最小44px */
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    -webkit-tap-highlight-color: transparent;
}

.header-actions:active {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
}

/* 搜索图标按钮触摸优化 */
.search-bar i[onclick] {
    cursor: pointer;
    padding: 4px;
    margin-right: 6px; /* 调整以补偿padding */
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-bar i[onclick]:active {
    color: #C41E3A;
}

.search-bar-wrapper {
    position: relative;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 0 15px;
    height: 44px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    -webkit-tap-highlight-color: transparent;
}

.search-bar i {
    color: #999;
    margin-right: 10px;
    font-size: 16px;
}

.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    background: transparent;
}

.search-bar input::placeholder {
    color: #999;
}

.search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px; /* 稍微增大 */
    height: 28px;
    color: #999;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.search-clear:active {
    color: #666;
}

.city-tabs-wrapper {
    display: flex;
    align-items: center;
    background-color: #fff;
    border-bottom: 1px solid #f0f0f0;
    padding: 8px 15px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.city-tabs {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    flex: 1;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.city-tabs::-webkit-scrollbar {
    display: none;
}

.city-tab {
    flex-shrink: 0;
    padding: 6px 16px;
    margin-right: 10px;
    border-radius: 20px;
    font-size: 14px;
    color: #666;
    background-color: #f5f5f5;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    min-height: 32px; /* 确保最小触摸区域 */
    display: flex;
    align-items: center;
}

.city-tab.active {
    background-color: #C41E3A;
    color: #fff;
}

.city-tabs-arrow {
    color: #C41E3A;
    font-size: 16px;
    margin-left: 8px;
    flex-shrink: 0;
}

.district-tabs-wrapper {
    display: flex;
    align-items: center;
    background-color: #fff8f8;
    border-bottom: 1px solid #ffe4e4;
    padding: 6px 15px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.district-tabs {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    flex: 1;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.district-tabs::-webkit-scrollbar {
    display: none;
}

.district-tab {
    flex-shrink: 0;
    padding: 5px 14px; /* 增大触摸区域 */
    margin-right: 8px;
    border-radius: 16px;
    font-size: 13px;
    color: #666;
    background-color: #fff;
    border: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
}

.district-tab.active {
    background-color: #EF5350;
    color: #fff;
    border-color: #EF5350;
}

.district-tabs-arrow {
    color: #EF5350;
    font-size: 14px;
    margin-left: 8px;
    flex-shrink: 0;
}

.quick-keywords-wrapper {
    background-color: #fff;
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.quick-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-keyword {
    padding: 7px 14px; /* 稍微增大触摸区域 */
    border-radius: 20px;
    font-size: 13px;
    color: #666;
    background-color: #f5f5f5;
    transition: background-color 0.2s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
    min-height: 32px; /* 最小触摸区域 */
    display: inline-flex;
    align-items: center;
}

/* 移动端触摸反馈：active态缩放 */
.quick-keyword:active {
    transform: scale(0.84);
    background-color: #e8e8e8;
}

.quick-keyword.active {
    background-color: #C41E3A;
    color: #fff;
}

.map-container {
    flex: 1;
    width: 100%;
    min-height: 300px;
    position: relative;
    background-color: #e8e8e8;
    overflow: hidden; /* 防止地图内容溢出 */
    /* 确保地图容器在移动端APP中有确定尺寸 */
    min-height: 0; /* flex子项的关键属性，允许收缩到小于内容高度 */
}

.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #999;
    z-index: 10; /* 确保loading在地图canvas之上 */
}

.map-loading i {
    font-size: 32px;
    margin-bottom: 10px;
    color: #C41E3A;
}

.map-loading span {
    font-size: 14px;
}

.spot-list-panel {
    position: absolute; /* 改为绝对定位，在APP容器内 */
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #fff;
    border-radius: 20px 20px 0 0;
    padding: 15px;
    padding-bottom: calc(15px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.3s ease;
    max-height: 60vh;
    display: flex;
    flex-direction: column;
    z-index: 9999 !important;
}

.spot-list-panel.show {
    transform: translateY(0);
    opacity: 1;
}

.spot-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.spot-list-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    padding-left: 12px;
    position: relative;
}

.spot-list-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 2px;
    bottom: 2px;
    width: 4px;
    background-color: #C41E3A;
    border-radius: 2px;
}

.spot-list-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 16px;
    cursor: pointer;
}

.spot-list-content {
    flex: 1;
    overflow-y: auto;
}

.spot-list-content::-webkit-scrollbar {
    width: 0;
}

.spot-card {
    display: flex;
    align-items: center;
    padding: 12px;
    background-color: #fafafa;
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.spot-card:active {
    background-color: #f0f0f0;
    transform: scale(0.88);
}

.spot-card:last-child {
    margin-bottom: 0;
}

.spot-card-icon {
    width: 48px;
    height: 48px;
    background-color: #C41E3A;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.spot-card-icon i {
    color: #fff;
    font-size: 20px;
}

.spot-card-info {
    flex: 1;
    min-width: 0;
}

.spot-card-name {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.spot-card-address {
    font-size: 13px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.spot-card-address i {
    margin-right: 4px;
    font-size: 12px;
    color: #C41E3A;
}

/* 底部卡片面板样式 - 匹配参考图效果（移动端APP适配） */
.spot-card-panel {
    position: absolute;  /* 绝对定位，在 .red-map-page 容器内 */
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #fff;
    border-radius: 12px 12px 0 0;
    padding: 14px 16px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    max-height: 45vh; /* 增加高度以显示更多内容 */
    display: flex;
    flex-direction: column;
    z-index: 9999 !important;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent; /* 移动端触摸优化 */
}

.spot-card-panel.show {
    transform: translateY(0);
    opacity: 1;
}

.spot-card-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
}

/* 红色左边框 */
.spot-card-left-bar {
    width: 4px;
    height: auto;
    min-height: 50px;
    background: linear-gradient(180deg, #C41E3A 0%, #EF5350 100%);
    border-radius: 2px;
    flex-shrink: 0;
}

.spot-card-info {
    flex: 1;
    min-width: 0;
    padding-right: 8px;
}

.spot-card-name {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.spot-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

/* 圆角边框样式 - 移动端适配 */
.spot-tag-outline {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background-color: transparent;
    border: 1px solid #C41E3A;
    border-radius: 14px;
    font-size: 11px;
    color: #C41E3A;
    font-weight: 500;
    -webkit-tap-highlight-color: transparent; /* 移动端触摸优化 */
}

.spot-card-address {
    font-size: 12px;
    color: #888;
    margin: 0;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 查看详情按钮 - 移动端适配 */
.spot-card-btn {
    flex-shrink: 0;
    padding: 10px 16px; /* 增加内边距，更易点击 */
    background: linear-gradient(135deg, #C41E3A 0%, #D32F2F 100%);
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 4px;
    min-height: 38px; /* 最小触摸区域 */
    -webkit-tap-highlight-color: transparent; /* 移动端触摸优化 */
}

.spot-card-btn:active {
    transform: scale(0.86);
    opacity: 0.9;
}

/* 关闭按钮 - 移动端适配 */
.spot-card-close {
    position: absolute;
    top: -30px;
    right: 12px;
    width: 28px; /* 稍微缩小以适应小屏幕 */
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    background: rgba(196, 30, 58, 0.95);
    border-radius: 50%;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent; /* 移动端触摸优化 */
    z-index: 10;
}

.spot-card-close:active {
    transform: scale(0.8);
}

/* ============================================================
 * 移动端APP专用优化
 * ============================================================ */

/* 高德地图canvas层 - 确保手势不冲突 */
.map-container canvas,
.map-container .amap-container {
    touch-action: none; /* 让地图完全接管触摸手势（缩放/平移） */
    -webkit-touch-callout: none;
    outline: none;
}

/* 搜索框获得焦点时（软键盘弹出）的布局适配 */
.red-map-page.search-focused .map-container {
    /* 软键盘弹出时缩小地图区域，避免被遮挡 */
    min-height: 200px;
    transition: min-height 0.3s ease;
}

/* 搜索框输入时的样式增强 */
.search-bar input:focus {
    background: transparent;
}

.search-bar input:focus::placeholder {
    color: #ccc;
}

/* 城市标签箭头触摸优化 */
.city-tabs-arrow,
.district-tabs-arrow {
    padding: 8px 4px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.city-tabs-arrow:active,
.district-tabs-arrow:active {
    opacity: 0.6;
}

/* 横屏模式适配 */
@media (orientation: landscape) and (max-height: 500px) {
    .red-map-header {
        padding-bottom: 6px;
    }
    
    .header-nav {
        padding: 4px 0;
    }
    
    .city-tabs-wrapper,
    .district-tabs-wrapper {
        padding: 4px 10px;
    }
    
    .quick-keywords-wrapper {
        padding: 6px 10px;
    }
    
    .city-tab {
        padding: 4px 12px;
        font-size: 13px;
    }
    
    .quick-keyword {
        padding: 5px 10px;
        font-size: 12px;
    }

    .spot-card-panel {
        max-height: 50vh;
    }
}

/* 小屏设备优化（iPhone SE等） */
@media (max-width: 375px) {
    .search-bar {
        height: 40px;
    }
    
    .city-tab {
        padding: 5px 12px;
        font-size: 13px;
        margin-right: 8px;
    }
    
    .quick-keyword {
        padding: 5px 10px;
        font-size: 12px;
    }
    
    .spot-card-name {
        font-size: 15px;
    }
    
    .spot-card-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}