/* 主样式文件 */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --light-bg: #f8f9fa;
    --dark-text: #2c3e50;
    --muted-text: #6c757d;
    --border-color: #dee2e6;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

/* 全局样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-text);
    background-color: #f4f6f9;
}

.container {
    max-width: 1200px;
}

/* 视图容器 */
.view-container {
    min-height: 60vh;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 导航栏样式 */
.navbar-brand {
    font-weight: 600;
    font-size: 1.3rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    transform: translateY(-2px);
}

/* 卡片样式增强 */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 6px var(--shadow-color);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px var(--shadow-color);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    font-weight: 600;
}

/* 按钮样式增强 */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.6rem 1.5rem;
    transition: all 0.3s ease;
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-color);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #2ecc71);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #c0392b);
}

.btn-outline-secondary {
    border: 2px solid #ff6b35;
    color: #ff6b35;
    background: rgba(255, 107, 53, 0.1);
    font-weight: 600;
}

.btn-outline-secondary:hover {
    background: #ff6b35;
    color: white;
    border-color: #ff6b35;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #ff6b35, #e55a2b);
    border: none;
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #e55a2b, #cc4e24);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.5);
}

.btn-lg {
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
}

/* 表单样式 */
.form-control, .form-select {
    border-radius: 8px;
    border: 2px solid var(--border-color);
    padding: 0.6rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

/* 进度条样式 */
.progress {
    height: 8px;
    border-radius: 8px;
    background-color: var(--light-bg);
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(135deg, var(--secondary-color), var(--success-color));
    transition: width 0.3s ease;
}

/* 问题容器样式 */
.question-item {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--secondary-color);
    box-shadow: 0 2px 4px var(--shadow-color);
}

.question-number {
    display: inline-block;
    background: var(--secondary-color);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    font-weight: 600;
    margin-right: 1rem;
}

/* 选项样式 */
.option-group {
    margin: 1rem 0;
}

.option-item {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.option-item:hover {
    border-color: var(--secondary-color);
    background-color: rgba(52, 152, 219, 0.05);
}

.option-item.selected {
    border-color: var(--secondary-color);
    background-color: rgba(52, 152, 219, 0.1);
}

.option-item.correct {
    border-color: var(--success-color);
    background-color: rgba(39, 174, 96, 0.1);
}

.option-item.incorrect {
    border-color: var(--danger-color);
    background-color: rgba(231, 76, 60, 0.1);
}

.option-radio {
    margin-right: 0.8rem;
}

/* 反馈信息样式 */
.feedback {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    font-weight: 500;
}

.feedback-correct {
    background-color: rgba(39, 174, 96, 0.1);
    border: 2px solid var(--success-color);
    color: var(--success-color);
}

.feedback-incorrect {
    background-color: rgba(231, 76, 60, 0.1);
    border: 2px solid var(--danger-color);
    color: var(--danger-color);
}

.feedback-info {
    background-color: rgba(52, 152, 219, 0.1);
    border: 2px solid var(--secondary-color);
    color: var(--secondary-color);
}

/* 年份选择按钮 */
.year-button {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--dark-text);
    display: block;
    margin-bottom: 1rem;
}

.year-button:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    transform: translateY(-5px);
    box-shadow: 0 8px 15px var(--shadow-color);
    text-decoration: none;
}

.year-title {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.year-info {
    color: var(--muted-text);
    font-size: 0.9rem;
}

/* 加载状态 */
.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Toast 通知 */
.toast {
    border-radius: 8px;
    border: none;
    box-shadow: 0 4px 6px var(--shadow-color);
}

/* 数据摘要样式 */
.data-item {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-left: 4px solid var(--secondary-color);
    display: flex;
    justify-content: between;
    align-items: center;
}

.data-year {
    font-weight: 600;
    color: var(--primary-color);
}

.data-count {
    color: var(--muted-text);
    font-size: 0.9rem;
}

/* 分数显示 */
.score-display {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--success-color);
}

/* 文章完成界面 */
.completion-card {
    text-align: center;
    padding: 2rem;
}

.completion-score {
    font-size: 3rem;
    font-weight: 700;
    color: var(--success-color);
    margin: 1rem 0;
}

.completion-percentage {
    font-size: 1.5rem;
    color: var(--muted-text);
    margin-bottom: 2rem;
}

/* 工具提示样式 */
.tooltip-inner {
    background-color: var(--primary-color);
    border-radius: 6px;
}

/* 错误状态 */
.is-invalid {
    border-color: var(--danger-color) !important;
    box-shadow: 0 0 0 0.2rem rgba(231, 76, 60, 0.25) !important;
}

/* 成功状态 */
.is-valid {
    border-color: var(--success-color) !important;
    box-shadow: 0 0 0 0.2rem rgba(39, 174, 96, 0.25) !important;
}

/* 用户体验增强 */

/* 页面切换动画 */
.view-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.view-enter {
    opacity: 0;
    transform: translateX(30px);
}

.view-enter-active {
    opacity: 1;
    transform: translateX(0);
}

.view-exit {
    opacity: 1;
    transform: translateX(0);
}

.view-exit-active {
    opacity: 0;
    transform: translateX(-30px);
}

/* 问题切换动画 */
.question-item {
    transition: all 0.3s ease;
    opacity: 0;
    animation: questionSlideIn 0.5s ease forwards;
}

@keyframes questionSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 选项点击反馈 */
.option-item {
    position: relative;
    overflow: hidden;
}

