/* 故事阅读器专用样式 */

/* 阅读器主布局 */
.reader-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

@media (max-width: 992px) {
    .reader-container {
        grid-template-columns: 1fr;
    }
}

/* 侧边栏 */
.story-sidebar {
    background-color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
}

@media (max-width: 992px) {
    .sidebar-toggle {
        display: block;
    }
    
    .story-sidebar.collapsed {
        display: none;
    }
}

/* 故事列表 */
.story-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 1.5rem;
}

.story-list-item {
    display: block;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.story-list-item:hover {
    background-color: var(--bg-light);
    border-left-color: var(--primary-light);
}

.story-list-item.active {
    background-color: #f0f7ff;
    border-left-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 500;
}

.story-item-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.story-item-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    gap: 0.75rem;
}

/* 系列信息 */
.series-info {
    padding: 1rem;
    background-color: var(--bg-light);
    border-radius: var(--radius-md);
}

.series-info h4 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.series-stats {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
    font-size: 0.875rem;
}

.series-stats span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* 故事主内容 */
.story-main {
    background-color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
}

/* 故事头部 */
.story-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.story-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.story-series-badge {
    background-color: #f0f7ff;
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
}

.story-level {
    background-color: #e8f5e9;
    color: #2e7d32;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

.story-duration,
.story-words {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.story-header h1 {
    font-size: 2.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.story-description {
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
}

/* 学习工具条 */
.story-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    padding: 1rem;
    background-color: var(--bg-light);
    border-radius: var(--radius-md);
}

.tool-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.tool-btn:hover {
    background-color: #f8f9fa;
    border-color: var(--primary-light);
}

.tool-btn.active {
    background-color: #f0f7ff;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.progress-indicator {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.progress-bar {
    width: 120px;
    height: 6px;
    background-color: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
}

/* 故事内容 */
.story-content {
    font-size: 1.125rem;
    line-height: 1.8;
    margin-bottom: 3rem;
}

.story-content p {
    margin-bottom: 1.5rem;
}

/* 单词高亮样式 */
.word-highlight {
    color: var(--primary-color);
    background-color: #f0f7ff;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    border-bottom: 2px solid var(--primary-light);
    font-weight: 600;
    transition: all 0.2s;
    position: relative;
}

.word-highlight:hover {
    background-color: #e0f0ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(26, 95, 180, 0.1);
}

.word-highlight::after {
    content: "?";
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 0.75rem;
    background-color: var(--primary-color);
    color: white;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.word-highlight:hover::after {
    opacity: 1;
}

/* 单词汇总 */
.words-summary {
    margin: 3rem 0;
    padding: 2rem;
    background-color: var(--bg-light);
    border-radius: var(--radius-lg);
}

.words-summary h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.words-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.word-card {
    background-color: white;
    border-radius: var(--radius-md);
    padding: 1rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    cursor: pointer;
}

.word-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.word-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.word-card-word {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.word-card-pronunciation {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
}

.word-card-meaning {
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.4;
}

/* 测试区 */
.quiz-section {
    margin: 3rem 0;
    padding: 2rem;
    background-color: var(--bg-light);
    border-radius: var(--radius-lg);
}

.quiz-instruction {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.quiz-container {
    margin-bottom: 2rem;
}

/* 故事导航 */
.story-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 3rem 0;
    padding: 1.5rem;
    background-color: var(--bg-light);
    border-radius: var(--radius-lg);
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
    flex: 1;
    max-width: 300px;
}

.nav-btn:hover {
    background-color: #f8f9fa;
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.prev-btn {
    text-align: left;
}

.next-btn {
    text-align: right;
}

.series-btn {
    justify-content: center;
    max-width: 200px;
}

.nav-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.nav-title {
    font-weight: 500;
    color: var(--primary-color);
}

/* 阅读器CTA */
.reader-cta {
    margin-top: 3rem;
    padding: 2rem;
}

.reader-cta .cta-card {
    max-width: 100%;
}

/* 加载指示器 */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.loading-indicator i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .story-main {
        padding: 1.5rem;
    }
    
    .story-header h1 {
        font-size: 1.75rem;
    }
    
    .story-navigation {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-btn {
        max-width: 100%;
        width: 100%;
    }
    
    .words-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .story-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .progress-indicator {
        margin-left: 0;
        width: 100%;
    }
}