/* 共享样式文件 - 提取重复的CSS类定义 */

/* CSS变量系统 - 提高可维护性 */
:root {
    /* 主色调 */
    --primary-color: #24be58;
    --primary-dark: #1ea84d;
    --secondary-color: #ff6b6b;
    --secondary-dark: #ff4757;
    
    /* 中性色 */
    --text-primary: #333;
    --text-secondary: #666;
    --text-muted: #999;
    --bg-primary: #f5f5f5;
    --bg-white: #ffffff;
    --border-color: #e0e0e0;
    --shadow-light: rgba(0,0,0,0.1);
    --shadow-medium: rgba(0,0,0,0.15);
    
    /* 布局变量 */
    --container-max-width: 1200px;
    --container-padding: 15px;
    --container-padding-bottom: 20px;
    --border-radius: 8px;
    --border-radius-sm: 4px;
    
    /* 动画变量 */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.4s ease;
    
    /* z-index层级 */
    --z-bottom-nav: 900;
    --z-bet-slip: 1000;
    --z-modal: 1000;
}

/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    
    /* 滚动条优化 - 确保页面有足够的滚动空间 */
    overflow-x: hidden;
    min-height: 100vh;
}

/* 页面主容器滚动优化 - 统一高度设置 */
.main-content {
    min-height: calc(100vh - 120px); /* 确保内容区域有足够高度 */
    padding-bottom: 20px;
}

/* 布局容器 */
.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
    padding-bottom: var(--container-padding-bottom);
}

/* 移动端滚动优化 */
@media (max-width: 767px) {
    body {
        -webkit-overflow-scrolling: touch; /* iOS滚动惯性 */
        overscroll-behavior-y: contain; /* 防止页面过度滚动 */
    }
    
    .main-content {
        min-height: calc(100vh - 140px); /* 手机端更大的内容区域 */
    }
    
    /* 安全区域适配 */
    .container {
        padding-left: max(var(--container-padding), env(safe-area-inset-left));
        padding-right: max(var(--container-padding), env(safe-area-inset-right));
    }
}

/* 响应式滚动条优化 - 确保底部内容完整显示 */

/* PC端底部间距优化 - 避免底部导航栏遮挡内容 */
@media (min-width: 1025px) {
    .container {
        padding-bottom: 60px; /* 为底部导航栏留出足够空间 */
    }
}

/* iPad端滚动条优化 */
@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        padding-bottom: 80px; /* iPad端底部间距：考虑底部导航栏高度(70px) + 额外安全间距(10px) */
    }
    
    /* iPad横屏优化 */
    @media (orientation: landscape) {
        .container {
            padding-bottom: 50px; /* 横屏时底部间距：考虑底部导航栏高度(70px) + 额外安全间距(-20px) */
        }
    }
}

/* 手机端/H5端滚动条优化 */
@media (max-width: 767px) {
    .container {
        padding-bottom: 100px; /* 手机端底部间距：考虑底部导航栏高度(80px) + 额外安全间距(20px) */
    }
    
    /* 确保页面主体有足够的滚动空间 */
    body {
        overflow-x: hidden;
        min-height: 100vh;
    }
    
    /* 针对小屏幕手机的优化 */
    @media (max-width: 375px) {
        .container {
            padding-bottom: 110px; /* 小屏幕手机底部间距：考虑底部导航栏高度(90px) + 额外安全间距(20px) */
        }
    }
    
    /* 针对全面屏手机的优化 */
    @media (max-width: 414px) and (min-height: 800px) {
        .container {
            padding-bottom: 100px; /* 全面屏手机底部间距：考虑底部导航栏高度(80px) + 额外安全间距(20px) */
        }
    }
}

/* 头部样式 - 重新设计布局 */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 8px 0; /* 减少纵向padding */
    box-shadow: 0 2px 10px var(--shadow-light);
    position: relative;
    z-index: 100;
    min-height: 50px; /* 设置最小高度，避免内容过小时header太矮 */
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px; /* 减少内层container高度 */
    margin: 0 auto;
    max-width: var(--container-max-width);
    padding: 0 var(--container-padding);
}

.header h1 {
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
}

/* 响应式header高度优化 */
@media (max-width: 1024px) and (min-width: 769px) {
    .header {
        padding: 6px 0;
        min-height: 45px;
    }
    
    .header .container {
        height: 35px; /* iPad端header高度 */
    }
    
    .header h1 {
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 5px 0;
        min-height: 40px;
    }
    
    .header .container {
        height: 30px; /* 手机端header高度 */
    }
    
    .header h1 {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 4px 0;
        min-height: 35px;
    }
    
    .header .container {
        height: 25px; /* 超小屏幕header高度 */
    }
    
    .header h1 {
        font-size: 17px;
    }
}

