/* PPTX展示系统样式 */
.container,
.container-fluid,
.body-content {
    max-width: 98% !important;
    width: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.pptx-viewer-container {
    display: flex;
    /* 调整高度，如果是为了突破母版，可以用下面的固定视口高度并配合绝对定位 */
    height: 85vh; /* 或 calc(100vh - 80px) 根据您的导航栏实际高度调整 */
    min-height: 600px;
    background: #f5f5f5;
    margin: 0 -15px; /* 让其在两边突破 Bootstrap/原母版的默认 padding */
}

/* 左侧边栏 */
.pptx-sidebar {
    width: 320px;
    background: #fff;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid #ddd;
    background: #fafafa;
}

.sidebar-header h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
}

.sidebar-header h3 i {
    margin-right: 8px;
    color: #0078d4;
}

.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 8px 30px 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.search-box i {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

/* 树状容器 */
.tree-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* 树状节点 */
.tree-node {
    margin: 2px 0;
}

.tree-node-content {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    gap: 6px;
}

.tree-node-content:hover {
    background: #e8f4fc;
}

.tree-node-content.active {
    background: #0078d4;
    color: white;
}

.tree-node-content i {
    color: #666;
    font-size: 14px;
    width: 18px;
    text-align: center;
}

.tree-node-content.active i {
    color: white;
}

.tree-toggle {
    transition: transform 0.2s;
    font-size: 12px;
}

.tree-toggle.expanded {
    transform: rotate(90deg);
}

.tree-label {
    flex: 1;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.count {
    font-size: 11px;
    color: #999;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 10px;
}

.tree-children {
    margin-left: 15px;
    padding-left: 10px;
    border-left: 1px solid #e0e0e0;
    display: none;
}

.tree-children.expanded {
    display: block;
}

/* 章节样式 */
.tree-node.chapter > .tree-node-content {
    font-weight: bold;
    color: #333;
}

.tree-node.chapter > .tree-node-content i.fa-road,
.tree-node.chapter > .tree-node-content i.fa-bridge,
.tree-node.chapter > .tree-node-content i.fa-dungeon,
.tree-node.chapter > .tree-node-content i.fa-water,
.tree-node.chapter > .tree-node-content i.fa-city,
.tree-node.chapter > .tree-node-content i.fa-clipboard-list {
    color: #0078d4;
}

/* 课件样式 */
.tree-node.lecture .tree-label {
    font-size: 12px;
}

/* 右侧内容区 */
.pptx-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

/* 头部信息 */
.pptx-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.pptx-header h2 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.page-info {
    color: #666;
    font-size: 14px;
}

/* 幻灯片展示 */
.slide-viewer {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.placeholder {
    text-align: center;
    color: #999;
}

.placeholder i {
    font-size: 64px;
    margin-bottom: 15px;
    display: block;
}

/* 幻灯片容器 */
/* 修改部分 2: 幻灯片容器与内容显示排版 */
.slide-container {
    background: white;
    width: 100%;
    /* 将最大宽度的限制从 960px 放大，让图片有足够的空间 */
    max-width: 1200px;
    /* 高宽比使用自动适应或严格16:9，不加这行会导致高度崩塌 */
    aspect-ratio: 16/9;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    overflow: hidden;
}

.slide-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* 移除掉 padding，因为我们在解析 OpenXML 的 X,Y 坐标时已经是相对于画布左上角(0,0)计算的绝对定位了 */
    padding: 0;
}
/* 修改部分 3: 新增图片适配，保证长宽比完整显示不受父级压缩影响 */
.slide-shape-image {
    display: flex;
    justify-content: center;
    align-items: center;
}

    .slide-shape-image img {
        /* 这是修正图片显示长条截断的核心 */
        max-width: 100%;
        max-height: 100%;
        object-fit: contain !important;
    }
.slide-title {
    font-size: 32px;
    font-weight: bold;
    color: #333;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 3px solid #0078d4;
}

.slide-body {
    font-size: 18px;
    line-height: 1.8;
    color: #444;
}

.slide-body ul {
    margin: 0;
    padding-left: 30px;
}

.slide-body li {
    margin: 10px 0;
}

/* 幻灯片形状（按PPTX原始位置） */
.slide-shape {
    position: absolute;
    display: flex;
    align-items: center;
    /* !重要修改! 将原本的 padding: 10px; 改为 0，防止内边距挤压图片导致底部白边/截断 */
    padding: 0px;
    overflow: hidden;
}

.slide-shape-title {
    font-size: 28px;
    font-weight: bold;
    color: #333;
}

.slide-shape-body {
    font-size: 16px;
    color: #444;
    line-height: 1.6;
}

/* 幻灯片导航 */
/* 修改部分 4: 底部导航栏与数字页码显示 */
.slide-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    /* 调整一下 padding 使它不被挤掉 */
    padding: 10px 0;
    border-top: 1px solid #ddd;
    /* 预留高度防止数字被切除 */
    min-height: 60px;
}

.nav-btn {
    background: white;
    border: 1px solid #ddd;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: #0078d4;
    color: white;
    border-color: #0078d4;
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: white;
    color: #999;
}

.page-indicator {
    font-size: 16px;
    color: #333;
    font-weight: 500;
    padding: 0 10px;
    /* 确保其为行内块且垂直居中 */
    display: inline-flex;
    align-items: center;
}

/* 缩略图弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 900px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
}

.close-btn:hover {
    color: #333;
}

.thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    padding: 20px;
    overflow-y: auto;
    max-height: 60vh;
}

.thumb-item {
    aspect-ratio: 16/9;
    background: #f0f0f0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
    transition: all 0.2s;
}

.thumb-item:hover {
    border-color: #0078d4;
}

.thumb-item.active {
    border-color: #0078d4;
    background: #e8f4fc;
}

.thumb-number {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
}

/* 加载中 */
.loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loading.active {
    display: flex;
}

.loading i {
    font-size: 48px;
    color: #0078d4;
    margin-bottom: 15px;
}

/* 响应式 */
@media (max-width: 768px) {
    .pptx-sidebar {
        width: 260px;
    }
    
    .slide-container {
        max-width: 100%;
    }
    
    .slide-content {
        padding: 20px 30px;
    }
    
    .slide-title {
        font-size: 24px;
    }
    
    .slide-body {
        font-size: 16px;
    }
}
