/* * =========================================
 * gnham.cn 实用工具专属样式 (tools.css)
 * 继承并扩展 style.css
 *
 * 【v3.9 修复】
 * 1. 题库浏览: 为 .correct 样式添加 !important
 * 修复移动端（手机）上绿色背景被覆盖的 Bug。
 * =========================================
 */

/* 1. 选项卡样式 */
.tool-tabs {
    width: 100%;
    border-bottom: 2px solid #444;
    margin-bottom: 2.5rem;
}

.tab-link {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.3s ease, border-bottom 0.3s ease;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}
.tab-link:hover { color: var(--text-color); }
.tab-link.active {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
}

/* 工具内容区 */
.tool-content {
    display: none; /* 默认隐藏 */
    animation: fadeIn 0.5s ease;
}
.tool-content.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 2. 通用表单和按钮 */
.tool-btn {
    background-color: var(--bg-light);
    color: var(--text-color);
    border: 1px solid #555;
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0.5rem 0.25rem;
    vertical-align: middle;
}
.tool-btn:hover { background-color: #3c3c3c; border-color: #777; }
.tool-btn.primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}
.tool-btn.primary:hover { background-color: #00bfff; border-color: #00bfff; }
.tool-btn.danger {
    background-color: #d9534f;
    border-color: #d9534f;
    color: #fff;
}
.tool-btn.danger:hover { background-color: #e06a66; border-color: #e06a66; }
.tool-btn:disabled { opacity: 0.5; cursor: not-allowed; }

select, input[type="text"], input[type="password"] {
    background-color: var(--bg-dark);
    color: var(--text-color);
    border: 1px solid #555;
    padding: 0.75rem;
    font-size: 1rem;
    border-radius: 5px;
    margin: 0.5rem 0.5rem 0.5rem 0;
    width: 100%; /* 确保输入框在弹窗中正确显示 */
    box-sizing: border-box; /* 关键 */
}

.setting-group { margin: 1.5rem 0; }
.setting-group label { font-size: 1.1rem; margin-right: 0.5rem; }

/* 3. 模拟考试 (Exam) 样式 */
#exam-settings, #exam-results {
    background-color: var(--bg-light);
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
}
#exam-progress {
    background-color: var(--bg-light);
    padding: 1.5rem 2rem;
    border-radius: 8px;
}
.exam-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #444;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    gap: 1rem;
}
.exam-header h3 { margin: 0; color: var(--primary-color); }
.exam-timer { font-size: 1.2rem; font-weight: bold; }
.exam-timer.warning { color: #f0ad4e; }
.exam-timer.danger { color: #d9534f; }

/* 题目导航 */
#question-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #3a3a3a;
}
.nav-q-btn {
    width: 35px;
    height: 35px;
    background-color: var(--bg-dark);
    border: 1px solid #555;
    color: var(--text-muted);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.nav-q-btn:hover { background-color: #3c3c3c; }
.nav-q-btn.current {
    border-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: bold;
}
.nav-q-btn.answered {
    background-color: #3a5a70;
    color: #f0f0f0;
    border-color: #3a5a70;
}
.nav-q-btn.answered.current { border-color: var(--primary-color); }

/* 题目卡片 */
.question-card { margin-bottom: 1.5rem; display: none; }
.question-card.active { display: block; }

.question-title {
    font-size: 1.2rem;
    font-weight: 500;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}
.question-title strong { color: var(--primary-color); margin-right: 0.5rem; }
.question-image {
    max-width: 100%;
    height: auto;
    background: #fff;
    border-radius: 5px;
    margin-bottom: 1rem;
    padding: 0.5rem;
    box-sizing: border-box;
}
/* 【新】多选题提示 */
.question-hint {
    font-style: italic;
    color: var(--primary-color);
    font-weight: 500;
    margin-top: -1rem;
    margin-bottom: 1rem;
}

.options-list { list-style: none; padding: 0; }
.option-item {
    padding: 0.75rem 1rem;
    border: 1px solid #555;
    border-radius: 5px;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    /* 【新】为伪元素定位 */
    position: relative; 
    padding-left: 2.5rem;
}
.option-item strong { margin-right: 0.5rem; }

/* 【新】模拟单选按钮 (Radio) */
.option-item::before {
    content: "○";
    font-family: Arial, sans-serif;
    font-size: 1.2rem;
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.option-item:hover { background-color: #3c3c3c; }
.option-item.selected {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    font-weight: bold;
}
.option-item.selected::before {
    content: "●";
    color: #fff;
}

/* 【新】模拟多选按钮 (Checkbox) */
.option-item.multi-choice::before {
    content: "☐";
    font-size: 1.2rem;
}
.option-item.multi-choice.selected::before {
    content: "☑";
    color: #fff;
}


/* 考试控制 */
.exam-controls {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    border-top: 2px solid #444;
    padding-top: 1rem;
}

/* 考试结果 */
#score-summary { 
    font-size: 1.2rem; /* 减小一点字号以容纳更多行 */
    line-height: 1.8;
    margin: 1.5rem 0; 
    text-align: left; /* 左对齐 */
    display: inline-block; /* 配合 text-align: center */
}
#score-summary .score-pass { color: #5cb85c; font-weight: bold; font-size: 1.5rem; }
#score-summary .score-fail { color: #d9534f; font-weight: bold; font-size: 1.5rem; }
#result-details {
    text-align: left;
    margin-top: 2rem;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-dark);
    padding: 1rem;
    border-radius: 5px;
}
.result-question-card {
    border-bottom: 1px solid #444;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}
.result-question-card .options-list { margin-top: 1rem; }
.result-question-card .option-item.correct {
    background-color: #335a33;
    border-color: #5cb85c;
    color: #fff;
}
/* 【新】结果页的样式重置 */
.result-question-card .option-item.correct::before {
    content: "●";
    color: #5cb85c;
}
.result-question-card .option-item.multi-choice.correct::before {
    content: "☑";
    color: #5cb85c;
}

.result-question-card .option-item.wrong {
    background-color: #d9534f;
    border-color: #d9534f;
    color: #fff;
}
.result-question-card .option-item.wrong::before {
    content: "●";
    color: #fff;
}
.result-question-card .option-item.multi-choice.wrong::before {
    content: "☒"; /* 错误的选中 */
    color: #fff;
}
.result-question-card .option-item.selected {
    border-width: 2px;
    border-color: var(--primary-color);
}
.result-question-card .option-item.correct.selected { border-color: #fff; }


/* 4. 地图测距 (Map) 样式 */
#map-tool-container {
    background-color: var(--bg-light);
    padding: 1.5rem 2rem;
    border-radius: 8px;
}
#map-container {
    height: 60vh;
    min-height: 400px;
    width: 100%;
    border-radius: 8px;
    background-color: var(--bg-dark);
    margin-top: 1rem;
    z-index: 5;
}
/* 高德地图Logo在暗黑模式下的样式 */
#map-container .amap-logo {
    filter: invert(1) grayscale(1);
    opacity: 0.7;
}
#map-container .amap-copyright {
    color: #777;
    background: rgba(0,0,0,0.5);
}

