/* 容器布局 (沿用之前的) */
.sdl-container { display: flex; max-width: 1400px; margin: 0 auto; padding: 20px; gap: 30px; }
.sdl-sidebar-left { flex: 0 0 260px; border-right: 1px solid #eee; padding-right: 15px; }
.sdl-content { flex: 1; min-width: 0; }
.sdl-sidebar-right { flex: 0 0 220px; border-left: 1px solid #eee; padding-left: 15px; }
.sdl-sticky-wrapper { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; }

/* --- 新增：左侧手风琴样式 --- */

/* 每一章的容器 */
.chapter-item {
    margin-bottom: 5px;
}

/* 目录标题 (点击区域) */
.chapter-title {
    font-weight: bold;
    cursor: pointer;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.2s;
}

.chapter-title:hover {
    background-color: #f0f0f0;
}

/* 箭头旋转动画 */
/* 1. 隐藏原来的文本图标 */
/* --- SDL 样式 - 图标美化更新 --- */

/* 1. 隐藏原来的文本图标 */
.chapter-title .icon-arrow {
    /* 移除旧样式，准备用新图标 */
    font-size: 0; /* 隐藏文本内容 */
    width: 14px; 
    height: 14px;
    position: relative;
    color: transparent;
}

/* 2. 使用伪元素绘制一个向下的小三角形/尖头 */
.chapter-title .icon-arrow::after {
    content: ''; 
    position: absolute;
    top: 50%;
    left: 50%;
    /* 绘制三角形，代替图片 */
    width: 7px; 
    height: 7px;
    border-right: 2px solid #444; /* 图标颜色 */
    border-bottom: 2px solid #444;
    
    /* 旋转 45 度形成尖头，并调整位置 */
    transform: translate(-50%, -75%) rotate(45deg); 
    transition: transform 0.3s ease; /* 添加动画效果 */
}

/* 3. 折叠/展开时的旋转效果 */
.chapter-item.active .chapter-title .icon-arrow::after {
    /* 当章节展开时，箭头旋转 135 度，指向下方 */
    transform: translate(-50%, -25%) rotate(135deg);
}

/* 4. 标题悬停时图标变色 (可选美化) */
.chapter-title:hover .icon-arrow::after {
    border-color: #0073aa; /* 悬停时图标变蓝 */
}

/* 当处于激活/展开状态时，箭头旋转 */
.chapter-item.active .chapter-title .icon-arrow {
    transform: rotate(180deg);
}

/* 文章列表 (默认隐藏，由PHP内联样式控制初始状态) */
.chapter-articles {
    list-style: none;
    padding: 0;
    margin: 0;
    padding-left: 10px; /* 缩进 */
}

.chapter-articles li {
    margin: 0;
}

.chapter-articles li a {
    display: block;
    padding: 8px 10px;
    text-decoration: none;
    color: #555;
    font-size: 14px;
    border-left: 2px solid transparent;
}

.chapter-articles li a:hover {
    color: #0073aa;
    background-color: #fdfdfd;
}

/* 当前正在阅读的文章高亮 */
.chapter-articles li.current-doc a {
    color: #0073aa;
    font-weight: 600;
    border-left-color: #0073aa;
    background-color: #f0f8ff;
}

/* 书架容器：4列网格 */
.sdl-bookshelf-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 每行4列 */
    gap: 20px;
    padding: 20px 0;
    max-width: 1200px;
    margin: 0 auto;
}

/* 响应式调整 */
@media (max-width: 992px) { .sdl-bookshelf-container { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .sdl-bookshelf-container { grid-template-columns: 1fr; } }

/* 书籍项目链接 */
.sdl-book-item {
    text-decoration: none !important;
    display: block;
}

/* 灰色方框样式 */
.sdl-book-box {
    background-color: #f5f5f5; /* 浅灰色背景 */
    border: 1px solid #e0e0e0; /* 边框线 */
    border-radius: 8px;        /* 圆角 */
    aspect-ratio: 16 / 9;      /* 方框比例，可改为 1/1 变成正方形 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* 悬停效果：稍微加深灰色 */
.sdl-book-item:hover .sdl-book-box {
    background-color: #ececec;
    border-color: #d0d0d0;
    transform: translateY(-3px); /* 悬停微动 */
}

/* 书籍名称：黑色字体 */
.sdl-book-title {
    color: #333333; /* 黑色/深灰色字体 */
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
}
