/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    margin-bottom: 1rem;
}

.back-btn {
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    padding: 0.5rem 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

header h1 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    flex: 1;
}

/* 导航样式 */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 100;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-controls button {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-controls button:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
}

.nav-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}


#problemCounter {
    font-size: 1.1rem;
    font-weight: 600;
    min-width: 120px;
    text-align: center;
}

.print-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.print-link {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.print-link:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.problem-selector {
    position: relative;
    z-index: 50;
}

.problem-selector select {
    background: rgba(255,255,255,0.9);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.problem-selector select:hover {
    background: white;
    transform: translateY(-1px);
}

/* 主内容区域 */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.problem-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* 题目区域 */
.original-problem, .solution, .related-problems {
    padding: 2rem;
    border-bottom: 1px solid #eee;
}

.original-problem:last-child, .solution:last-child, .related-problems:last-child {
    border-bottom: none;
}

h2 {
    color: #667eea;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid #667eea;
    display: inline-block;
}

/* 题目内容样式 */
.problem-content {
    background: #f8f9ff;
    padding: 1.5rem;
    border-radius: 10px;
    border-left: 5px solid #667eea;
    margin-bottom: 1rem;
}

.problem-text {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    line-height: 1.8;
}

.options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}

.option {
    background: white;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    cursor: pointer;
}

.option:hover {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateY(-2px);
}

.option.correct {
    border-color: #28a745;
    background: #d4edda;
}

.option.incorrect {
    border-color: #dc3545;
    background: #f8d7da;
}

/* 解答样式 */
.solution-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.solution-toggle-btn {
    background: #ffc107;
    border: none;
    color: #333;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(255, 193, 7, 0.3);
}

.solution-toggle-btn:hover {
    background: #ffb300;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.4);
}

.solution-toggle-btn.showing {
    background: #28a745;
    color: white;
    box-shadow: 0 2px 10px rgba(40, 167, 69, 0.3);
}

.solution-toggle-btn.showing:hover {
    background: #218838;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

.solution-content {
    background: #fff8f0;
    padding: 1.5rem;
    border-radius: 10px;
    border-left: 5px solid #ffc107;
    transition: all 0.3s ease;
    overflow: hidden;
}

.solution-content.hidden {
    max-height: 0;
    padding: 0 1.5rem;
    margin: 0;
    opacity: 0;
}

/* 相关题目解答样式 */
.related-solution-header {
    margin: 1rem 0;
    text-align: center;
}

.related-solution-toggle-btn {
    background: #17a2b8;
    border: none;
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(23, 162, 184, 0.3);
}

.related-solution-toggle-btn:hover {
    background: #138496;
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(23, 162, 184, 0.4);
}

.related-solution-toggle-btn.showing {
    background: #28a745;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.related-solution-toggle-btn.showing:hover {
    background: #218838;
    box-shadow: 0 3px 12px rgba(40, 167, 69, 0.4);
}

.solution-step {
    margin-bottom: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.solution-step h4 {
    color: #ffc107;
    margin-bottom: 0.5rem;
}

/* 相似题目标签页 */
.problem-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tab-btn {
    background: #e9ecef;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tab-btn.active {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.tab-btn:hover:not(.active) {
    background: #dee2e6;
    transform: translateY(-1px);
}

/* 相关题目内容 */
.related-problem {
    display: none;
    background: #f0f8ff;
    padding: 1.5rem;
    border-radius: 10px;
    border-left: 5px solid #17a2b8;
}

.related-problem.active {
    display: block;
}

/* 数学公式样式 */
.MathJax {
    font-size: 1.1em !important;
}

/* 图片样式 */
.problem-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin: 1rem 0;
}

/* 页脚样式 */
footer {
    text-align: center;
    padding: 2rem;
    background: #343a40;
    color: white;
    margin-top: 3rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    nav {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-controls {
        order: 2;
    }
    
    .problem-selector {
        order: 1;
    }
    
    main {
        margin: 1rem auto;
        padding: 0 1rem;
    }
    
    .original-problem, .solution, .related-problems {
        padding: 1rem;
    }
    
    .options {
        grid-template-columns: 1fr;
    }
    
    .problem-tabs {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    .nav-controls button {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5a6fd8;
}
