/* 重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", sans-serif;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --text-color: #2c3e50;
    --text-light: #7f8c8d;
    --bg-color: #f8f9fa;
    --border-color: #e1e8ed;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
    min-height: 100vh;
}

/* 移动端顶部栏 */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--primary-color);
    color: white;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: var(--shadow);
    justify-content: space-between;
}

.mobile-menu-toggle {
    width: 24px;
    height: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
}

.mobile-menu-toggle span {
    display: block;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-title {
    font-size: 18px;
    font-weight: 600;
}

.mobile-user {
    font-size: 14px;
    opacity: 0.8;
}

/* 容器布局 */
.container {
    display: flex;
    min-height: 100vh;
    transition: all 0.3s ease;
    width: 100%;
}

/* 左侧导航栏样式 */
.sidebar {
    width: 280px;
    background: var(--primary-color);
    color: white;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    z-index: 999;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    position: relative;
}

.logo {
    padding: 30px 25px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: relative;
    background: rgba(0,0,0,0.1);
}

.logo h1 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 1px;
    margin: 0;
}

.close-sidebar {
    display: none;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 28px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    line-height: 1;
}

.close-sidebar:hover {
    opacity: 1;
}

.nav-menu {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* 一级菜单项 */
.nav-item {
    padding: 18px 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    border-left: 4px solid transparent;
    margin: 5px 0;
    position: relative;
    min-height: 50px;
    box-sizing: border-box;
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    border-left-color: var(--secondary-color);
}

.nav-item.active {
    background: rgba(52, 152, 219, 0.2);
    border-left-color: var(--secondary-color);
}

.nav-icon {
    font-size: 20px;
    margin-right: 15px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-text {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 二级菜单相关样式 - 修复版本 */
.has-submenu {
    position: relative;
    padding-right: 40px;
}

.submenu-toggle {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    transition: transform 0.3s ease;
    opacity: 0.7;
    line-height: 1;
}

/* 初始状态：箭头向右（收起） */
.nav-item.has-submenu .submenu-toggle {
    transform: translateY(-50%) rotate(0deg);
}

/* 展开状态：箭头向下 */
.nav-item.has-submenu.expanded .submenu-toggle {
    transform: translateY(-50%) rotate(90deg);
}

/* 二级菜单容器 - 修复显示问题 */
.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(0, 0, 0, 0.1);
    /* 移除会隐藏内容的属性 */
    opacity: 1;
    visibility: visible;
    display: block;
}

/* 二级菜单展开状态 */
.nav-item.expanded .submenu {
    max-height: 500px;
}

/* 二级菜单项样式 - 确保可见 */
.nav-subitem {
    padding: 12px 25px 12px 55px !important;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex !important;
    align-items: center !important;
    border-left: 4px solid transparent !important;
    position: relative;
    font-size: 14px !important;
    opacity: 0.9 !important;
    min-height: 40px;
    box-sizing: border-box !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.nav-subitem:hover {
    background: rgba(255,255,255,0.05) !important;
    border-left-color: var(--secondary-color) !important;
    opacity: 1 !important;
}

.nav-subitem.active {
    background: rgba(52, 152, 219, 0.15) !important;
    border-left-color: var(--secondary-color) !important;
    opacity: 1 !important;
}

.nav-subicon {
    font-size: 16px;
    margin-right: 12px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    display: inline-block !important;
}

.nav-subtext {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block !important;
    visibility: visible !important;
}

.nav-item.active .submenu-toggle,
.nav-item.expanded .submenu-toggle {
    transform: translateY(-50%) rotate(90deg);
}

.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(0, 0, 0, 0.1);
}

.nav-item.expanded .submenu {
    max-height: 500px;
}

.nav-subitem {
    padding: 12px 25px 12px 55px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    border-left: 4px solid transparent;
    position: relative;
    font-size: 14px;
    opacity: 0.9;
    min-height: 40px;
    box-sizing: border-box;
}

.nav-subitem:hover {
    background: rgba(255,255,255,0.05);
    border-left-color: var(--secondary-color);
    opacity: 1;
}

.nav-subitem.active {
    background: rgba(52, 152, 219, 0.15);
    border-left-color: var(--secondary-color);
    opacity: 1;
}

.nav-subicon {
    font-size: 16px;
    margin-right: 12px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-subtext {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 二级菜单指示线 */
.nav-subitem::before {
    content: '';
    position: absolute;
    left: 45px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255,255,255,0.1);
    z-index: 1;
}

.nav-subitem:first-child::before {
    top: 50%;
}

.nav-subitem:last-child::before {
    bottom: 50%;
}

.nav-subitem::after {
    content: '';
    position: absolute;
    left: 45px;
    top: 50%;
    width: 10px;
    height: 1px;
    background: rgba(255,255,255,0.1);
    z-index: 2;
    transform: translateY(-50%);
}

.nav-subitem.active::after {
    background: var(--secondary-color);
    width: 15px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 18px;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 右侧内容区域样式 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-color);
    width: calc(100% - 280px);
}

/* 标签页样式 */
.tabs-container {
    background: white;
    border-bottom: 1px solid var(--border-color);
    height: 50px;
    display: flex;
    align-items: flex-end;
    overflow-x: auto;
    padding: 0 20px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-shrink: 0;
}

.tabs-container::-webkit-scrollbar {
    display: none;
}

.tab {
    padding: 12px 20px;
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    margin-right: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    white-space: nowrap;
    min-width: 140px;
    max-width: 200px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.tab:hover {
    background: #e9ecef;
}

.tab.active {
    background: white;
    border-bottom: 1px solid white;
    color: var(--secondary-color);
    box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
}

.tab-close {
    margin-left: 10px;
    color: var(--text-light);
    font-size: 16px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
    cursor: pointer;
    line-height: 1;
}

.tab-close:hover {
    background: var(--accent-color);
    color: white;
}

/* 内容区域样式 */
.content-area {
    flex: 1;
    background: white;
    overflow: hidden;
    position: relative;
    display: flex;
}

.iframe-container {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    display: block;
}

.welcome-message {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    color: var(--text-color);
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.welcome-icon {
    font-size: 80px;
    margin-bottom: 30px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.welcome-message h2 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 15px;
    letter-spacing: 1px;
    line-height: 1.3;
}

.welcome-message p {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 40px;
    line-height: 1.5;
}

.welcome-features {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 600px;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    min-width: 120px;
    flex: 1;
    min-width: 140px;
}

.feature-icon {
    font-size: 32px;
}

/* 移动端遮罩层 */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
    backdrop-filter: blur(5px);
}

/* 响应式设计 - 平板 */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    
    .main-content {
        width: calc(100% - 240px);
    }
    
    .tab {
        min-width: 120px;
        max-width: 180px;
        padding: 10px 16px;
    }
    
    .welcome-message h2 {
        font-size: 28px;
    }
    
    .welcome-features {
        gap: 20px;
    }
    
    .feature-item {
        min-width: 120px;
        padding: 15px;
    }
}

/* 响应式设计 - 手机 */
@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }
    
    .container {
        padding-top: 60px;
        min-height: calc(100vh - 60px);
    }
    
    .sidebar {
        position: fixed;
        top: 60px;
        left: 0;
        bottom: 0;
        width: 320px;
        max-width: 85vw;
        transform: translateX(-100%);
        box-shadow: 2px 0 20px rgba(0,0,0,0.3);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .close-sidebar {
        display: block;
    }
    
    .main-content {
        width: 100%;
    }
    
    .tabs-container {
        height: 45px;
        padding: 0 15px;
    }
    
    .tab {
        min-width: 100px;
        max-width: 140px;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .nav-item {
        padding: 20px 25px;
    }
    
    .nav-subitem {
        padding: 12px 20px 12px 50px;
    }
    
    .nav-subitem::before {
        left: 40px;
    }
    
    .nav-subitem::after {
        left: 40px;
    }
    
    .welcome-message {
        padding: 30px 20px;
    }
    
    .welcome-icon {
        font-size: 60px;
    }
    
    .welcome-message h2 {
        font-size: 24px;
    }
    
    .welcome-message p {
        font-size: 16px;
        margin-bottom: 30px;
    }
    
    .welcome-features {
        gap: 15px;
    }
    
    .feature-item {
        min-width: 100px;
        padding: 15px;
    }
    
    .feature-icon {
        font-size: 24px;
    }
    
    .mobile-overlay.active {
        display: block;
    }
    
    /* 移动端菜单打开时禁止背景滚动 */
    body.menu-open {
        overflow: hidden;
    }
}

/* 响应式设计 - 小屏手机 */
@media (max-width: 480px) {
    .sidebar {
        width: 100%;
        max-width: 100vw;
    }
    
    .tabs-container {
        height: 40px;
        padding: 0 10px;
    }
    
    .tab {
        min-width: 80px;
        max-width: 110px;
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .tab-close {
        margin-left: 6px;
        width: 16px;
        height: 16px;
        font-size: 14px;
    }
    
    .nav-item {
        padding: 18px 20px;
    }
    
    .nav-subitem {
        padding: 10px 15px 10px 45px;
        font-size: 13px;
    }
    
    .nav-subicon {
        font-size: 14px;
        margin-right: 10px;
    }
    
    .nav-subitem::before {
        left: 35px;
    }
    
    .nav-subitem::after {
        left: 35px;
    }
    
    .welcome-message {
        padding: 20px 15px;
    }
    
    .welcome-icon {
        font-size: 50px;
        margin-bottom: 20px;
    }
    
    .welcome-message h2 {
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    .welcome-message p {
        font-size: 14px;
        margin-bottom: 30px;
    }
    
    .welcome-features {
        gap: 10px;
    }
    
    .feature-item {
        min-width: 80px;
        padding: 12px;
        font-size: 12px;
    }
    
    .feature-icon {
        font-size: 20px;
    }
    
    .mobile-header {
        height: 55px;
        padding: 0 15px;
    }
    
    .container {
        padding-top: 55px;
        min-height: calc(100vh - 55px);
    }
    
    .sidebar {
        top: 55px;
    }
}

/* 横屏手机优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .container {
        padding-top: 50px;
        min-height: calc(100vh - 50px);
    }
    
    .mobile-header {
        height: 50px;
    }
    
    .sidebar {
        top: 50px;
    }
    
    .nav-item {
        padding: 15px 25px;
    }
    
    .nav-subitem {
        padding: 10px 25px 10px 55px;
    }
    
    .logo {
        padding: 20px 25px;
    }
    
    .welcome-message {
        padding: 20px;
    }
    
    .welcome-icon {
        font-size: 40px;
        margin-bottom: 15px;
    }
    
    .welcome-features {
        flex-direction: row;
        gap: 10px;
    }
    
    .feature-item {
        padding: 10px;
        min-width: 70px;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --text-color: #ffffff;
        --text-light: #b0b0b0;
        --border-color: #333333;
    }
    
    .main-content {
        background: var(--bg-color);
    }
    
    .tabs-container {
        background: #2d2d2d;
        border-bottom-color: var(--border-color);
    }
    
    .tab {
        background: #3d3d3d;
        border-color: var(--border-color);
        color: var(--text-color);
    }
    
    .tab:hover {
        background: #4d4d4d;
    }
    
    .tab.active {
        background: var(--bg-color);
        border-bottom-color: var(--bg-color);
    }
    
    .content-area {
        background: var(--bg-color);
    }
    
    .iframe-container {
        background: var(--bg-color);
    }
    
    .submenu {
        background: rgba(255, 255, 255, 0.05);
    }
    
    .nav-subitem:hover {
        background: rgba(255, 255, 255, 0.08);
    }
    
    .nav-subitem.active {
        background: rgba(52, 152, 219, 0.2);
    }
}

/* 调试样式 - 临时添加以检查CSS是否加载 */
.debug-css-loaded::after {
    content: '✓ CSS加载成功';
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: #4CAF50;
    color: white;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    z-index: 9999;
    opacity: 0.9;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}