/* 麻将计分系统样式表 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #899bef 0%, #3d8bcf 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

h3 {
    color: #368fea;
    margin-bottom: 15px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: 30px;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 36px;
    color: #368fea;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 16px;
}

.session-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.session-header h2 {
    color: #368fea;
    margin: 0;
}

.share-section {
    margin-top: 15px;
}

.share-url {
    display: flex;
    gap: 10px;
}

.share-url input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

/* 表单样式 */
.create-form {
    margin-bottom: 40px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input,
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
textarea:focus {
    outline: none;
    border-color: #368fea;
}

textarea {
    font-family: monospace;
    resize: vertical;
    min-height: 150px;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #368fea;
    color: white;
}

.btn-primary:hover {
    background: #2576d1;
    transform: scale(0.98);
}

.btn-secondary {
    background: #757575;
    color: white;
}

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

.btn-copy {
    background: #1976D2;
    color: white;
}

.btn-copy:hover {
    background: #1565C0;
}

.btn-detail {
    background: #1976D2;
    color: white;
    padding: 6px 12px;
    font-size: 12px;
}

.btn-detail:hover {
    background: #1565C0;
}

.btn-delete {
    background: #F44336;
    color: white;
    padding: 6px 12px;
    font-size: 12px;
}

.btn-delete:hover {
    background: #D32F2F;
}

.btn-link {
    background: none;
    color: #1976D2;
    text-decoration: underline;
    padding: 6px 12px;
}

.btn-link:hover {
    color: #1565C0;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* 标签页样式 */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #eee;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn.active {
    color: #368fea;
    border-bottom-color: #368fea;
}

.tab-btn:hover {
    color: #368fea;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 统计卡片 */
.session-stats {
    margin-bottom: 30px;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
}

/* 表格样式 */
.table-responsive {
    overflow-x: auto;
}


table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

table thead {
    background: #368fea;
}

table th {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    color: white;
    border: 1px solid #ddd;
    white-space: nowrap;
}

table td {
    padding: 10px 8px;
    text-align: center;
    border: 1px solid #eee;
}

table tbody tr:nth-child(odd) {
    background: #f9f9f9;
}

table tbody tr:nth-child(even) {
    background: white;
}

.score {
    font-weight: 600;
}

.score.positive {
    color: #4CAF50;
}

.score.negative {
    color: #F44336;
}

.empty {
    text-align: center;
    color: #999;
    padding: 40px;
}

/* 战绩录入 */
.record-input {
    margin-bottom: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

/* 录入战绩弹窗内容 */
.record-input-content textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: monospace;
    resize: vertical;
    min-height: 200px;
}

.record-input-content .btn-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* 图表区域 */
.chart-section {
    margin-bottom: 30px;
}

/* 战绩列表 */
.records-list {
    margin-bottom: 30px;
}

.score-cell {
    font-weight: 600;
}

.score-cell.positive {
    color: #4CAF50;
}

.score-cell.negative {
    color: #F44336;
}

.score-cell.empty-score {
    color: #999;
    font-weight: normal;
}

/* 历史排行 */
.history-ranking {
    margin-bottom: 30px;
}

.ranking-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.ranking-tab {
    padding: 10px 20px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.ranking-tab.active {
    background: #368fea;
    color: white;
    border-color: #368fea;
}

.ranking-tab:hover {
    background: #368fea;
    color: white;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover {
    color: #000;
}

.player-stats {
    margin-bottom: 30px;
}

.player-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.detail-item {
    padding: 12px;
    background: #f9f9f9;
    border-radius: 6px;
}

.detail-item label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.detail-item span {
    font-size: 18px;
    font-weight: 600;
}

pre {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.6;
}

/* 功能介绍 */
.feature-intro {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
}

.feature-intro ul {
    list-style: none;
    padding: 0;
}

.feature-intro li {
    padding: 8px 0;
    font-size: 15px;
    color: #555;
}

/* 加载动画 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #368fea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast提示 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    z-index: 3000;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    background: #4CAF50;
}

.toast-error {
    background: #F44336;
}

.toast-info {
    background: #2196F3;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .share-url {
        flex-direction: column;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    table {
        font-size: 12px;
    }
    
    table th,
    table td {
        padding: 8px 4px;
    }
    
    .records-table th,
    .records-table td {
        padding: 8px 4px;
        font-size: 12px;
    }
    
    .player-detail-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 10% 10px;
        padding: 20px;
    }
}

/* 平板端优化 */
@media (min-width: 481px) and (max-width: 768px) {
    .stats-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .stat-value {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    /* .tabs {
        flex-direction: column;
    } */
    
    .ranking-tabs {
        flex-direction: column;
    }
    
    /* 对局数据卡片移动端优化 */
    .stats-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .stat-card {
        padding: 12px 8px;
    }
    
    .stat-label {
        font-size: 11px;
        margin-bottom: 5px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .session-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .record-input-content .btn-group {
        flex-direction: column;
    }
}

/* 对局列表页样式 */
.session-list {
    margin-top: 20px;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-ongoing {
    background: #E8F5E9;
    color: #2E7D32;
}

.status-finished {
    background: #E3F2FD;
    color: #1976D2;
}

.link {
    color: #1976D2;
    text-decoration: none;
}

.link:hover {
    text-decoration: underline;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.page-btn:hover {
    background: #f5f5f5;
    border-color: #368fea;
}

.page-btn.active {
    background: #368fea;
    color: white;
    border-color: #368fea;
}

.page-ellipsis {
    padding: 8px 4px;
    color: #999;
}

/* 战绩明细弹窗样式 */
.detail-modal-content {
    max-width: 600px;
}

.record-basic-info {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.record-basic-info .info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.record-basic-info .info-item {
    display: flex;
    gap: 8px;
}

.record-basic-info .info-label {
    font-weight: 500;
    color: #666;
}

.record-basic-info .info-value {
    color: #333;
}

.player-detail-table {
    margin-bottom: 20px;
}

.player-detail-table table {
    width: 100%;
}

.rank-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

.rank-1 {
    background: #FFD700;
    color: #fff;
}

.rank-2 {
    background: #C0C0C0;
    color: #333;
}

.rank-3 {
    background: #CD7F32;
    color: #fff;
}

.status-win {
    color: #2E7D32;
    font-weight: 500;
}

.status-lose {
    color: #D32F2F;
    font-weight: 500;
}

.status-draw {
    color: #757575;
    font-weight: 500;
}

.raw-content-section {
    margin-top: 20px;
}

.raw-content-toggle {
    background: #f5f5f5;
    border: none;
    padding: 10px 15px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.raw-content-toggle:hover {
    background: #eeeeee;
}

.raw-content-body {
    display: none;
    margin-top: 10px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
    max-height: 300px;
    overflow-y: auto;
}

.raw-content-body.show {
    display: block;
}

.raw-content-body pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: monospace;
    font-size: 12px;
    color: #333;
}

/* ========== 新增样式：对局状态和按钮 ========== */

/* 对局头部布局 */
.session-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.session-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* 状态标签 */
.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.status-ongoing {
    background: #4CAF50;
    color: white;
}

.status-finished {
    background: #757575;
    color: white;
}

/* 警告按钮（结束对局） */
.btn-warning {
    background: #FF9800;
    color: white;
}

.btn-warning:hover {
    background: #F57C00;
}

/* 小型按钮 */
.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

/* 玩家统计区域头部 */
.player-stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.player-stats-header h3 {
    margin-bottom: 0;
}

/* ========== 添加玩家弹窗样式 ========== */

.add-player-content {
    margin-top: 20px;
}

/* 玩家模式切换标签 */
.player-mode-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.player-mode-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: -2px;
}

.player-mode-tab:hover {
    color: #368fea;
}

.player-mode-tab.active {
    color: #368fea;
    border-bottom-color: #368fea;
}

/* 模式内容区域 */
.player-mode-content {
    display: none;
}

.player-mode-content.active {
    display: block;
}

/* 搜索框 */
.search-box {
    margin-bottom: 15px;
}

.search-box input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.search-box input:focus {
    outline: none;
    border-color: #368fea;
}

/* 玩家列表 */
.player-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 15px;
}

.player-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

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

.player-item:hover {
    background: #f5f5f5;
}

.player-item.selected {
    background: #e3f2fd;
    border-left: 3px solid #368fea;
}

.player-nickname {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.player-info {
    font-size: 12px;
    color: #666;
    display: flex;
    gap: 12px;
}

.player-info span {
    white-space: nowrap;
}

.empty-hint {
    padding: 40px 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* 字符计数 */
.char-count {
    text-align: right;
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

/* 禁用状态 */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button:disabled:hover {
    transform: none;
}

/* ========== 响应式调整 ========== */

@media (max-width: 768px) {
    .session-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .session-title-group {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .session-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .session-actions .btn {
        flex: 1;
        min-width: 120px;
    }
    
    .player-stats-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .player-stats-header .btn {
        width: 100%;
    }
}
