/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* 通用不换行规则 */
table td, table th,
.owner-data-table td, .owner-data-table th,
.owner-detail-table td, .owner-detail-table th,
.usage-group-data-table td, .usage-group-data-table th,
.task-detail-table td, .task-detail-table th {
    white-space: nowrap;
}

/* ==================== 布局样式 ==================== */
.layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 240px;
    background: #fff;
    border-right: 1px solid #e5e5e5;
    transition: width 0.3s ease;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-content {
    padding: 16px 0;
}

.sidebar-menu {
    animation: fadeIn 0.3s ease;
}

.content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: #f5f5f5;
}

/* ==================== 顶部导航栏 ==================== */
.top-nav {
    height: 64px;
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    flex-shrink: 0;
}

.top-nav-container {
    width: 100%;
    margin: 0 auto;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.top-nav-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    width: 240px;
    padding: 0 16px;
    justify-content: flex-start;
}

.top-menu {
    display: flex;
    list-style: none;
    gap: 0;
    margin: 0;
    padding: 0;
    flex: 1;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    white-space: nowrap;
}

.top-menu::-webkit-scrollbar {
    display: none;
}

.top-nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

/* ==================== Logo样式 ==================== */
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: #0052d9;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

/* ==================== 菜单样式 ==================== */
.menu {
    list-style: none;
    padding: 8px 0;
}

.menu-item {
    position: relative;
    margin: 4px 8px;
}

.menu-link, .top-menu-link, .submenu-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #666;
    transition: all 0.3s ease;
    cursor: pointer;
}

.top-menu-link {
    padding: 0 20px;
    height: 64px;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.top-menu-text {
    white-space: nowrap;
}

.menu-link {
    padding: 12px 16px;
    gap: 12px;
}

.submenu-link {
    padding: 10px 16px;
    gap: 8px;
    font-size: 13px;
    background: transparent;
    border-radius: 4px;
    margin: 2px 8px 2px 40px;
}

.menu-link:hover, .top-menu-link:hover {
    background-color: #f5f5f5;
    color: #333;
}

.top-menu-link:hover {
    color: #0052d9;
    background-color: #f5f5f5;
}

.submenu-link:hover {
    background-color: #f8f9fa;
    color: #333;
}

.menu-link.active:not(.has-active-child), .submenu-link.active {
    background-color: #e6f7ff;
    color: #0052d9;
}

.top-menu-link.active {
    color: #0052d9;
    border-bottom-color: #0052d9;
    background-color: #f0f5ff;
}

.menu-link.has-active-child {
    background-color: #f0f5ff;
    color: #0052d9;
}

.menu-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.menu-text {
    flex: 1;
    font-size: 14px;
}

.submenu-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.7;
}

.submenu-link:hover .submenu-icon,
.submenu-link.active .submenu-icon,
.menu-link.has-active-child .menu-arrow,
.menu-link:hover .menu-arrow {
    opacity: 1;
}

/* 子菜单样式 */
.menu-item-has-children {
    position: relative;
}

.menu-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
    margin-left: auto;
    opacity: 0.6;
}

.menu-item-has-children.active .menu-arrow {
    transform: rotate(180deg);
    opacity: 1;
}

.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.menu-item-has-children.active .submenu {
    max-height: none;
    height: auto;
    opacity: 1;
}

.submenu-item {
    position: relative;
}

.submenu-link.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 16px;
    background: #0052d9;
    border-radius: 1px;
}

/* ==================== 用户信息样式 ==================== */
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-info:hover {
    background-color: #f5f5f5;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: #0052d9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
    font-size: 14px;
}

.user-name {
    font-size: 14px;
    color: #333;
}

/* ==================== 页面内容样式 ==================== */
.page-content {
    display: none;
}

.page-content.active {
    display: block;
}

.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.page-description {
    color: #666;
    font-size: 14px;
}

.card {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ==================== 动画效果 ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ==================== 响应式设计 ==================== */

/* 大屏幕：保持默认样式 */
@media (min-width: 1400px) {
    .top-menu-link {
        padding: 0 24px;
        font-size: 15px;
    }
}

/* 中等屏幕：适当缩小内边距 */
@media (max-width: 1200px) {
    .top-menu-link {
        padding: 0 16px;
        font-size: 14px;
    }
}

/* 小屏幕：进一步缩小内边距 */
@media (max-width: 992px) {
    .top-menu-link {
        padding: 0 12px;
        font-size: 13px;
    }
    
    .top-nav-left {
        width: auto;
        min-width: 180px;
    }
    
    .logo-text {
        font-size: 16px;
    }
}

/* 超小屏幕：最小内边距 */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -240px;
        top: 64px;
        bottom: 0;
        z-index: 1000;
    }
    
    .top-menu-link {
        padding: 0 10px;
        font-size: 12px;
    }
    
    .top-nav-left {
        width: auto;
        min-width: 140px;
        padding: 0 12px;
    }
    
    .logo-text {
        font-size: 14px;
    }
    
    .user-name {
        display: none;
    }
    
    .top-nav-container {
        padding: 0 16px;
    }
    
    .content {
        padding: 16px;
    }
}