#map-info-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
    background-color: var(--bg-dark);
    padding: 1rem;
    border-radius: 5px;
}
#map-info-bar span { font-size: 0.95rem; color: var(--text-muted); }
#map-info-bar span span { color: var(--text-color); font-weight: 500; margin-left: 0.25rem; }
#map-info-bar #distance-result {
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: bold;
}
#clear-map-btn { margin: 0; margin-left: auto; }

/* 5. 收藏按钮样式 */
.question-actions {
    display: block;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #444;
}
.btn-favorite {
    background-color: var(--bg-dark);
    border-color: #555;
}
.btn-favorite .icon-star {
    color: var(--primary-color);
    font-style: normal;
    font-weight: bold;
    margin-right: 0.25rem;
    display: inline-block;
}
.btn-favorite.primary { /* 激活(已收藏)状态 */
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}
.btn-favorite.primary .icon-star { color: #fff; }
.auth-prompt {
    font-size: 0.9rem;
    color: var(--text-muted);
}
.auth-prompt a, .local-login-prompt {
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
}


/* 6. 题库浏览样式 */
#browse-stats {
    color: var(--text-muted);
    margin-left: 1rem;
}
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1.5rem 0;
}
#browse-page-info {
    font-size: 1.1rem;
    font-weight: 500;
}
.browse-question-card {
    background-color: var(--bg-light);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
}
.browse-question-card .options-list { margin-top: 1.5rem; }

/* * 【v3.9 修复】
 * * 修复手机端（移动端）的样式覆盖问题
 * 通过添加 !important 强制
 * * 这就是你需要的修改：
 */
