// 全局变量定义
$primary-color: #165DFF;
$secondary-color: #6B7280;
$success-color: #00B42A;
$warning-color: #FFAA00;
$error-color: #F53F3F;
$text-primary: #333333;
$text-secondary: #666666;
$text-tertiary: #999999;
$border-color: #E5E7EB;
$bg-light: #F9FAFB;
$bg-white: #FFFFFF;
$shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
$shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
$shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

// 对话框容器
.user-dialog {
  min-width: 600px;
  border-radius: 12px;
  overflow: hidden;
  background-color: $bg-white;
}

// 对话框头部
.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid $border-color;
  background-color: $bg-light;

  .dialog-title {
    font-size: 18px;
    font-weight: 600;
    color: $text-primary;
    margin: 0;
  }

  .close-btn {
    color: $text-tertiary;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s ease;

    &:hover {
      background-color: #E5E7EB;
      color: $text-secondary;
    }
  }
}

// 对话框内容
.dialog-content {
  padding: 24px;
  max-height: 60vh;
  overflow-y: auto;
}

// 表单区域
.form-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid $border-color;

  &:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
  }

  .section-title {
    font-size: 16px;
    font-weight: 600;
    color: $text-primary;
    margin-bottom: 16px;
  }
}

// 表单行
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 16px;
}

// 表单组
.form-group {
  .form-field {
    width: 100%;
    .mat-form-field-wrapper {
      .mat-form-field-flex {
        border-radius: 8px;
      }

      .mat-form-field-outline {
        border-radius: 8px;
      }

      .mat-form-field-infix {
        padding: 10px 0;

        input {
          font-size: 14px;
          color: $text-primary;
        }

        .mat-input-element {
          &::placeholder {
            color: $text-tertiary;
          }

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

      .mat-form-field-label {
        font-size: 14px;
        color: $text-secondary;
      }

      .mat-form-field-suffix {
        .mat-icon {
          color: $text-tertiary;
        }
      }

      .mat-form-field-hint {
        font-size: 12px;
        color: $text-tertiary;
        margin-top: 4px;
      }
    }
  }
}

// 密码生成按钮
.generate-password-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  color: $primary-color;
  border: 1px solid $primary-color;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  background-color: $bg-white;
  transition: all 0.2s ease;
  margin-bottom: 8px;

  &:hover {
    background-color: $primary-color;
    color: $bg-white;
  }
}

// 对话框底部
.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid $border-color;
  background-color: $bg-light;

  .cancel-btn {
    padding: 8px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: $text-secondary;
    background-color: $bg-white;
    border: 1px solid $border-color;
    transition: all 0.2s ease;

    &:hover {
      background-color: #F3F4F6;
      border-color: $text-tertiary;
    }
  }

  .save-btn {
    padding: 8px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    background-color: $primary-color;
    color: $bg-white;
    transition: all 0.2s ease;
    box-shadow: $shadow-sm;

    &:hover {
      background-color: #0E4BD8;
      box-shadow: $shadow-md;
      transform: translateY(-1px);
    }
  }
}

// 响应式设计
@media (max-width: 768px) {
  .user-dialog {
    min-width: auto;
    width: 90vw;
    max-width: 500px;
  }

  .form-row {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  .dialog-header,
  .dialog-content,
  .dialog-footer {
    padding: 16px;
  }

  .dialog-title {
    font-size: 16px !important;
  }

  .cancel-btn,
  .save-btn {
    padding: 6px 16px !important;
    font-size: 13px !important;
  }
}

// 滚动条样式
.dialog-content {
  &::-webkit-scrollbar {
    width: 6px;
  }

  &::-webkit-scrollbar-track {
    background: $bg-light;
    border-radius: 3px;
  }

  &::-webkit-scrollbar-thumb {
    background: $border-color;
    border-radius: 3px;
  }

  &::-webkit-scrollbar-thumb:hover {
    background: $text-tertiary;
  }
}