.option-item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(52, 152, 219, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.option-item:active::before {
    width: 300px;
    height: 300px;
}

/* 按钮点击反馈 */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.btn:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 1;
    }
    20% {
        transform: scale(25, 25);
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: scale(40, 40);
    }
}

/* 加载状态增强 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 进度条脉冲动画 */
.progress-bar.animated {
    background-size: 40px 40px;
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    0% {
        background-position: 40px 0;
    }
    100% {
        background-position: 0 0;
    }
}

/* Toast通知动画 */
.toast.show {
    animation: toastSlideIn 0.3s ease;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 悬停提示 */
.tooltip-hover {
    position: relative;
    cursor: help;
}

.tooltip-hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem;
    background: var(--dark-text);
    color: white;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
}

.tooltip-hover:hover::after {
    opacity: 1;
    visibility: visible;
}

/* 焦点管理 */
.focus-visible {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

/* 无障碍增强 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid var(--dark-text);
    }
    
    .option-item {
        border-width: 2px;
    }
    
    .btn {
        border: 2px solid;
    }
}

/* 用户选择增强 */
.user-select-none {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* 拖拽防止 */
.no-drag {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

/* 键盘选择反馈 */
.keyboard-selected {
    animation: keyboardFeedback 0.2s ease;
    transform: scale(1.02);
}

@keyframes keyboardFeedback {
    0% {
        background-color: rgba(52, 152, 219, 0.2);
        transform: scale(1);
    }
    50% {
        background-color: rgba(52, 152, 219, 0.4);
        transform: scale(1.02);
    }
    100% {
        background-color: rgba(52, 152, 219, 0.2);
        transform: scale(1.02);
    }
}

/* 选项可访问性增强 */
.option-item[tabindex] {
    cursor: pointer;
}

.option-item:focus {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
    z-index: 1;
}

.year-button:focus {
    outline: 2px solid var(--secondary-color);
    outline-offset: 4px;
}

/* 按钮可访问性 */
.btn:focus-visible {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

/* 跳过链接（无障碍） */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    border-radius: 4px;
    text-decoration: none;
    transition: top 0.3s;
    z-index: 10000;
}

.skip-link:focus {
    top: 6px;
    color: white;
}

/* 屏幕阅读器专用 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 模态框样式增强 */
.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 12px 12px;
}

/* 状态指示器 */
.status-indicator {
    position: relative;
    display: inline-block;
}

.status-indicator::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 2s infinite;
}

.status-indicator.error::after {
    background: var(--danger-color);
}

.status-indicator.warning::after {
    background: var(--warning-color);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(39, 174, 96, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(39, 174, 96, 0);
    }
}

/* 题目四列布局样式 */
.question-grid {
    margin-top: 1rem;
}

.question-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    background: white;
    height: 100%;
    transition: all 0.3s ease;
}

.question-card:hover {
    box-shadow: 0 4px 8px var(--shadow-color);
    transform: translateY(-2px);
}

.question-card .question-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.question-card .question-number {
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.question-card .question-score {
    background: var(--secondary-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
}

/* 选项竖直排列样式 */
.option-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.option-item {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.5rem;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.option-item:hover {
    border-color: var(--secondary-color);
    background-color: rgba(52, 152, 219, 0.05);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.option-item.selected {
    border-color: var(--primary-color);
    background-color: rgba(52, 152, 219, 0.1);
}

.option-item.correct {
    border-color: var(--success-color);
    background-color: rgba(39, 174, 96, 0.1);
}

.option-item.incorrect {
    border-color: var(--danger-color);
    background-color: rgba(231, 76, 60, 0.1);
}

.option-item[disabled] {
    cursor: not-allowed;
    opacity: 0.6;
}

.option-radio {
    display: block;
    width: 20px;
    height: 20px;
    margin-right: 8px;
    appearance: none;
    border: 2px solid #ddd;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.option-radio:checked {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.option-radio:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

.option-radio.correct {
    border-color: var(--success-color) !important;
    background: var(--success-color) !important;
}

.option-radio.incorrect {
    border-color: var(--danger-color) !important;
    background: white !important;
}

.option-radio.incorrect::after {
    background: var(--danger-color) !important;
}

.option-label {
    font-weight: 500;
    margin-left: 0;
    color: #333;
    font-size: 0.95rem;
}

/* 反馈区域样式优化 */
.feedback-container {
    margin-top: 0.75rem;
    padding: 0.5rem;
    border-radius: 6px;
    font-weight: 500;
}

.feedback-correct {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border: 2px solid #27ae60;
    box-shadow: 0 2px 4px rgba(46, 204, 113, 0.3);
}

.feedback-incorrect {
    background: linear-gradient(135deg, #e74c3c, #ec7063);
    color: white;
    border: 2px solid #e74c3c;
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.3);
}

.feedback-attempts {
    background: linear-gradient(135deg, #f39c12, #f1c40f);
    color: white;
    border: 2px solid #f39c12;
    box-shadow: 0 2px 4px rgba(243, 156, 18, 0.3);
}

.feedback-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.feedback-icon {
    font-size: 1.1rem;
}

/* 响应式设计 */
@media (max-width: 992px) {
    .question-grid .col-lg-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (max-width: 768px) {
    .question-grid .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .question-card {
        margin-bottom: 1rem;
    }
    
    .feedback-text {
        font-size: 0.85rem;
    }
}