.browse-question-card .option-item.correct {
    background-color: #335a33 !important; /* 【v3.9 修复】使用 !important 强制覆盖移动端样式 */
    border-color: #5cb85c !important;
    color: #fff !important;
}

/* （v3.7 多选样式 - 保持不变） */
.browse-question-card .option-item.correct::before {
    content: "●";
    color: #5cb85c;
}
.browse-question-card .option-item.multi-choice.correct::before {
    content: "☑";
    color: #5cb85c;
}


/* 解析和评论区样式 */
.analysis-box {
    background: #333;
    border: 1px solid #555;
    padding: 0.75rem 1rem;
    margin-top: 1.5rem;
    border-radius: 5px;
    color: var(--text-muted);
    font-style: italic;
}
.analysis-box strong { color: var(--primary-color); font-style: normal; }
.analysis-box:empty { display: none; } /* 如果没有解析则隐藏 */

.comments-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #444;
}
.comments-section h4 {
    color: var(--text-color);
    margin-top: 0;
    margin-bottom: 1rem;
}
.comment-list {
    list-style: none;
    padding: 0;
    margin-bottom: 1.5rem;
}
.comment {
    background: var(--bg-dark);
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    border-left: 3px solid var(--primary-color);
}
.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.comment-author {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 0.9rem;
}
.comment-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
}
.comment-body {
    color: var(--text-color);
    margin-top: 0.5rem;
    line-height: 1.7;
}
.comment-form textarea {
    width: 100%;
    min-height: 80px;
    background-color: var(--bg-dark);
    color: var(--text-color);
    border: 1px solid #555;
    padding: 0.75rem;
    font-size: 1rem;
    border-radius: 5px;
    box-sizing: border-box;
    margin-top: 0.5rem;
}
.comment-form .tool-btn {
    margin-top: 0.5rem;
}
.comments-section .auth-prompt {
    background: var(--bg-dark);
    padding: 1rem;
    border-radius: 5px;
    text-align: center;
}

/* 【新】管理员按钮样式 */
.admin-controls {
    display: flex;
    gap: 0.5rem;
}
.admin-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-decoration: underline;
    cursor: pointer;
    padding: 0.2rem;
}
.admin-btn.delete-btn:hover { color: #d9534f; }
.admin-btn.ban-btn:hover { color: #f0ad4e; }
.comment.banned-user-comment .comment-author {
    text-decoration: line-through;
    color: var(--text-muted);
}


/* 7. 登录弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-content {
    background: var(--bg-light);
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}
.modal-close:hover { color: var(--text-color); }

.auth-form {
    display: flex;
    flex-direction: column;
}
.auth-form label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 1rem;
    margin-bottom: 0.25rem;
}
.auth-form .tool-btn {
    margin-top: 1.5rem;
}
.auth-toggle {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 1.5rem;
}
.auth-toggle a {
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
}
.form-error {
    color: #d9534f;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    display: none; /* 默认隐藏 */
}


/* 8. 【新】成绩和排行榜样式 */
.history-container {
    background-color: var(--bg-light);
    padding: 1.5rem 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}
.history-container h3 {
    margin-top: 0;
    color: var(--primary-color);
    border-bottom: 1px solid #444;
    padding-bottom: 0.5rem;
}
.leaderboard-container {
    background-color: #222; /* 排行榜用更深的背景 */
}
.table-container {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #444;
    border-radius: 5px;
}
.history-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-color);
}
.history-table th,
.history-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #444;
}
.history-table th {
    background-color: var(--bg-dark);
    position: sticky;
    top: 0;
}
.history-table tbody tr:hover {
    background-color: #3a3a3a;
}
.history-table td:nth-child(1) { min-width: 100px; } /* 排名/类型 */
.history-table td:nth-child(2) { min-width: 120px; } /* 呼号/成绩 */
.history-table td:nth-child(3) { min-width: 80px; } /* 用时 */
.history-table td:nth-child(4) { min-width: 80px; } /* 是否通过 */

.history-table .pass { color: #5cb85c; }
.history-table .fail { color: #d9534f; }
.history-table .rank-1 { color: #ffd700; font-weight: bold; } /* 金 */
.history-table .rank-2 { color: #c0c0c0; font-weight: bold; } /* 银 */
.history-table .rank-3 { color: #cd7f32; font-weight: bold; } /* 铜 */