/* 全局样式重置 */
* {
    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: #f5f7fa;
    overflow-x: hidden;
}

/* 顶部标题区域 */
.site-header {
    background-color: #1f4e79;
    color: white;
    padding: 1rem 0;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.site-header h1 {
    flex: 1;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 1px;
}

/* 顶部按钮区域 */
.header-buttons {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 10px;
}

/* 顶部按钮样式 */
.header-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.header-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.header-btn .btn-icon {
    font-size: 1.1rem;
}

/* 在小屏幕上调整按钮样式 */
@media (max-width: 768px) {
    .site-header {
        padding: 0.8rem 0;
    }
    
    .site-header h1 {
        font-size: 1.5rem;
    }
    
    .header-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .header-btn .btn-text {
        display: none;
    }
    
    .header-btn .btn-icon {
        font-size: 1.2rem;
    }
}

.site-header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 1px;
}

/* 主容器布局 */
.main-container {
    display: flex;
    height: calc(100vh - 69px); /* 减去头部高度 */
    background-color: #f8f9fa;
    overflow: hidden;
}

/* 左侧导航栏 */
.sidebar {
    width: 22%;
    min-width: 200px;
    max-width: 280px;
    background-color: #ffffff;
    border-right: 1px solid #e1e8ed;
    padding: 20px 0;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
    position: relative;
    height: 100%;
}

.nav-list {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
}

/* 分组样式 */
.nav-group {
    margin-bottom: 8px;
}

.group-header {
    display: flex;
    align-items: center;
    padding: 12px 1.5rem;
    color: #333;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    position: relative;
}

.group-header:hover {
    background-color: #f0f7ff;
    color: #1f4e79;
}

.group-header::after {
    content: '▼';
    font-size: 10px;
    margin-left: auto;
    transition: transform 0.3s ease;
}

.group-header.collapsed::after {
    transform: rotate(-90deg);
}

.group-items {
    list-style: none;
    padding: 0;
    margin: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
    max-height: 500px;
    opacity: 1;
}

.group-items.collapsed {
    max-height: 0;
    opacity: 0;
}

/* 导航项样式 */
.nav-item {    margin: 0;    padding: 0;}

/* 一级目录样式 */
.nav-item.primary-nav a {
    font-weight: 600;
    font-size: 0.98rem;
    padding: 12px 1.5rem;
    background-color: #f0f7ff;
    border-left: 3px solid #1f4e79;
}

.nav-item.primary-nav a:hover {
    background-color: #e1f0ff;
    color: #1f4e79;
    border-left-color: #1f4e79;
}

.nav-item a {
    display: block;
    padding: 10px 1.5rem 10px 3rem;
    color: #333;
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-item a:hover {
    background-color: #f0f7ff;
    color: #1f4e79;
    border-left-color: #1f4e79;
}

.nav-item.active a {
    background-color: #e1f0ff;
    color: #1f4e79;
    font-weight: 600;
    border-left-color: #1f4e79;
}

/* 右侧内容区域 */
.content-area {
    flex: 1;
    background-color: #f8f9fa;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* iframe容器 */
.iframe-container {
    position: relative;
    width: 100%;
    flex: 1;
    background-color: #ffffff;
    border-radius: 6px;
    overflow: hidden;
    margin: 20px;
}

/* iframe样式 */
#content-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    overflow-y: auto;
    overflow-x: auto;
}

/* 加载状态指示器 */
.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1f4e79;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* 错误消息 */
.error-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: #d32f2f;
}

.reload-btn {
    background-color: #1f4e79;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-top: 1rem;
    transition: background-color 0.3s ease;
}

.reload-btn:hover {
    background-color: #193d60;
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 200;
    background-color: #1f4e79;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
    display: none;
}

.menu-icon {
    display: block;
    width: 24px;
    height: 2px;
    background-color: white;
    position: relative;
}

.menu-icon:before,
.menu-icon:after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background-color: white;
    transition: all 0.3s ease;
}

/* 移动端菜单图标激活状态 */
.menu-icon.active:before {
    transform: rotate(45deg);
    top: 0;
}

.menu-icon.active:after {
    transform: rotate(-45deg);
    top: 0;
}

.menu-icon:before {
    top: -8px;
}

.menu-icon:after {
    top: 8px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .site-header h1 {
        font-size: 1.5rem;
    }

    .sidebar {
        position: fixed;
        left: -300px; /* 隐藏侧边栏，偏移量等于最大宽度 */
        top: 69px;
        width: 80%;
        max-width: 300px;
        height: calc(100vh - 69px);
        z-index: 150;
        transition: transform 0.3s ease;
    }

    .sidebar.active {
        transform: translateX(300px); /* 将侧边栏移入视图 */
    }

    .mobile-menu-btn {
        display: block;
    }

    .loading-indicator, .error-message {
        width: 90%;
        max-width: 300px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 25%;
        min-width: 180px;
    }

    .nav-item a {
        padding: 10px 1rem;
        font-size: 0.9rem;
    }
}

/* 确保iframe在所有设备上正确显示 */
#content-iframe {
    min-height: calc(100vh - 69px);
}

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

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

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

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}