/* 整体布局 */
.app-container {
    display: flex;
    min-height: 100vh;
    background: var(--background);
}

/* 左侧导航栏 - 深色主题 */
.sidebar {
    width: var(--nav-width);
    min-height: 100vh;
    background: linear-gradient(180deg, #1a3a52 0%, #0f2537 100%);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
}

.sidebar-collapsed {
    width: 64px;
}

/* Logo区域 - 深色 */
.sidebar-logo {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo img {
    height: 32px;
    margin-right: 12px;
}

.sidebar-logo h1 {
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-collapsed .sidebar-logo h1 {
    display: none;
}

/* 导航菜单 - 深色 */
.nav-menu {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border-left-color: rgba(64, 158, 255, 0.5);
}

.nav-link.active {
    color: #ffffff;
    background: rgba(64, 158, 255, 0.15);
    font-weight: 500;
    border-left-color: #409EFF;
}

.nav-link .nav-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    flex-shrink: 0;
}

.nav-link .nav-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-link .nav-arrow {
    width: 12px;
    height: 12px;
    transition: transform 0.3s ease;
}

.nav-link .nav-arrow.expanded {
    transform: rotate(90deg);
}

.sidebar-collapsed .nav-link .nav-text,
.sidebar-collapsed .nav-link .nav-arrow {
    display: none;
}

/* 子菜单 - 深色 */
.nav-submenu {
    background: rgba(0, 0, 0, 0.2);
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}

.nav-submenu.expanded {
    max-height: 500px;
}

.nav-submenu .nav-link {
    padding-left: 52px;
    font-size: 13px;
    border-left: none;
}

.nav-submenu .nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nav-submenu .nav-link.active {
    background: rgba(64, 158, 255, 0.2);
    color: #409EFF;
}

/* 用户信息 - 深色 */
.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-user .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #409EFF;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    margin-right: 12px;
    flex-shrink: 0;
}

.sidebar-user .user-info {
    flex: 1;
    overflow: hidden;
}

.sidebar-user .user-name {
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-role {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    margin-top: 2px;
}

.sidebar-collapsed .sidebar-user .user-info {
    display: none;
}

/* 右侧主内容区 */
.main-container {
    flex: 1;
    margin-left: var(--nav-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.sidebar-collapsed~.main-container {
    margin-left: 64px;
}

/* 顶部导航栏 */
.main-header {
    height: auto;
    min-height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

.header-top {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.header-left {
    display: flex;
    align-items: center;
}

.toggle-sidebar {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: var(--radius-sm);
    margin-right: 16px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.toggle-sidebar:hover {
    background: var(--background);
    color: var(--text-primary);
}

/* 面包屑 */
.breadcrumb {
    display: flex;
    align-items: center;
    font-size: 14px;
}

.breadcrumb-item {
    color: var(--text-secondary);
}

.breadcrumb-item:last-child {
    color: var(--text-primary);
    font-weight: 500;
}

.breadcrumb-separator {
    margin: 0 8px;
    color: var(--text-disabled);
}

/* 顶部标签页导航 - 按钮样式 */
.header-tabs {
    display: flex;
    align-items: center;
    padding: 4px 24px;
    background: #f5f7fa;
    border-top: 1px solid var(--border-light);
    min-height: 42px;
    overflow-x: auto;
    gap: 6px;
}

.header-tabs::-webkit-scrollbar {
    height: 4px;
}

.header-tabs::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

.tab-item {
    position: relative;
    padding: 0 28px 0 12px;
    height: 32px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
    border-radius: 4px;
    background: var(--white);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 4px;
}

.tab-item:hover {
    background: #f0f7ff;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.tab-item.active {
    color: #ffffff !important;
    font-weight: 500;
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.tab-item.active .tab-icon {
    filter: brightness(0) invert(1);
}

.tab-item .tab-icon {
    font-size: 14px;
}

.tab-item .tab-close {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0.6;
    transition: all 0.2s;
    line-height: 1;
}

.tab-item:hover .tab-close {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}

.tab-item.active .tab-close {
    color: #ffffff;
}

.tab-item.active:hover .tab-close {
    background: rgba(255, 255, 255, 0.2);
}

.tab-close:hover {
    background: rgba(0, 0, 0, 0.15) !important;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-action {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    color: var(--text-secondary);
    position: relative;
    transition: all 0.2s;
}

.header-action:hover {
    background: var(--background);
    color: var(--text-primary);
}

.header-action .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    background: var(--error-color);
    color: #fff;
    font-size: 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.user-dropdown {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.user-dropdown:hover {
    background: var(--background);
}

.user-dropdown .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    margin-right: 8px;
}

.user-dropdown .name {
    font-size: 14px;
    color: var(--text-primary);
}

/* 主内容区 */
.main-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* 页面标题 */
.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.page-desc {
    font-size: 14px;
    color: var(--text-secondary);
}

/* 内容卡片 */
.content-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
}

.content-card.no-padding {
    padding: 0;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 16px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-container {
        margin-left: 0;
    }
}