/* ========== App通用样式 ========== */

/* 页面头部 */
.page-header {
    background: var(--bg-primary);
    padding: 8px 16px;
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid var(--border-light);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 44px;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icon {
    width: 24px;
    height: 24px;
    color: var(--text-primary);
    cursor: pointer;
}

/* 返回按钮 */
.back-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    margin-left: -8px;
}

.back-btn svg {
    width: 24px;
    height: 24px;
}

/* 顶部Tab导航 */
.top-tabs {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 8px 0;
    overflow-x: auto;
    scrollbar-width: none;
}

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

.top-tab {
    font-size: 15px;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: all var(--transition-fast);
    padding: 4px 0;
}

.top-tab.active {
    color: var(--text-primary);
    font-weight: 600;
}

.top-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
}

/* 搜索栏 */
.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--bg-primary);
}

.search-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    padding: 8px 12px;
    border-radius: 20px;
}

.search-input-wrapper svg {
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

/* 金刚区（宫格导航） */
.kingkong-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    padding: 16px;
    background: var(--bg-primary);
}

.kingkong-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.kingkong-item:active {
    transform: scale(0.95);
}

.kingkong-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: var(--shadow-sm);
}

.kingkong-label {
    font-size: 12px;
    color: var(--text-primary);
}

/* 内容区块 */
.content-section {
    margin-top: 8px;
    background: var(--bg-primary);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 2px;
}

.section-more {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 13px;
    color: var(--text-tertiary);
    cursor: pointer;
}

.section-more svg {
    width: 14px;
    height: 14px;
}

/* 卡片列表 */
.card-list {
    padding: 0 16px 16px;
}

.card-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.card-item:active {
    background: var(--border-light);
}

.card-image {
    width: 100px;
    height: 75px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
}

/* 横向滚动列表 */
.horizontal-scroll {
    display: flex;
    gap: 12px;
    padding: 0 16px 16px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    width: 100%;
    box-sizing: border-box;
}

.horizontal-scroll::-webkit-scrollbar {
    display: none;
}

.scroll-item {
    flex: 0 0 auto;
    width: 140px;
    cursor: pointer;
    display: inline-block;
    vertical-align: top;
}

.scroll-image {
    width: 100%;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    margin-bottom: 8px;
}

.scroll-title {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scroll-desc {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* 直播卡片 */
.live-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
}

.live-cover {
    width: 100%;
    height: 100px;
    object-fit: cover;
}

.live-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 2px 6px;
    background: linear-gradient(90deg, #FF4D4F, #FF7875);
    color: white;
    font-size: 10px;
    border-radius: 4px;
    font-weight: 500;
}

.live-viewers {
    position: absolute;
    bottom: 8px;
    right: 8px;
    padding: 2px 6px;
    background: rgba(0,0,0,0.5);
    color: white;
    font-size: 10px;
    border-radius: 4px;
}

.live-title {
    font-size: 13px;
    color: var(--text-primary);
    margin-top: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-author {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* 行情数字 */
.stock-price {
    font-size: 20px;
    font-weight: 700;
    font-family: 'DIN Alternate', 'Helvetica Neue', Arial, sans-serif;
}

.stock-price.up {
    color: var(--up-color);
}

.stock-price.down {
    color: var(--down-color);
}

.stock-change {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.stock-change.up {
    background: rgba(255, 77, 79, 0.1);
    color: var(--up-color);
}

.stock-change.down {
    background: rgba(82, 196, 26, 0.1);
    color: var(--down-color);
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
    color: var(--text-tertiary);
}

.empty-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.empty-btn {
    padding: 8px 24px;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
}

/* 底部安全区域 */
.safe-area-bottom {
    height: env(safe-area-inset-bottom, 0);
}

/* 页面内容区域 */
.page-content {
    min-height: 100%;
    padding-bottom: 20px;
}

/* 隐藏元素 */
.hidden {
    display: none !important;
}

/* 透明度动画 */
.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

/* 列表加载更多 */
.load-more {
    text-align: center;
    padding: 16px;
    color: var(--text-tertiary);
    font-size: 13px;
}

/* 分割线 */
.divider {
    height: 1px;
    background: var(--border-light);
    margin: 0 16px;
}

/* 徽章 */
.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--error-color);
    color: white;
    font-size: 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}
