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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #F5F5F5;
    color: #333;
    line-height: 1.6;
}

/* 布局 */
header {
    height: 60px;
    background: #1976D2;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.menu-toggle span {
    width: 24px;
    height: 3px;
    background: white;
    margin: 3px 0;
    border-radius: 2px;
    transition: 0.3s;
}

.container {
    display: flex;
    height: calc(100vh - 100px);
    margin-top: 60px;
}

.sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid #E0E0E0;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #E0E0E0;
    background: #FAFAFA;
}

.sidebar-header h2 {
    font-size: 1rem;
    color: #666;
    font-weight: 500;
}

.content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #F5F5F5;
}

footer {
    height: 40px;
    background: #E0E0E0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #666;
}

/* 导航树样式 */
#dateList {
    padding: 0;
}

.date-group {
    border-bottom: 1px solid #E0E0E0;
}

.date-header {
    padding: 14px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s;
    font-weight: 500;
}

.date-header:hover {
    background: #E3F2FD;
}

.date-header.expanded {
    background: #E3F2FD;
    color: #1976D2;
}

.date-header .arrow {
    font-size: 12px;
    transition: transform 0.2s;
}

.date-header.expanded .arrow {
    transform: rotate(90deg);
}

.content-types {
    display: none;
    background: #FAFAFA;
}

.content-types.show {
    display: block;
}

.content-item {
    padding: 12px 16px 12px 32px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.content-item:hover {
    background: #FFF3E0;
}

.content-item.active {
    background: #FFE0B2;
    font-weight: 600;
    color: #E65100;
}

.content-item .icon {
    font-size: 1.1rem;
}

/* 内容区样式 */
.welcome {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.welcome h2 {
    margin-bottom: 16px;
    color: #333;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.error {
    text-align: center;
    padding: 40px;
    color: #D32F2F;
    background: #FFEBEE;
    border-radius: 8px;
    margin: 20px;
}

.content-header {
    margin-bottom: 20px;
}

.content-header h2 {
    font-size: 1.5rem;
    color: #333;
    padding-bottom: 12px;
    border-bottom: 2px solid #1976D2;
}

.audio-player {
    background: #E8EAF6;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.audio-player audio {
    width: 100%;
    max-width: 600px;
}

.content-section {
    background: white;
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.content-section h3 {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #1976D2;
    color: #1976D2;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.content-text {
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #333;
}

/* 响应式 */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }
    
    .sidebar {
        position: fixed;
        left: -280px;
        top: 60px;
        height: calc(100vh - 60px);
        transition: left 0.3s ease;
        z-index: 999;
        width: 280px;
        box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 998;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .content {
        width: 100%;
        padding: 16px;
    }
    
    .content-section {
        padding: 16px;
    }
}

/* 滚动条样式 */
.sidebar::-webkit-scrollbar,
.content::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track,
.content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar::-webkit-scrollbar-thumb,
.content::-webkit-scrollbar-thumb {
    background: #bdbdbd;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.content::-webkit-scrollbar-thumb:hover {
    background: #9e9e9e;
}

/* 词汇卡片样式 */
.vocabulary-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
    counter-reset: vocab-counter;
}

.vocabulary-item {
    background: white;
    padding: 12px; /* 减小内边距 */
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 1px solid #E0E0E0;
    line-height: 1.0;
    margin-bottom: 12px; /* 减小卡片间距 */
    counter-increment: vocab-counter;
    white-space: normal; /* 防止 HTML 中的换行符被渲染为额外间距 */
}

.speaking-content, .dialogue-section {
    white-space: normal;
}

/* 压缩间距，设置为 0.8em (去除换行符干扰) */
.word-english {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    font-size: 1.3rem;
    color: #1976D2;
    border-bottom: 1px solid #E3F2FD;
    padding-bottom: 4px !important;
    margin-bottom: 0.8em !important;
}

.pronunciation {
    display: block;
    font-size: 1rem;
    color: #757575;
    margin-bottom: 0.8em !important;
}

.explanation-group {
    margin: 0.8em 0 !important;
}

.english-explanation, .chinese-explanation, .memory-tip, .example-sentence {
    display: block;
    margin-bottom: 0.8em !important;
}

.english-explanation strong, 
.chinese-explanation strong, 
.memory-tip strong, 
.example-sentence strong {
    display: block;
    color: #1976D2;
    font-size: 0.85rem;
    margin-bottom: 1px !important;
}

.memory-tip {
    background: #FFFDE7;
    padding: 6px !important; /* 紧凑 Padding */
    border-left: 3px solid #FDD835;
    border-radius: 4px;
}

.example-sentence {
    background: #F5F7F9;
    padding: 6px !important; /* 紧凑 Padding */
    border-left: 3px solid #90CAF9;
    border-radius: 4px;
    font-style: italic;
}

.play-audio-btn {
    background: #1976D2;
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: transform 0.2s;
}

.play-audio-btn:hover {
    transform: scale(1.1);
    background: #1565C0;
}
