// 全局变量定义
$primary-color: #165DFF;
$primary-dark: #0d2f5e;
$secondary-color: #4E5BA6;
$success-color: #00B42A;
$warning-color: #FF7D00;
$danger-color: #F53F3F;
$text-primary: #1D2129;
$text-secondary: #4E5969;
$text-tertiary: #86909C;
$border-color: #E5E6EB;
$background-primary: #FFFFFF;
$background-secondary: #F2F3F5;
$background-tertiary: #F7F8FA;
$shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
$shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
$shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);
$border-radius: 8px;
$transition: all 0.3s ease;

// 主容器
.admin-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background-color: $background-secondary;
}

// 顶部导航栏
.top-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 64px;
  background-color: $primary-dark;
  border-bottom: 1px solid $border-color;
  box-shadow: $shadow-sm;
  position: sticky;
  top: 0;
  z-index: 1000;

  .navbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: white;
    padding: 8px;
    transition: $transition;

    &:hover {
      background-color: rgba(255, 255, 255, 0.1);
      border-radius: 4px;
    }
  }

  .app-title {
    font-size: 20px;
    font-weight: 600;
    color: white;
    margin: 0;
  }

  .navbar-right {
    display: flex;
    align-items: center;
    gap: 24px;
  }

  .date-display {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
  }

  .user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: $border-radius;
    cursor: pointer;
    transition: $transition;

    &:hover {
      background-color: rgba(255, 255, 255, 0.2);
    }

    .user-avatar {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      object-fit: cover;
    }

    .user-name {
      font-size: 14px;
      font-weight: 500;
      color: white;
    }
  }
}

// 主要内容区
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

// 左侧侧边栏
.sidebar {
  width: 240px;
  background-color: $background-primary;
  border-right: 1px solid $border-color;
  display: flex;
  flex-direction: column;
  transition: $transition;
  overflow-y: auto;

  .sidebar-nav {
    flex: 1;
    padding: 20px 0;
  }

  .nav-section {
    margin-bottom: 24px;

    .section-title {
      font-size: 12px;
      font-weight: 600;
      color: $text-tertiary;
      text-transform: uppercase;
      padding: 0 24px 8px 24px;
      margin: 0;
      letter-spacing: 0.5px;
    }
  }

  .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: $text-secondary;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: $transition;
    font-size: 14px;

    &:hover {
      background-color: $background-tertiary;
      color: $primary-color;
    }

    &.active {
      color: $primary-color;
      background-color: color-mix(in srgb, $primary-color 5%, transparent);
      border-left-color: $primary-color;
      font-weight: 500;
    }
  }
}

// 侧边栏折叠样式
.sidebar.collapsed {
  width: 64px;

  .section-title,
  .nav-item span {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 12px;
  }
}

// 中间内容区
.content-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  transition: $transition;
  background-color: $background-secondary;
}

// 内容区展开样式
.content-wrapper.expanded {
  padding-left: 24px;
}

// 响应式设计
@media (max-width: 1200px) {
  .sidebar {
    width: 220px;
  }
}

@media (max-width: 768px) {
  .top-navbar {
    padding: 0 16px;

    .app-title {
      font-size: 18px;
    }

    .navbar-right {
      gap: 16px;
    }
  }

  .sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    height: calc(100vh - 64px);
    z-index: 900;
    transform: translateX(0);

    &.collapsed {
      transform: translateX(-100%);
    }
  }

  .content-wrapper {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .top-navbar {
    height: 56px;

    .app-title {
      font-size: 16px;
    }

    .navbar-right {
      gap: 12px;
    }

    .user-profile .user-name {
      display: none;
    }
  }

  .sidebar {
    top: 56px;
    height: calc(100vh - 56px);
  }

  .content-wrapper {
    padding: 12px;
  }
}