/* 筛选栏样式 */
.filter-bar {
    background: var(--bg-white);
    padding: 12px var(--container-padding);
    margin: 10px 0;
    border-radius: var(--border-radius);
    box-shadow: 0 1px 3px var(--shadow-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.filter-bar .tabs {
    flex: 1;
    min-width: 0;
}

.filter-bar .filter-item {
    flex-shrink: 0;
}

/* 标签页样式 */
.tabs {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    flex-wrap: nowrap;
    justify-content: space-between;
    width: 100%;
}

.tab-group {
    display: flex;
    flex-direction: column;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    background: #fff;
    overflow: hidden;
    min-width: 0;
    flex: 1;
    height: 56px;
    min-width: 80px;
    max-width: 120px;
    transition: all 0.3s;
}

.tab-group.active {
    border-color: var(--secondary-dark);
    background: var(--secondary-dark);
}

.tab-item {
    padding: 0;
    border: none;
    border-bottom: 1px solid #eee;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    background: var(--bg-white);
    transition: all var(--transition-normal);
    white-space: nowrap;
    text-align: center;
    line-height: 1.2;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 0 4px;
    box-sizing: border-box;
}

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

.tab-item.active {
    background: var(--secondary-dark);
    color: white;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.tab-group.active .tab-item {
    background: var(--secondary-dark);
    color: white;
    border-bottom-color: rgba(255,255,255,0.3);
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.tab-group.active .tab-item:last-child {
    border-bottom: none;
}

/* 筛选项样式 */
.filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-item label {
    font-size: 15px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* 表单元素样式 */
select, input {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
}

/* 比赛列表样式 */
.match-list {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 1px 3px var(--shadow-light);
    margin-bottom: 20px;
}

.date-header {
    background: #f8f8f8;
    padding: 10px var(--container-padding);
    font-weight: 600;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.match-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    transition: background-color var(--transition-normal);
}

.match-item:hover {
    background-color: #f9f9f9;
}

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.match-number {
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: var(--border-radius-sm);
    font-size: 12px;
}

.match-time {
    color: var(--text-secondary);
    font-size: 15px;
}

.match-status {
    background: var(--secondary-color);
    color: white;
    padding: 2px 6px;
    border-radius: var(--border-radius-sm);
    font-size: 13px;
}

.match-status.selling {
    background: var(--primary-color);
}

.match-status.stopsell {
    background: #ff9500;
}

.match-status.finished {
    background: var(--text-muted);
}

/* 赔率网格样式 */
.odds-grid {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.odds-group {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    min-width: 0;
}

.odds-group-title {
    background: #f8f8f8;
    padding: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.odds-items {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
}

.odds-item {
    padding: 10px 5px;
    text-align: center;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    border-right: 1px solid #f0f0f0;
    transition: all var(--transition-normal);
    font-size: 13px;
}

.odds-item:nth-child(5n) {
    border-right: none;
}

.odds-item:hover {
    background-color: #f9f9f9;
}

.odds-item.selected {
    background-color: #f84a4a;
    color: white;
}

.odds-item.selected .odds-value {
    color: white;
}

.odds-item.expired {
    background-color: #f0f0f0;
    color: var(--text-muted);
    cursor: not-allowed;
    pointer-events: none;
}

.odds-item.expired .odds-value {
    color: var(--text-muted);
}

.odds-score {
    font-weight: 600;
    margin-bottom: 2px;
    font-size: 14px;
}

.odds-value {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 15px;
}

/* 底部导航栏样式 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    padding: 10px var(--container-padding);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: var(--z-bottom-nav);
    
    /* 响应式高度调整 */
    min-height: 60px;
}

/* 不同设备的底部导航栏高度优化 */
@media (min-width: 768px) and (max-width: 1024px) {
    .bottom-nav {
        min-height: 70px; /* iPad端导航栏更高 */
        padding: 12px var(--container-padding);
    }
}

@media (max-width: 767px) {
    .bottom-nav {
        min-height: 80px; /* 手机端导航栏更高 */
        padding: 15px var(--container-padding);
        
        /* 安全区域适配 */
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }
    
    /* 小屏幕手机优化 */
    @media (max-width: 375px) {
        .bottom-nav {
            min-height: 90px;
            padding: 18px var(--container-padding);
        }
    }
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 12px;
    transition: all var(--transition-normal);
}

.nav-item.active {
    color: var(--primary-color);
    transform: scale(1.05);
}

.nav-item:hover {
    color: var(--primary-color);
}

.nav-icon {
    font-size: 20px;
    transition: all var(--transition-normal);
}

/* 按钮样式 */
.btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-size: 14px;
    display: inline-block;
    text-align: center;
    min-width: 100px;
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 5px var(--shadow-medium);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #f8f8f8;
    color: var(--text-secondary);
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #e9e9e9;
}

.btn-danger {
    background: var(--secondary-color);
}

.btn-danger:hover {
    background: var(--secondary-dark);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tabs {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .tab-group {
        min-width: 70px;
        max-width: 100px;
    }
    
    .odds-grid {
        flex-direction: column;
    }
    
    .odds-group {
        min-width: auto;
    }
}