RMO-Front/src/components/DashboardLayout.css

399 lines
7.1 KiB
CSS

.dashboard-layout {
display: flex;
min-height: 100vh;
background: var(--bg-color, #f5f5f5);
}
/* ========== 侧边栏 ========== */
.dashboard-sidebar {
width: 125px;
background: #fff;
border-right: 1px solid var(--border-color, #e8e8e8);
display: flex;
flex-direction: column;
transition: width 0.3s ease;
position: fixed;
height: 100vh;
left: 0;
top: 0;
z-index: 100;
box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
}
.dashboard-sidebar.closed {
width: 60px;
}
.sidebar-header {
padding: var(--padding-md, 16px) var(--padding-sm, 12px);
border-bottom: 1px solid var(--border-color, #e8e8e8);
display: flex;
justify-content: space-between;
align-items: center;
}
.sidebar-logo {
display: flex;
flex-direction: column;
text-decoration: none;
color: var(--brand-primary, #0ea5e9);
align-items: center;
text-align: center;
}
.sidebar-logo h2 {
margin: 0;
font-size: 18px;
font-weight: bold;
line-height: 1.2;
}
.sidebar-logo span {
font-size: 10px;
color: var(--text-light, #666);
line-height: 1.2;
margin-top: 2px;
}
.dashboard-sidebar.closed .sidebar-logo span {
display: none;
}
.dashboard-sidebar.closed .sidebar-logo h2 {
font-size: 16px;
}
.sidebar-toggle {
background: none;
border: none;
cursor: pointer;
font-size: 14px;
color: var(--text-light, #666);
padding: 4px;
flex-shrink: 0;
}
.dashboard-sidebar.closed .sidebar-toggle {
margin: 0 auto;
}
.sidebar-nav {
flex: 1;
padding: var(--padding-sm, 12px) 0;
overflow-y: auto;
}
.nav-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: var(--padding-sm, 12px) var(--padding-xs, 8px);
color: var(--text-color, #333);
text-decoration: none;
transition: all 0.2s;
border-left: 3px solid transparent;
text-align: center;
min-height: 70px;
}
.nav-item:hover {
background: rgba(14, 165, 233, 0.05);
color: var(--brand-primary, #0ea5e9);
}
.nav-item.active {
background: rgba(14, 165, 233, 0.1);
color: var(--brand-primary, #0ea5e9);
border-left-color: var(--brand-primary, #0ea5e9);
font-weight: 500;
}
.nav-icon {
font-size: 16px;
margin-bottom: var(--padding-xs, 8px);
width: auto;
text-align: center;
display: block;
}
.nav-text {
font-size: 12px;
line-height: 1.2;
word-break: break-all;
text-align: center;
}
.dashboard-sidebar.closed .nav-text {
display: none;
}
.dashboard-sidebar.closed .nav-icon {
margin-bottom: 0;
}
.dashboard-sidebar.closed .nav-item {
flex-direction: row;
justify-content: center;
min-height: auto;
padding: var(--padding-md, 16px);
border-left: 3px solid transparent;
border-top: none;
}
.dashboard-sidebar.closed .nav-item.active {
border-left-color: var(--brand-primary, #0ea5e9);
border-top: none;
}
.nav-group {
margin-top: var(--padding-sm, 12px);
}
.nav-submenu {
padding-left: var(--padding-xs, 8px);
background: rgba(14, 165, 233, 0.02);
margin-top: var(--padding-xs, 8px);
}
.nav-subitem {
display: block;
padding: var(--padding-xs, 8px) var(--padding-sm, 12px);
color: var(--text-light, #666);
text-decoration: none;
font-size: 11px;
transition: all 0.2s;
text-align: center;
line-height: 1.4;
}
.nav-subitem:hover {
color: var(--brand-primary, #0ea5e9);
background: rgba(14, 165, 233, 0.05);
}
.nav-subitem.active {
color: var(--brand-primary, #0ea5e9);
font-weight: 500;
}
/* ========== 主内容区 ========== */
.dashboard-main {
flex: 1;
margin-left: 125px;
display: flex;
flex-direction: column;
transition: margin-left 0.3s ease;
}
.dashboard-sidebar.closed ~ .dashboard-main {
margin-left: 60px;
}
.dashboard-header {
background: #fff;
padding: var(--padding-md, 16px) var(--padding-xl, 24px);
border-bottom: 1px solid var(--border-color, #e8e8e8);
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.header-left {
display: flex;
align-items: center;
gap: var(--padding-xl, 24px);
flex: 1;
}
.header-logo {
display: flex;
flex-direction: column;
text-decoration: none;
color: var(--brand-primary, #0ea5e9);
margin-right: var(--padding-lg, 20px);
}
.header-logo h2 {
margin: 0;
font-size: 24px;
font-weight: 700;
line-height: 1.2;
}
.header-logo span {
font-size: 12px;
color: var(--text-light, #666);
line-height: 1.2;
}
.header-nav {
display: flex;
gap: var(--padding-lg, 20px);
align-items: center;
}
.header-nav a {
color: var(--text-color, #333);
font-size: 15px;
padding: 8px 0;
position: relative;
text-decoration: none;
transition: color 0.3s ease;
}
.header-nav a:hover {
color: var(--brand-primary, #0ea5e9);
}
.header-nav a.active {
color: var(--brand-primary, #0ea5e9);
font-weight: 600;
}
.header-nav a.active::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 2px;
background: var(--brand-primary, #0ea5e9);
}
/* 下拉菜单样式 */
.nav-dropdown {
position: relative;
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
background: var(--white, #fff);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
border-radius: 8px;
min-width: 180px;
padding: 10px 0;
margin-top: 10px;
z-index: 1000;
border: 1px solid var(--border-color, #e8e8e8);
}
.dropdown-menu a {
display: block;
padding: 10px 20px;
color: var(--text-color, #333);
font-size: 14px;
text-decoration: none;
transition: background 0.3s ease, color 0.3s ease;
}
.dropdown-menu a:hover {
background: var(--bg-color, #f5f5f5);
color: var(--brand-primary, #0ea5e9);
}
.dropdown-menu a.active {
background: var(--bg-color, #f5f5f5);
color: var(--brand-primary, #0ea5e9);
font-weight: 600;
}
.dropdown-menu a.active::after {
display: none;
}
.header-right {
display: flex;
align-items: center;
gap: var(--padding-lg, 20px);
}
.user-info {
display: flex;
flex-direction: column;
align-items: flex-end;
}
.user-name {
font-weight: 500;
color: var(--text-color, #333);
font-size: 14px;
}
.user-role {
font-size: 12px;
color: var(--text-light, #666);
}
.logout-btn {
background: var(--brand-primary, #0ea5e9);
color: #fff;
border: none;
padding: var(--padding-sm, 12px) var(--padding-lg, 20px);
border-radius: 4px;
cursor: pointer;
font-size: 14px;
transition: background 0.2s;
}
.logout-btn:hover {
background: var(--brand-primary-dark, #0284c7);
}
.dashboard-content {
flex: 1;
padding: var(--padding-xl, 24px);
overflow-y: auto;
}
/* 响应式设计 */
@media (max-width: 1200px) {
.header-nav {
gap: var(--padding-md, 16px);
}
.header-nav a {
font-size: 14px;
}
}
@media (max-width: 768px) {
.dashboard-sidebar {
transform: translateX(-100%);
}
.dashboard-sidebar.open {
transform: translateX(0);
}
.dashboard-main {
margin-left: 0;
}
.header-left {
flex-direction: column;
align-items: flex-start;
gap: var(--padding-md, 16px);
}
.header-nav {
flex-wrap: wrap;
gap: var(--padding-sm, 12px);
}
.header-nav a {
font-size: 13px;
}
.dropdown-menu {
position: fixed;
left: 50%;
transform: translateX(-50%);
min-width: 200px;
}
}