/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.5;
    overscroll-behavior: contain;
}

/* 顶部导航 */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    background-color: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 0 15px;
    transform: translateZ(0);
    will-change: transform;
}

.header-left, .header-right {
    flex: 0 0 auto;
}

.header-title {
    flex: 1;
    text-align: center;
    font-size: 18px;
    font-weight: 500;
    color: #333;
}

.back-btn {
    color: #333;
    font-size: 16px;
    text-decoration: none;
}

/* 城市选择容器 */
.city-container {
    margin-top: 50px;
    display: flex;
    position: relative;
    height: calc(100vh - 50px);
    overflow: hidden;
}

/* 城市列表 */
.city-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    height: 100%;
    padding-bottom: 50px; /* 为底部添加空间 */
}

/* 城市分组 */
.city-section {
    background-color: #fff;
    margin-bottom: 10px;
}

.city-section-content {
    padding: 0 15px;
}

/* 热门城市 */
.hot-city-item {
    display: inline-block;
    background-color: #f5f5f5;
    border-radius: 4px;
    margin: 10px 10px 10px 0;
    transition: background-color 0.2s;
    touch-action: manipulation;
}

.hot-city-item span {
    display: block;
    padding: 10px 15px;
    font-size: 14px;
    color: #333;
}

.hot-city-item:active {
    background-color: #e8e8e8;
}

/* 字母分组 */
.city-letter-header {
    padding: 8px 15px;
    background-color: #f8f8f8;
    font-size: 16px;
    color: #999;
    font-weight: 500;
}

/* 城市列表项 */
.city-letter-content {
    padding: 0;
}

.city-item {
    padding: 12px 15px;
    font-size: 16px;
    color: #333;
    border-bottom: 1px solid #f5f5f5;
    transition: background-color 0.2s;
    touch-action: manipulation;
}

.city-item:active {
    background-color: #f5f5f5;
}

.city-item:last-child {
    border-bottom: none;
}

/* 字母索引 */
.alphabet-index {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: 24px;
    background-color: rgba(240, 240, 240, 0.8);
    border-radius: 12px;
    padding: 10px 0;
    position: absolute;
    right: 5px;
    top:  5%;
    transform: translateY(-25%);
    z-index: 10;
    will-change: transform;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.alphabet-item {
    text-align: center;
    padding: 3px 0;
}

.alphabet-item a {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    text-decoration: none;
    touch-action: manipulation;
    padding: 0px 2px;
}

.alphabet-item.active a {
    color: #fff;
    background-color: #3498db;
    border-radius: 50%;
    font-weight: bold;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* 优化性能的额外样式 */
.city-section, .city-section-content, .city-letter-content {
    transform: translateZ(0);
}

/* 渐入动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 处理骨架屏加载 */
.city-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
    height: 20px;
    margin: 10px 0;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 针对不同屏幕大小的优化 */
@media screen and (max-width: 360px) {
    .city-item {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .hot-city-item span {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* 针对大屏设备的优化 */
@media screen and (min-width: 768px) {
    .city-container {
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .header {
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* 减少闪烁 - 对内容使用硬件加速 */
.city-container, .city-list, .alphabet-index {
    backface-visibility: hidden;
} 