// 设计师导航组件样式

$primary-color: #165DFF;
$primary-dark: #0E42CB;
$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;

// 顶部导航栏
.top-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 64px;
  background-color: $background-primary;
  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 {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: $text-primary;
    padding: 8px;
    transition: $transition;

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

  .app-title {
    font-size: 20px;
    font-weight: 600;
    color: $text-primary;
  }

  .navbar-center {
    flex: 1;
    max-width: 500px;
    margin: 0 20px;
  }

  .search-container {
    display: flex;
    align-items: center;
    background-color: $background-tertiary;
    border-radius: $border-radius;
    padding: 6px 12px;
    border: 1px solid $border-color;

    .search-input {
      flex: 1;
      background: none;
      border: none;
      outline: none;
      padding: 6px 8px;
      font-size: 14px;
      color: $text-primary;

      &::placeholder {
        color: $text-tertiary;
      }
    }

    .search-button {
      background: none;
      border: none;
      cursor: pointer;
      color: $text-secondary;
      padding: 4px;
      transition: $transition;

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

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

  .notification-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    color: $text-secondary;
    padding: 8px;
    transition: $transition;

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

    .notification-badge {
      position: absolute;
      top: 2px;
      right: 2px;
      background-color: $danger-color;
      color: white;
      font-size: 10px;
      font-weight: 500;
      padding: 2px 6px;
      border-radius: 10px;
      min-width: 18px;
      text-align: center;
    }
  }

  .user-profile {
    display: flex;
    align-items: center;
    gap: 8px;

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

    .user-name {
      font-size: 14px;
      font-weight: 500;
      color: $text-primary;
    }
  }
}

// 主要内容区
.main-content {
  display: flex;
  flex: 1;
  min-height: 0; // 确保flex子元素能够正确计算高度
}

// 左侧侧边栏
.sidebar {
  display: none;
  width: 0;
  visibility: hidden;
  position: absolute;
  left: -9999px;

  // 如果需要在某些页面显示侧边栏，可以通过其他类来覆盖
  .show-sidebar & {
    display: flex;
    width: 220px;
    background-color: $background-primary;
    border-right: 1px solid $border-color;
    visibility: visible;
    position: relative;
    left: 0;
    flex-direction: column;
    transition: $transition;
  }

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

    .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;

      &: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-footer {
    padding: 16px 24px;
    border-top: 1px solid $border-color;

    .storage-info {
      margin-bottom: 16px;
      font-size: 12px;
      color: $text-tertiary;
    }

    .logout-btn {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 12px;
      background: none;
      border: 1px solid $border-color;
      border-radius: $border-radius;
      color: $text-secondary;
      cursor: pointer;
      font-size: 14px;
      transition: $transition;

      &:hover {
        background-color: $background-tertiary;
        border-color: $danger-color;
        color: $danger-color;
      }
    }
  }

  &.collapsed {
    width: 0;
    overflow: hidden;
  }
}

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

  &.expanded {
    width: 100%;
  }
}

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

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

    .menu-toggle {
      display: block;
    }

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

    .navbar-center {
      display: none;
    }
  }

  .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;
    margin-left: 0;
  }
}

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

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

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

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