// ==================== 品牌色变量 ====================
$brand-color: #0055AA;
$brand-color-light: #EBF5FF;
$brand-color-hover: #004488;

.sidebar-layout {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: #fff;
    font-family: 'Inter', 'Noto Sans SC', sans-serif;
}

// ==================== 2级侧边栏 ====================
.sidebar {
    width: 224px;
    height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    color: #333;
    flex-shrink: 0;
    transition: width 0.3s ease;
    border-right: 1px solid #f1f5f9;
    
    &.collapsed {
        width: 64px;
        
        .sidebar-header {
            padding: 16px 0;
            justify-content: center;
            
            .logo {
                display: none;
            }
            
            .collapse-btn {
                display: flex;
            }
        }
        
        .nav-item {
            justify-content: center;
            padding: 10px;
            margin: 2px 8px;
            
            span {
                display: none;
            }
        }
        
        .user-section {
            justify-content: center;
            padding: 16px 8px;
            
            .user-name, .back-icon {
                display: none;
            }
        }
    }
}

// 侧边栏头部
.sidebar-header {
    height: 64px;
    padding: 0 16px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.collapse-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    color: #94a3b8;
    background: transparent;
    border: none;
    transition: all 0.2s;
    
    &:hover {
        background: #f1f5f9;
        color: #64748b;
    }
}
.logo-img {
    width: 100%;
    height: 32px;
    border-radius: 8px;
    object-fit: contain;
}
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    
    .logo-text {
        font-size: 15px;
        font-weight: 600;
        color: #1e293b;
    }
}

// 导航菜单
.nav-menu {
    flex: 1;
    // overflow-y: auto;
    padding: 8px 0;
    
    &::-webkit-scrollbar {
        width: 4px;
    }
    
    &::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.1);
        border-radius: 4px;
    }
}

.nav-section {
    padding: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    margin: 2px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    
    &:hover {
        background: #f8fafc;
        color: #475569;
    }
    
    &.active {
        background: $brand-color-light;
        color: $brand-color;
    }
    
    .el-icon {
        font-size: 18px;
        flex-shrink: 0;
    }
    
    span {
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

// 用户信息
.user-section {
    padding: 16px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 12px;
    
    .user-avatar {
        width: 36px;
        height: 36px;
        cursor: pointer;
        transition: transform 0.2s;
        flex-shrink: 0;
        
        &:hover {
            transform: scale(1.05);
        }
        
        :deep(.el-avatar) {
            width: 100%;
            height: 100%;
        }
    }
    
    .user-name {
        flex: 1;
        font-size: 14px;
        font-weight: 500;
        color: #374151;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .back-icon {
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 6px;
        cursor: pointer;
        color: #94a3b8;
        transition: all 0.2s;
        flex-shrink: 0;
        
        &:hover {
            color: $brand-color;
            background: $brand-color-light;
        }
        
        .el-icon {
            font-size: 18px;
        }
    }
}

// ==================== 主内容区 ====================
.main-content {
    flex: 1;
    height: 100%;
    overflow: hidden;
    background: #f8fafc;
    position: relative;
}

// iframe 容器
.iframe-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.iframe-header {
    height: 56px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
    flex-shrink: 0;
}

.iframe-title {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

.content-iframe {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}

.iframe-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: $brand-color;
    font-size: 14px;
    z-index: 10;
    
    .el-icon {
        font-size: 32px;
    }
}

// ==================== 响应式 ====================
@media (max-width: 768px) {
    .sidebar {
        width: 64px;
        
        &:not(.collapsed) {
            width: 224px;
            position: fixed;
            left: 0;
            top: 0;
            z-index: 1000;
            box-shadow: 4px 0 16px rgba(0, 0, 0, 0.1);
        }
    }
    
    .iframe-header {
        padding: 0 16px;
        
        .iframe-title {
            font-size: 14px;
        }
    }
}
