/**
 * 党务知识竞赛 H5 系统 - 主题样式
 * 红金配色方案
 */

/* ===== CSS 变量 ===== */
:root {
    --primary-red: #C41E24;
    --primary-red-dark: #9B1B1F;
    --primary-red-light: #E8434A;
    --accent-gold: #D4A843;
    --accent-gold-light: #E8C96A;
    --accent-gold-dark: #B08A2F;
    --dark-red: #8B1A1A;
    --bg-warm: #FFF8F0;
    --text-dark: #333333;
    --text-muted: #6c757d;
    --success-green: #28A745;
    --danger-red: #DC3545;
    --gradient-red: linear-gradient(135deg, #C41E24 0%, #9B1B1F 100%);
    --gradient-gold: linear-gradient(135deg, #D4A843 0%, #E8C96A 100%);
    --gradient-red-dark: linear-gradient(180deg, #C41E24 0%, #8B1A1A 100%);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* ===== 全局样式 ===== */
* {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
}

/* ===== 登录/注册页面 ===== */
.login-body {
    min-height: 100vh;
    background: var(--gradient-red-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    padding: 20px 0 30px;
    color: #fff;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
    background: var(--gradient-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(212, 168, 67, 0.4);
}

.login-logo i {
    font-size: 36px;
    color: #fff;
}

.login-header h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.login-header .subtitle {
    font-size: 14px;
    opacity: 0.8;
    margin: 0;
}

.login-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 30px 25px;
    box-shadow: var(--shadow-lg);
}

.login-card .card-title {
    color: var(--primary-red);
    font-weight: 600;
}

.login-card .form-text {
    font-size: 12px;
    margin-top: 4px;
    padding-left: 50px;
}

.btn-login {
    background: var(--gradient-red);
    border: none;
    height: 50px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 4px;
    border-radius: var(--radius-md);
    transition: all 0.3s;
}

.btn-login:hover, .btn-login:focus {
    background: var(--gradient-gold);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 168, 67, 0.4);
}

.login-footer {
    text-align: center;
    padding: 20px 0;
}

/* ===== Toast 提示 ===== */
#alertToast {
    min-width: 250px;
}

#alertToast.toast-success {
    background: #d4edda;
    color: #155724;
}

#alertToast.toast-error {
    background: #f8d7da;
    color: #721c24;
}

/* ===== 答题页面 ===== */
.quiz-body {
    background: var(--bg-warm);
    min-height: 100vh;
    padding-bottom: 120px;
}

.quiz-navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--gradient-red);
    color: #fff;
    padding: 12px 16px;
    box-shadow: var(--shadow-sm);
}

.quiz-timer {
    font-size: 18px;
    font-weight: 600;
}

.quiz-timer i {
    margin-right: 4px;
}

.quiz-timer.warning {
    color: var(--accent-gold-light);
    animation: pulse 1s infinite;
}

.quiz-timer.danger {
    color: #ff6b6b;
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.quiz-progress-text {
    font-size: 14px;
}

.quiz-content {
    padding: 16px;
    max-width: 600px;
    margin: 0 auto;
}

/* 题目卡片 */
.question-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    scroll-margin-top: 80px;
}

.question-card.active {
    box-shadow: 0 0 0 2px var(--primary-red), var(--shadow-md);
}

.question-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.question-num {
    width: 32px;
    height: 32px;
    background: var(--primary-red);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    margin-right: 10px;
}

.question-type-badge {
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 20px;
    margin-right: 8px;
}

.question-type-badge.single {
    background: rgba(196, 30, 36, 0.1);
    color: var(--primary-red);
}

.question-type-badge.multi {
    background: rgba(212, 168, 67, 0.15);
    color: var(--accent-gold-dark);
}

.question-points {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}

.question-content {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 16px;
    color: var(--text-dark);
}

.question-hint {
    font-size: 13px;
    color: var(--accent-gold-dark);
    background: rgba(212, 168, 67, 0.1);
    padding: 6px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
}

/* 选项按钮 */
.option-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 10px;
    border: 2px solid #e9ecef;
    border-radius: var(--radius-sm);
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
    text-align: left;
    color: var(--text-dark);
}

.option-btn:hover {
    border-color: var(--primary-red-light);
    background: #fff5f5;
}

.option-btn.selected {
    border-color: var(--primary-red);
    background: var(--primary-red);
    color: #fff;
}

.option-btn.selected .option-letter {
    background: #fff;
    color: var(--primary-red);
}

.option-letter {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
    margin-right: 12px;
    transition: all 0.2s;
}

.option-text {
    flex: 1;
    line-height: 1.4;
}

/* 提交区域 */
.quiz-submit-area {
    padding: 20px 16px;
    max-width: 600px;
    margin: 0 auto;
}

.btn-submit-quiz {
    background: var(--gradient-gold);
    border: none;
    height: 54px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 3px;
    border-radius: var(--radius-md);
    color: #fff;
    box-shadow: 0 4px 16px rgba(212, 168, 67, 0.4);
    transition: all 0.3s;
}

.btn-submit-quiz:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 168, 67, 0.5);
    color: #fff;
}

.btn-submit-quiz:disabled {
    opacity: 0.6;
    transform: none;
}

/* 题号导航 */
.quiz-nav-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
    padding: 12px 16px;
    z-index: 100;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
}

.nav-item {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: #f0f0f0;
    color: #666;
}

.nav-item.answered {
    background: var(--success-green);
    color: #fff;
}

