/* 现代化布局样式 - 2025版本 */

:root {
    --sidebar-width: 200px; /* 从260px减少到200px，减少约1/4 */
    --sidebar-collapsed-width: 55px; /* 从65px减少到55px */
    --topbar-height: 60px;
    --primary-color: #4e73df;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --sidebar-gradient: linear-gradient(180deg, #5a5c69 10%, #3a3b45 100%);
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --text-color: #5a5c69;
    --text-muted: #858796;
    --border-color: #e3e6f0;
    --gray-100: #f8f9fc;
    --gray-200: #eaecf4;
    --shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    --border-radius: 0.35rem;
    --font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

/* 全局样式重置 */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--gray-100);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* 顶部导航栏现代化设计 */
.topbar {
    height: var(--topbar-height);
    background: var(--primary-gradient);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    transition: all 0.3s ease;
}

.topbar-brand {
    color: white;
    font-size: 1.5rem;
    font-weight: 800;
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.topbar-brand:hover {
    color: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
}

.topbar-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* 用户下拉菜单 */
.user-dropdown .dropdown-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.user-dropdown .dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.user-dropdown .dropdown-menu {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: var(--border-radius);
    min-width: 200px;
    margin-top: 0.5rem;
}

.user-dropdown .dropdown-item {
    padding: 0.75rem 1.25rem;
    transition: all 0.3s ease;
    border-radius: var(--border-radius);
    margin: 0.25rem;
}

.user-dropdown .dropdown-item:hover {
    background: var(--gray-100);
    transform: translateX(5px);
}

/* 现代化侧边栏 */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    z-index: 1020;
    background: var(--sidebar-gradient);
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
}

.sidebar.toggled {
    width: var(--sidebar-collapsed-width);
}

.sidebar .sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    color: white;
    font-size: 1.3rem;
    font-weight: 800;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.sidebar .sidebar-brand:hover {
    background: rgba(0, 0, 0, 0.3);
    color: white;
}

.sidebar-nav {
    padding: 1rem 0; /* 从1.5rem 0减少到1rem 0 */
}

/* 导航项现代化样式 */
.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 0.8rem; /* 从0.875rem 1.25rem减少到0.75rem 0.8rem */
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.85rem; /* 从0.9rem减少到0.85rem */
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--border-radius);
    margin: 0.125rem 0.6rem; /* 从0.125rem 1rem减少到0.125rem 0.6rem */
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.nav-link:hover::before {
    left: 100%;
}

.nav-link:hover,
.nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    border-left: 4px solid white;
}

.nav-link i {
    width: 1.4rem; /* 从1.75rem减少到1.4rem */
    text-align: center;
    margin-right: 0.5rem; /* 从0.75rem减少到0.5rem */
    font-size: 0.9rem; /* 从1rem减少到0.9rem */
    transition: all 0.3s ease;
}

.nav-link:hover i {
    transform: scale(1.1);
}

.nav-link-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 0.25rem; /* 减少文字和箭头之间的距离 */
}

.collapse-arrow {
    margin-left: 0; /* 从auto改为0，减少间距 */
    font-size: 0.75rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0; /* 防止箭头被压缩 */
}

.nav-link[aria-expanded="true"] .collapse-arrow {
    transform: rotate(90deg);
}

/* 子菜单现代化样式 */
.sidebar-submenu {
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius);
    margin: 0.25rem 0.3rem; /* 减少左右边距 */
    padding: 0.4rem 0;
    overflow: visible; /* 允许内容完整显示 */
    width: calc(100% - 0.6rem); /* 确保子菜单占满可用宽度 */
}

.sidebar-submenu .nav-link {
    padding: 0.5rem 0.8rem; 
    font-size: 0.8rem; 
    color: rgba(255, 255, 255, 0.7);
    margin: 0.125rem 0.5rem; /* 恢复左右边距 */
    border-radius: calc(var(--border-radius) - 0.125rem);
    width: auto; /* 自动宽度，允许完整显示 */
    display: flex; /* 使用flex布局 */
    align-items: center; /* 垂直居中 */
    white-space: nowrap; /* 防止文字换行 */
    overflow: visible; /* 允许内容显示 */
}

