/* BI Animal Health SFE Quiz System Styles */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Page Management */
.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Header Styles */
.header {
    text-align: center;
    padding: 30px 0;
}

.logo {
    font-size: 64px;
    margin-bottom: 10px;
}

.trophy {
    font-size: 80px;
    margin-bottom: 10px;
}

.trophy-large {
    font-size: 100px;
    margin-bottom: 10px;
}

h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
}

.subtitle {
    color: var(--text-light);
    font-size: 16px;
}

/* Card Styles */
.card {
    background: var(--card);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 16px;
}

.session-badge {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    text-align: center;
    font-weight: 600;
    margin-bottom: 24px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text);
}

input[type="text"],
select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.2s;
    background: white;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Button Styles */
.btn {
    display: block;
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

/* Progress Bar */
.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    margin-bottom: 20px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

/* Quiz Page */
.quiz-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 14px;
}

.type-badge {
    background: var(--bg);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
}

.type-badge.multi {
    background: var(--warning);
    color: white;
}

.question {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.6;
    margin-bottom: 24px;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--bg);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.option:hover {
    border-color: var(--primary);
    background: white;
}

.option.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.option input {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.option-text {
    font-size: 15px;
}

.nav-buttons {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.nav-buttons .btn {
    flex: 1;
}

/* Result Page */
.result-header {
    text-align: center;
    padding: 20px 0;
}

.score-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    margin-bottom: 20px;
}

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

.score-value {
    font-size: 64px;
    font-weight: 700;
    margin-bottom: 4px;
}

.score-total {
    font-size: 14px;
    opacity: 0.9;
}

.rank-info {
    text-align: center;
    padding: 16px;
    background: var(--bg);
    border-radius: 12px;
    margin-bottom: 20px;
}

.rank-info p {
    margin: 8px 0;
}

.highlight {
    color: var(--primary);
    font-weight: 700;
    font-size: 20px;
}

.top3-card {
    background: var(--card);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.top3-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin: 8px 0;
    background: var(--bg);
    border-radius: 10px;
}

.top3-rank {
    font-size: 24px;
    margin-right: 12px;
}

.top3-name {
    flex: 1;
    text-align: left;
    font-weight: 600;
}

.top3-score {
    font-weight: 700;
    color: var(--primary);
}

.top3-item.current-user {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(34, 197, 94, 0.1));
    border: 2px solid var(--primary);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Leaderboard Page */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.leaderboard-table th {
    font-weight: 600;
    color: var(--text-light);
    font-size: 12px;
    text-transform: uppercase;
}

.leaderboard-table tr:last-child td {
    border-bottom: none;
}

.leaderboard-table .rank {
    font-weight: 700;
    font-size: 16px;
}

.leaderboard-table .rank.top3 {
    color: var(--warning);
}

.my-rank {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(34, 197, 94, 0.05));
    border: 2px solid var(--primary);
}

.my-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    text-align: center;
    margin-bottom: 16px;
}

.my-stats p {
    margin: 0;
    font-size: 13px;
}

.my-sessions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.session-score {
    background: var(--bg);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
}

.session-score.completed {
    background: var(--success);
    color: white;
}

/* Responsive */
@media (max-width: 400px) {
    .container {
        padding: 16px;
    }
    
    .card {
        padding: 20px;
    }
    
    h1 {
        font-size: 20px;
    }
    
    .score-value {
        font-size: 48px;
    }
}

/* 错题回顾样式 */
.review-container {
    margin-bottom: 20px;
}

.review-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.review-number {
    font-weight: 700;
    color: var(--danger);
    font-size: 16px;
}

.review-type {
    background: var(--bg);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-light);
}

.review-question {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.review-options {
    margin-bottom: 16px;
}

.review-option {
    padding: 10px 12px;
    margin: 6px 0;
    border-radius: 8px;
    font-size: 14px;
}

.review-option.correct-answer {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.review-option.wrong-answer {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.review-explanation {
    background: var(--bg);
    padding: 16px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    border-left: 4px solid var(--primary);
}

.review-explanation strong {
    color: var(--primary);
}

/* 管理员入口样式 */
.admin-link {
    text-align: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 13px;
    cursor: pointer;
    padding: 8px;
}

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

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

.modal-body {
    padding: 20px;
}

.modal-body input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    margin: 12px 0;
    font-size: 16px;
}

.warning-text {
    color: var(--danger);
    font-size: 13px;
    margin-top: 12px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.modal-footer .btn {
    flex: 1;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* 信息卡片样式 */
.info-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.info-card h3 {
    margin-bottom: 8px;
    font-size: 16px;
}

.info-card p {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 12px;
}

.link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

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

/* 得分详情样式 */
.score-detail {
    margin-top: 8px;
    font-size: 16px;
    opacity: 0.9;
}
