/**
 * GAMX-UI - 仪表盘页面样式
 * 版本: 1.0.0
 * 描述: 定义GAMX管理系统仪表盘各组件样式
 */

/* ---------- 1. 基础布局样式 ---------- */
body {
    padding: 20px;
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* 页面标题栏 */
.page-title {
    font-size: 30px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 日期范围选择器 */
.date-range-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-range-selector select {
    padding: 8px 12px;
    background-color: var(--card-bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 6px;
    /* 自定义下拉箭头 */
    padding-right: 24px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.date-range-selector .btn-outline {
    background-color: var(--card-bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.date-range-selector .btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 移除IE下的默认下拉箭头 */
.date-range-selector select::-ms-expand,
.time-range-selector::-ms-expand {
    display: none;
}

/* ---------- 2. 统计卡片网格布局 ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
    grid-auto-flow: row;
}

/* 统计卡片基础样式 */
.stat-card {
    background-color: var(--card-bg-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    min-width: 0;
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.stat-title {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(30, 136, 229, 0.1);
    color: var(--primary-color);
}

.stat-value {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
}

.stat-change {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 增长/减少指示器颜色 */
.change-positive {
    color: var(--success-color);
}

.change-negative {
    color: var(--danger-color);
}

/* 卡片底部指示条 */
.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: var(--primary-color);
}

/* 各卡片类型底部颜色定义 */
.users-online::after { background-color: #e54e1e; }
.new-users::after { background-color: #00C853; }
.total-users::after { background-color: #a5486c; }
.active-users::after { background-color: #3e4b59; }
.today-invite::after { background-color: #e9cb1e; }
.transactions-count::after { background-color: #777781; }
.total-invites::after { background-color: #1665bc; }
.payment-amount::after { background-color: #00BCD4; }

/* 各卡片类型图标背景定义 */
.transactions-count .stat-icon {
    background-color: rgba(255, 87, 34, 0.1);
    color: #FF5722;
}

.total-invites .stat-icon {
    background-color: rgba(156, 39, 176, 0.1);
    color: #9C27B0;
}

.total-users .stat-icon {
    background-color: rgba(233, 30, 99, 0.1);
    color: #E91E63;
}

/* ---------- 3. 图表卡片布局 ---------- */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 20px;
}

/* 图表卡片基础样式 */
.chart-card {
    background-color: var(--card-bg-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    height: 380px;
}

.chart-card h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--text-color);
}

.chart-container {
    position: relative;
    height: calc(100% - 60px);
    width: 100%;
}

/* 图表标题区域 */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.chart-header h3 {
    margin: 0;
    font-size: 18px;
    line-height: 1.3;
    display: flex;
    align-items: center;
    height: 32px; /* 与选择器高度一致 */
}

/* 时间范围选择器 */
.time-range-selector {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg-color);
    color: var(--text-color);
    font-size: 13px;
    cursor: pointer;
    outline: none;
    
    height: 32px; /* 固定高度 */
    box-sizing: border-box;
    /* 自定义下拉箭头 */
    padding-right: 24px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.time-range-selector:hover {
    border-color: var(--primary-color);
}

/* 确保所有表格卡片中的chart-header也应用相同的样式 */
.table-card .chart-header {
    margin-bottom: 15px;
    align-items: center;
}

.table-card .chart-header h3 {
    font-size: 18px;
    margin: 0;
    line-height: 1.3;
    display: flex;
    align-items: center;
    height: 32px;
}

/* ---------- 4. 数据表格样式 ---------- */
/* 表格卡片容器 */
.table-card {
    background-color: var(--card-bg-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    overflow: auto;
    height: 380px;
}

.table-card h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--text-color);
}

.table-card .chart-header {
    margin-bottom: 10px;
}

/* 数据表格基础样式 */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px 15px;
    background-color: rgba(0, 0, 0, 0.03);
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 15px;
    border-top: 1px solid var(--border-color);
}

.data-table tr:hover {
    background-color: rgba(0, 0, 0, 0.01);
}

/* 非支付交易表格样式优化 */
.data-table:not(.payment-transactions) {
    margin-top: 5px;
}

.data-table:not(.payment-transactions) th {
    padding: 8px 15px;
    font-weight: 600;
}

.data-table:not(.payment-transactions) td {
    padding: 10px 15px;
}

.data-table:not(.payment-transactions) tr {
    line-height: 1.2;
}

.data-table:not(.payment-transactions) .client-icon {
    font-size: 14px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 进度条样式 */
.progress-bar {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    margin-top: 4px;
}

.progress-value {
    height: 100%;
    border-radius: 10px;
}

.data-table:not(.payment-transactions) .progress-bar {
    height: 6px;
    margin-top: 2px;
}

.data-table:not(.payment-transactions) .progress-value {
    height: 6px;
}

/* 表格行详情 */
.table-row-details {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 国旗图标 */
.country-flag {
    width: 24px;
    height: auto;
    margin-right: 10px;
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.country-flag-small {
    width: 22px;
    height: auto;
    border-radius: 2px;
    display: block;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* 客户端图标 */
.client-icon {
    width: 26px;
    height: 26px;
    margin-right: 10px;
    border-radius: 50%;
    background-color: rgba(30, 136, 229, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.client-icon i, 
.client-icon .fas {
    position: relative;
    /* 可以调整这些值来控制图标的位置偏移 */
    top: 3px;  /* 向下偏移1px */
    left: 5px;
    /* 调整图标大小 */
    font-size: 13px;
}

/* compass图标特殊调整 */
.client-icon.discover-icon .fas {
    top: 0.5px;  /* 向下偏移0.5px */
    left: 0px;
}

/* briefcase图标特殊调整 */
.client-icon.workspace-icon .fas {
    top: 0.5px;
}

/* users图标特殊调整 */
.client-icon.club-icon .fas {
    top: 0px;
    font-size: 12px;  /* 略小一些 */
}

/* user图标特殊调整 */
.client-icon.profile-icon .fas {
    top: 0px;
}

.data-table:not(.payment-transactions) .client-icon {
    font-size: 14px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.data-table:not(.payment-transactions) .client-icon i,
.data-table:not(.payment-transactions) .client-icon .fas {
    position: relative;
    top: 1px;  /* 向下偏移1px，根据需要调整 */
    left: 0px;
}

/* ---------- 5. 支付交易表格样式 ---------- */
.payment-table {
    max-height: 380px;
}

.payment-table .data-table {
    margin-top: 15px;
}

.payment-transactions {
    margin: 0;
    padding: 0;
}

.payment-transactions th,
.payment-transactions td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    padding: 10px 8px;
    vertical-align: middle;
    line-height: 1.5;
}

.payment-transactions tr {
    height: 28px;
}

.payment-transactions td:nth-child(4) {
    font-weight: 500;
}

.payment-transactions th {
    padding-top: 12px;
    padding-bottom: 12px;
    text-align: left;
}

.payment-transactions th:nth-child(3),
.payment-transactions th:nth-child(5) {
    text-align: center;
}

/* 订单类型标签 */
.order-type {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    display: inline-block;
    font-weight: 500;
    color: white;
    text-align: center;
    min-width: 70px;
    margin: 0 auto;
}

/* 订单类型颜色 */
.type-member { background-color: #4CAF50; }
.type-plan { background-color: #2196F3; }
.type-strategy { background-color: #9C27B0; }
.type-cable { background-color: #FF9800; }

/* 支付交易表格列宽设置 */
.payment-transactions th:nth-child(1),
.payment-transactions td:nth-child(1) { width: 14%; }

.payment-transactions th:nth-child(2),
.payment-transactions td:nth-child(2) { width: 16%; }

.payment-transactions th:nth-child(3),
.payment-transactions td:nth-child(3) { 
    width: 10%; 
    text-align: center;
}

.payment-transactions th:nth-child(4),
.payment-transactions td:nth-child(4) { width: 18%; }

.payment-transactions th:nth-child(5),
.payment-transactions td:nth-child(5) { 
    width: 22%; 
    text-align: center;
}

/* ---------- 6. 设备分布样式 ---------- */
/* 弹性表格布局 */
.flex-tables {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 20px;
}

/* 设备分布卡片 */
.device-distribution-card {
    padding: 20px;
}

.device-distribution-wrapper {
    height: calc(100% - 60px);
    display: flex;
    justify-content: center;
}

/* 设备分布容器 */
.device-distribution-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 40px;
    margin-top: 15px;
    justify-content: center;
    align-items: center;
    max-width: 600px;
    height: 100%;
}

/* 饼图容器 */
.pie-chart-container {
    flex: 0 1 280px;
    min-width: 220px;
    max-width: 280px;
    height: 280px;
    margin: 0;
}

/* 设备图例容器 */
.device-legend {
    flex: 0 1 260px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    min-width: 200px;
    max-width: 260px;
    padding-left: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    padding: 6px 0;
    transition: transform 0.15s ease;
}

.legend-item:hover {
    transform: translateX(2px);
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    margin-right: 10px;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.legend-item:hover .legend-color {
    transform: scale(1.1);
}

.legend-text {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    width: 100%;
    max-width: 160px;
    align-items: center;
}

.device-name {
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.device-percentage {
    font-weight: 600;
    color: var(--text-secondary);
    text-align: right;
    min-width: 35px;
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 13px;
}

/* 设备图例颜色 */
.apple-color { background-color: #000; }
.samsung-color { background-color: #1452bf; }
.huawei-color { background-color: #d32027; }
.xiaomi-color { background-color: #ff6700; }
.oppo-color { background-color: #009f87; }
.others-color { background-color: #969696; }

/* 手机品牌图标样式 */
.apple-icon { background-color: rgba(0, 0, 0, 0.05); color: #000; }
.samsung-icon { background-color: rgba(20, 82, 191, 0.1); color: #1452bf; }
.huawei-icon { background-color: rgba(211, 32, 39, 0.1); color: #d32027; }
.xiaomi-icon { background-color: rgba(255, 103, 0, 0.1); color: #ff6700; }
.oppo-icon { background-color: rgba(0, 159, 135, 0.1); color: #009f87; }
.oneplus-icon { background-color: rgba(238, 63, 51, 0.1); color: #ee3f33; }
.others-icon { background-color: rgba(150, 150, 150, 0.1); color: #969696; }

/* 品牌图标大小调整 */
.fa-apple { font-size: 16px; }

/* 为每个品牌添加独特的进度条颜色 */
.progress-value.apple { background-color: #000 !important; }
.progress-value.samsung { background-color: #1452bf !important; }
.progress-value.huawei { background-color: #d32027 !important; }
.progress-value.xiaomi { background-color: #ff6700 !important; }
.progress-value.oppo { background-color: #009f87 !important; }
.progress-value.oneplus { background-color: #ee3f33 !important; }

/* ---------- 7. App板块样式 ---------- */
/* App板块图标样式 */
.home-icon { background-color: rgba(33, 150, 243, 0.1); color: #2196F3; padding: 6px 6px;}
.discover-icon { background-color: rgba(233, 30, 99, 0.1); color: #E91E63; padding: 6px 7px;}
.workspace-icon { background-color: rgba(76, 175, 80, 0.1); color: #4CAF50; padding: 6px 7px;}
.club-icon { background-color: rgba(156, 39, 176, 0.1); color: #9C27B0; padding: 6px 6px;}
.profile-icon { background-color: rgba(255, 152, 0, 0.1); color: #FF9800; padding: 6px 7px;}

/* App板块进度条样式 */
.progress-value.home-section { background-color: #2196F3 !important; }
.progress-value.discover-section { background-color: #E91E63 !important; }
.progress-value.workspace-section { background-color: #4CAF50 !important; }
.progress-value.club-section { background-color: #9C27B0 !important; }
.progress-value.profile-section { background-color: #FF9800 !important; }

/* ---------- 8. 国家地区分布柱状图 ---------- */
.country-distribution-card {
    margin-bottom: 30px;
}

.country-distribution-card .chart-container {
    height: calc(100% - 60px);
    margin-top: 10px;
}

/* 确保表格内容高度合适 */
.table-card .chart-container {
    height: calc(100% - 60px);
}

/* ---------- 9. 响应式布局适配 ---------- */
/* 大中屏幕适配 */
@media (max-width: 1200px) and (min-width: 769px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 平板和移动设备适配 */
@media (max-width: 768px) {
    /* 调整卡片网格布局 */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-value {
        font-size: 28px;
    }
    
    /* 调整图表布局 */
    .charts-row,
    .flex-tables {
        grid-template-columns: 1fr;
    }
    
    /* 调整高度 */
    .table-card,
    .chart-card {
        height: 350px;
    }

    .table-card .chart-container,
    .chart-card .chart-container,
    .device-distribution-wrapper {
        height: calc(100% - 50px);
    }
    
    /* 设备分布样式调整 */
    .device-distribution-card {
        padding: 20px;
    }
    
    .device-distribution-container {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 20px;
        padding: 0;
    }
    
    .pie-chart-container {
        flex: 0 0 180px;
        min-width: 180px;
        max-width: 180px;
        height: 180px;
    }
    
    .device-legend {
        flex: 1;
        padding-left: 0;
        min-width: 120px;
        max-width: none;
    }
    
    /* 图例调整 */
    .legend-text {
        max-width: 120px;
        gap: 4px;
    }
    
    .device-name {
        font-size: 12px;
    }
    
    .device-percentage {
        padding: 1px 4px;
        font-size: 11px;
        min-width: 30px;
    }
    
    .legend-color {
        width: 12px;
        height: 12px;
        margin-right: 8px;
    }
    
    .legend-item {
        padding: 4px 0;
    }
    
    /* 国家分布图表高度调整 */
    .country-distribution-card .chart-container {
        height: 300px;
    }
    
    /* 支付交易表格调整 */
    .payment-transactions th,
    .payment-transactions td {
        padding: 8px 5px;
        font-size: 12px;
    }
    
    .order-type {
        padding: 3px 6px;
        font-size: 11px;
        min-width: 60px;
    }
    
    .country-flag-small {
        width: 18px;
    }
    
    .payment-transactions td:nth-child(5) {
        padding-right: 10px;
    }
}

/* 小屏幕手机适配 */
@media (max-width: 480px) {
    /* 卡片高度调整 */
    .table-card,
    .chart-card {
        height: 320px;
    }
    
    /* 设备分布调整 */
    .device-distribution-wrapper {
        padding: 0 5px;
    }
    
    .device-distribution-container {
        gap: 10px;
    }
    
    .pie-chart-container {
        flex: 0 0 150px;
        min-width: 150px;
        max-width: 150px;
        height: 150px;
    }
    
    .device-legend {
        min-width: 100px;
    }
    
    /* 国家分布高度调整 */
    .country-distribution-card .chart-container {
        height: 250px;
    }
} 