.nav-item.current {
    background: var(--primary-red);
    color: #fff;
    transform: scale(1.1);
}

/* ===== 成绩页面 ===== */
.result-body {
    background: var(--gradient-red-dark);
    min-height: 100vh;
    color: #fff;
}

.result-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px 0;
}

.result-hero {
    text-align: center;
    padding: 40px 20px 30px;
}

.result-badge {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    background: var(--gradient-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(212, 168, 67, 0.5);
}

.result-badge i {
    font-size: 40px;
    color: #fff;
}

.score-display {
    margin: 25px 0 15px;
}

.score-number {
    font-size: 72px;
    font-weight: 800;
    color: var(--accent-gold-light);
    text-shadow: 0 2px 10px rgba(212, 168, 67, 0.5);
    line-height: 1;
}

.score-unit {
    font-size: 24px;
    color: var(--accent-gold);
    margin-left: 5px;
}

.result-meta {
    font-size: 14px;
    color: rgba(255,255,255,0.7);
}

/* 答题详情卡片 */
.detail-card {
    background: #fff;
    border-radius: var(--radius-md);
    overflow: hidden;
    color: var(--text-dark);
}

.detail-card.correct {
    border-left: 4px solid var(--success-green);
}

.detail-card.wrong {
    border-left: 4px solid var(--danger-red);
}

.detail-header {
    padding: 12px 16px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-num {
    width: 28px;
    height: 28px;
    background: var(--primary-red);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.detail-body {
    padding: 16px;
}

.detail-question {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 12px;
}

.detail-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 6px;
    border-radius: 6px;
    font-size: 14px;
    background: #f8f9fa;
}

.detail-option.is-answer {
    background: #d4edda;
}

.detail-option.is-wrong {
    background: #f8d7da;
}

.detail-option .option-key {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    margin-right: 10px;
    flex-shrink: 0;
}

/* ===== 排行榜页面 ===== */
.leaderboard-body {
    background: #f5f5f5;
    min-height: 100vh;
}

.leaderboard-container {
    max-width: 500px;
    margin: 0 auto;
    background: #fff;
    min-height: 100vh;
}

.leaderboard-header {
    background: var(--gradient-red);
    color: #fff;
    padding: 16px 20px;
}

.leaderboard-tabs {
    border-bottom: none;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.leaderboard-tabs .nav-link {
    color: var(--text-muted);
    border: none;
    border-bottom: 3px solid transparent;
    padding: 12px 20px;
    font-weight: 600;
    font-size: 15px;
}

.leaderboard-tabs .nav-link.active {
    color: var(--primary-red);
    border-bottom-color: var(--primary-red);
    background: transparent;
}

/* 排行列表项 */
.rank-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.rank-item:hover {
    background: #fafafa;
}

.rank-item.top-1 {
    background: linear-gradient(90deg, #fff9e6 0%, #fff 100%);
}

.rank-item.top-2 {
    background: linear-gradient(90deg, #f5f5f5 0%, #fff 100%);
}

.rank-item.top-3 {
    background: linear-gradient(90deg, #fff3e0 0%, #fff 100%);
}

.rank-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    margin-right: 14px;
    background: #f0f0f0;
    color: #666;
}

.rank-item.top-1 .rank-number {
    background: var(--gradient-gold);
    color: #fff;
    font-size: 18px;
}

.rank-item.top-2 .rank-number {
    background: linear-gradient(135deg, #a0a0a0, #c0c0c0);
    color: #fff;
}

.rank-item.top-3 .rank-number {
    background: linear-gradient(135deg, #cd7f32, #daa06d);
    color: #fff;
}

.rank-info {
    flex: 1;
    min-width: 0;
}

.rank-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.rank-score {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-red);
    flex-shrink: 0;
    margin-left: 10px;
}

.rank-score small {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* ===== 管理后台样式 ===== */
.admin-body {
    background: #f5f5f5;
    min-height: 100vh;
}

.admin-sidebar {
    background: var(--gradient-red-dark);
    min-height: 100vh;
    padding: 20px 0;
}

.admin-sidebar .nav-link {
    color: rgba(255,255,255,0.7);
    padding: 12px 24px;
    font-size: 15px;
    border-radius: 0;
    transition: all 0.2s;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.admin-sidebar .nav-link i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.admin-content {
    padding: 24px;
}

.admin-stat-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.admin-stat-card .stat-number {
    font-size: 36px;
    font-weight: 800;
    color: var(--primary-red);
}

.admin-stat-card .stat-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* 表格 */
.admin-table {
    background: #fff;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.admin-table .table {
    margin: 0;
}

.admin-table .table thead th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-muted);
    border-bottom: 2px solid #e9ecef;
    padding: 12px 16px;
}

.admin-table .table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    font-size: 14px;
}

/* ===== 响应式 ===== */
@media (max-width: 576px) {
    .login-header h1 {
        font-size: 22px;
    }

    .login-card {
        padding: 24px 20px;
    }

    .nav-grid {
        grid-template-columns: repeat(10, 1fr);
        gap: 4px;
    }

    .nav-item {
        font-size: 11px;
    }

    .score-number {
        font-size: 56px;
    }

    .question-content {
        font-size: 15px;
    }

    .option-btn {
        padding: 10px 14px;
        font-size: 14px;
    }
}

/* ===== 打印隐藏 ===== */
@media print {
    .quiz-navbar,
    .quiz-nav-panel,
    .btn-submit-quiz {
        display: none !important;
    }
}