.sidebar-submenu .nav-link:hover,
.sidebar-submenu .nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(10px);
}

.sidebar-submenu .nav-link.active {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    border-left: 3px solid rgba(255, 255, 255, 0.8);
}

/* 子菜单图标样式 */
.sidebar-submenu .nav-link i {
    width: 1.2rem; /* 子菜单图标宽度 */
    text-align: center;
    margin-right: 0.25rem; /* 减少图标和文字的距离到一半 */
    font-size: 0.8rem; /* 子菜单图标大小 */
    transition: all 0.3s ease;
    flex-shrink: 0; /* 防止图标被压缩 */
}

/* 子菜单文字样式 */
.sidebar-submenu .nav-link-text {
    flex: 1;
    white-space: nowrap; /* 防止文字换行 */
    overflow: visible; /* 允许文字完整显示 */
    text-overflow: clip; /* 不使用省略号 */
    margin-right: 0; /* 移除右边距 */
}

/* 主内容区域 */
.content-wrapper {
    margin-left: var(--sidebar-width);
    padding-top: var(--topbar-height);
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--gray-100);
}

.sidebar.toggled + .content-wrapper {
    margin-left: var(--sidebar-collapsed-width);
}

.main-content {
    padding: 0.67rem;
    max-width: 100%;
}

/* 页面标题现代化 */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.page-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100px;
    height: 2px;
    background: var(--primary-gradient);
    border-radius: 1px;
}

.page-title {
    color: var(--text-color);
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    position: relative;
}

/* 现代化卡片 */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    background: linear-gradient(135deg, var(--gray-100), var(--gray-200));
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    position: relative;
}

.card-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1.5rem;
    right: 1.5rem;
    height: 2px;
    background: var(--primary-gradient);
    border-radius: 1px;
}

.card-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
    display: flex;
    align-items: center;
}

.card-title i {
    margin-right: 0.75rem;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.card-body {
    padding: 1.5rem;
}

/* 按钮现代化 */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #17a673);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, var(--info-color), #2c9faf);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color), #dda20a);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #c03221);
    color: white;
}

/* 表格现代化 */
.table {
    font-size: 0.875rem;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table thead th {
    background: var(--primary-gradient);
    color: white;
    font-weight: 700;
    border: none;
    padding: 1rem;
    position: relative;
}

.table tbody td {
    padding: 0.875rem 1rem;
    border-top: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.table tbody tr:hover {
    background: rgba(78, 115, 223, 0.05);
    transform: scale(1.01);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        margin-left: calc(var(--sidebar-width) * -1);
        z-index: 1040;
    }

    .sidebar.show {
        margin-left: 0;
    }

    .content-wrapper {
        margin-left: 0;
    }

    .topbar {
        padding: 0 1rem;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .main-content {
        padding: 0.33rem;
    }
}

@media (max-width: 576px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .page-title {
        font-size: 1.25rem;
    }
}

/* 滚动条美化 */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1));
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.2));
}

/* 动画效果 */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.card {
    animation: fadeInUp 0.6s ease-out;
}

.nav-item {
    animation: slideInRight 0.4s ease-out;
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 通知样式 */
.alert {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border-left: 4px solid;
}

.alert-success {
    background: linear-gradient(135deg, rgba(28, 200, 138, 0.1), rgba(23, 166, 115, 0.05));
    border-left-color: var(--success-color);
    color: #0f5132;
}

.alert-info {
    background: linear-gradient(135deg, rgba(54, 185, 204, 0.1), rgba(44, 159, 175, 0.05));
    border-left-color: var(--info-color);
    color: #055160;
}

.alert-warning {
    background: linear-gradient(135deg, rgba(246, 194, 62, 0.1), rgba(221, 162, 10, 0.05));
    border-left-color: var(--warning-color);
    color: #664d03;
}

.alert-danger {
    background: linear-gradient(135deg, rgba(231, 74, 59, 0.1), rgba(192, 50, 33, 0.05));
    border-left-color: var(--danger-color);
    color: #721c24;
}
