/* 商务化配色变量 */
:root {
  --primary-color: #1a237e;
  --primary-dark: #0d1b69;
  --primary-light: #3f51b5;
  --accent-color: #ff9800;
  --accent-light: #ffb74d;
  --bg-dark: linear-gradient(135deg, #1a237e 0%, #283593 100%);
  --bg-light: #f8f9fc;
  --text-primary: #2c3e50;
  --text-secondary: #7f8c8d;
  --text-light: #bdc3c7;
  --border-color: #e9ecef;
  --shadow-sm: 0 2px 4px rgba(26, 35, 126, 0.1);
  --shadow-md: 0 4px 12px rgba(26, 35, 126, 0.15);
  --shadow-lg: 0 8px 24px rgba(26, 35, 126, 0.2);
  --shadow-xl: 0 16px 40px rgba(26, 35, 126, 0.25);
  --gradient-accent: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 重置默认样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Roboto', 'Microsoft YaHei', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-light);
  overflow-x: hidden;
}

/* 左侧固定侧边栏 */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  background: var(--bg-dark);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  transition: var(--transition);
}

.sidebar.collapsed {
  width: 80px;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo img {
  max-height: 50px;
  width: auto;
  transition: var(--transition);
}

.sidebar.collapsed .sidebar-logo img {
  max-height: 35px;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 0;
  overflow-y: auto;
}

.nav-menu {
  list-style: none;
}

.nav-menu li {
  position: relative;
}

.nav-menu a {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.nav-menu a:hover,
.nav-menu .active a {
  background: rgba(255, 255, 255, 0.1);
  border-left-color: var(--accent-color);
  color: white;
}

.nav-menu i {
  font-size: 18px;
  margin-right: 12px;
  min-width: 24px;
  text-align: center;
}

.nav-menu span {
  font-weight: 500;
  transition: var(--transition);
}

.sidebar.collapsed .nav-menu span {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

/* 子菜单项样式 */
.sub-item {
  margin-left: 20px;
}

.sub-link {
  padding: 8px 20px 8px 40px !important;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7) !important;
  border-left: 2px solid rgba(255, 255, 255, 0.2) !important;
}

.sub-link:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-left-color: var(--accent-color) !important;
  color: rgba(255, 255, 255, 0.9) !important;
}

.sub-link i {
  font-size: 12px !important;
  margin-right: 8px !important;
  min-width: 16px !important;
}

.sidebar.collapsed .sub-item {
  margin-left: 0;
}

.sidebar.collapsed .sub-link {
  padding: 8px 20px 8px 20px !important;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-toggle {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar-toggle i {
  color: white;
  font-size: 16px;
}

/* 顶部固定导航栏 */
.header-fixed {
  position: fixed;
  top: 0;
  left: 260px;
  right: 0;
  height: 70px;
  background: white;
  box-shadow: var(--shadow-md);
  z-index: 999;
  transition: var(--transition);
}

.sidebar.collapsed ~ .header-fixed {
  left: 80px;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 30px;
}

.header-left {
  display: flex;
  align-items: center;
}

.sidebar-toggle-btn {
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
}

.sidebar-toggle-btn:hover {
  background: var(--bg-light);
  color: var(--primary-color);
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.header-logo img {
  max-height: 40px;
  width: auto;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-right .user-ico,
.header-right .shop-ico,
.header-right .search-ico {
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  text-decoration: none;
}

.header-right .user-ico:hover,
.header-right .shop-ico:hover,
.header-right .search-ico:hover {
  background: var(--bg-light);
  color: var(--primary-color);
}

.header-right i {
  font-size: 18px;
}

/* 主内容区域 */
.main-wrapper {
  margin-left: 260px;
  margin-top: 70px;
  min-height: calc(100vh - 70px);
  transition: var(--transition);
}

.main-wrapper.sidebar-collapsed {
  margin-left: 80px;
}

.main-content {
  position: relative;
  z-index: 1;
}

/* 搜索弹出层 */
.searchBar-m {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  display: none;
}

.searchBar-m .mask {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.searchBar-m .mask-ico {
  position: absolute;
  top: 30px;
  right: 30px;
  color: white;
  font-size: 24px;
  text-decoration: none;
}

.searchBar-m .form-group {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 600px;
}

.searchBar-m input {
  width: 100%;
  height: 60px;
  padding: 0 20px;
  font-size: 18px;
  border: none;
  border-radius: 30px;
  background: white;
  box-shadow: var(--shadow-xl);
}

.searchBar-m button {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 40px;
  height: 40px;
  background: var(--gradient-accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
  
  .header-fixed {
    left: 0;
  }
  
  .main-wrapper {
    margin-left: 0;
  }
  
  .header-center {
    order: 1;
  }
  
  .header-left {
    order: 2;
  }
  
  .header-right {
    order: 3;
  }
}

/* 动画效果 */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nav-menu li {
  animation: slideIn 0.3s ease-out;
}

/* 滚动条样式 */
.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}
