/**
 * 开奖网主样式表
 * KJW - Main Stylesheet
 */

/* ============================================================================
   CSS变量
   ============================================================================ */
:root {
    --primary: #e74c3c;
    --primary-dark: #c0392b;
    --primary-light: #fadbd8;
    --secondary: #2c3e50;
    --bg: #f5f5f5;
    --card-bg: #ffffff;
    --text: #333333;
    --text-light: #999999;
    --border: #e8e8e8;
    --success: #27ae60;
    --warning: #f39c12;
    --info: #3498db;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --radius: 8px;
    --ball-red: #e74c3c;
    --ball-blue: #3498db;
    --ball-green: #27ae60;
    --ball-gray: #95a5a6;
}

/* ============================================================================
   全局重置
   ============================================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--primary-dark);
}

/* ============================================================================
   顶部导航
   ============================================================================ */
.header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 1.6rem;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-nav a {
    color: rgba(255,255,255,0.85);
    font-size: 0.9rem;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.3s;
}

.header-nav a:hover,
.header-nav a.active {
    color: #fff;
    background: rgba(255,255,255,0.15);
}

/* 语言选择器 */
.lang-selector {
    position: relative;
}

.lang-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.lang-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 150px;
    margin-top: 4px;
    z-index: 200;
    max-height: 300px;
    overflow-y: auto;
}

.lang-dropdown.show {
    display: block;
}

.lang-dropdown a {
    display: block;
    padding: 8px 16px;
    color: var(--text);
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}

.lang-dropdown a:last-child {
    border-bottom: none;
}

.lang-dropdown a:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* ============================================================================
   主内容区
   ============================================================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

/* ============================================================================
   分类标签栏
   ============================================================================ */
.category-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

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

.tab-btn {
    flex-shrink: 0;
    padding: 8px 20px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
    white-space: nowrap;
}

.tab-btn:hover,
.tab-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.tab-btn .tab-icon {
    margin-right: 4px;
}

/* ============================================================================
   游戏卡片网格
   ============================================================================ */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
    padding: 8px 0;
}

/* ============================================================================
   游戏卡片
   ============================================================================ */
.game-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.game-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}

.card-game-name {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-period {
    font-size: 0.8rem;
    opacity: 0.9;
}

.card-body {
    padding: 10px 12px;
}

/* 号码区域 */
.numbers-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    justify-content: center;
    align-items: center;
    padding: 6px 0;
}

/* 号码球 */
.ball {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
    position: relative;
}

.ball.red { background: var(--ball-red); }
.ball.blue { background: var(--ball-blue); }
.ball.green { background: var(--ball-green); }
.ball.gray { background: var(--ball-gray); }

/* PK10/赛车样式 - 方块 */
.ball.pk {
    border-radius: 4px;
    width: 26px;
    height: 26px;
    min-width: 26px;
    font-size: 0.7rem;
}

.ball.pk1 { background: #f0c929; color: #333; }
.ball.pk2 { background: #3574e8; }
.ball.pk3 { background: #4a4a4a; }
.ball.pk4 { background: #f58e18; }
.ball.pk5 { background: #5cc0eb; }
.ball.pk6 { background: #8b69c8; }
.ball.pk7 { background: #aaaaaa; }
.ball.pk8 { background: #e74c3c; }
.ball.pk9 { background: #7e1818; }
.ball.pk10 { background: #27ae60; }

/* 六合彩特码分隔符 */
.ball-separator {
    display: inline-flex;
    align-items: center;
    color: var(--primary);
    font-weight: 700;
    font-size: 1rem;
    margin: 0 2px;
}

/* 卡片底部 */
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-light);
}

.card-countdown {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--primary);
    font-weight: 600;
}

.card-countdown .countdown-label {
    color: var(--text-light);
    font-weight: normal;
}

.card-link {
    color: var(--info);
    font-size: 0.8rem;
}

/* ============================================================================
   历史记录页面
   ============================================================================ */
.page-title {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
}

.page-title h1 {
    font-size: 1.3rem;
    font-weight: 600;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    cursor: pointer;
    font-size: 0.85rem;
}

.back-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* 日期选择 */
.date-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
}

.date-picker input[type="date"] {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    outline: none;
}

.date-picker input[type="date"]:focus {
    border-color: var(--primary);
}

/* 历史列表 */
.history-table {
    width: 100%;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.history-table table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th,
.history-table td {
    padding: 10px 16px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.history-table th {
    background: var(--secondary);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
}

.history-table tr:hover {
    background: #fafafa;
}

.history-table .numbers-row {
    justify-content: flex-start;
    gap: 3px;
}

.history-table .ball {
    width: 26px;
    height: 26px;
    min-width: 26px;
    font-size: 0.7rem;
}

/* 分页 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 0;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text);
    background: var(--card-bg);
}

.pagination a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination .current {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pagination .disabled {
    opacity: 0.5;
    cursor: not-allowed;
}



/* ============================================================================
   页脚
   ============================================================================ */
.footer {
    background: var(--secondary);
    color: rgba(255,255,255,0.6);
    text-align: center;
    padding: 20px 16px;
    font-size: 0.8rem;
    margin-top: 32px;
}

.footer a {
    color: rgba(255,255,255,0.8);
}

/* ============================================================================
   自动刷新工具栏
   ============================================================================ */
.refresh-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    font-size: 0.85rem;
}

.refresh-bar .refresh-left {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-light);
}

.refresh-bar .refresh-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.refresh-btn {
    padding: 4px 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.3s;
}

.refresh-btn:hover {
    background: var(--primary-dark);
}

/* 开关按钮 */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #ccc;
    border-radius: 22px;
    transition: 0.3s;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--success);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(18px);
}

/* ============================================================================
   无数据提示
   ============================================================================ */
.empty-state {
    text-align: center;
    padding: 60px 16px;
    color: var(--text-light);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 0.95rem;
}

/* ============================================================================
   加载动画
   ============================================================================ */
.loading {
    text-align: center;
    padding: 40px;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================================
   响应式 - 平板
   ============================================================================ */
@media (max-width: 768px) {
    .games-grid {
        grid-template-columns: 1fr;
    }

    .header-inner {
        padding: 0 12px;
    }

    .header-nav {
        gap: 8px;
    }

    .header-nav a {
        font-size: 0.8rem;
        padding: 4px 8px;
    }

    .container {
        padding: 12px;
    }

    .ball {
        width: 26px;
        height: 26px;
        min-width: 26px;
        font-size: 0.7rem;
    }

    .ball.pk {
        width: 24px;
        height: 24px;
        min-width: 24px;
        font-size: 0.65rem;
    }

    .history-table th,
    .history-table td {
        padding: 8px 10px;
        font-size: 0.8rem;
    }
}

/* ============================================================================
   响应式 - 手机
   ============================================================================ */
@media (max-width: 480px) {
    html {
        font-size: 13px;
    }

    .logo {
        font-size: 1.1rem;
    }

    .header-nav a span.nav-text {
        display: none;
    }

    .ball {
        width: 22px;
        height: 22px;
        min-width: 22px;
        font-size: 0.65rem;
    }

    .numbers-row {
        gap: 3px;
    }

    .card-header {
        padding: 10px 12px;
    }

    .card-body {
        padding: 12px;
    }

    .refresh-bar {
        flex-direction: column;
        gap: 8px;
    }
}